6
by David Britton
Add simple helper and Makefile for interacting with charm-store [trivial] |
1 |
#!/bin/bash -e
|
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
2 |
#
|
3 |
# Mostly intended to be called with make targets
|
|
4 |
# Needs make clean, make render called first.
|
|
5 |
#
|
|
6 |
||
7 |
ACTION=$1 |
|
8 |
STORE_USER=${2:-landscape} |
|
33.1.4
by Eric Snow
Support specifying the target channel. |
9 |
CHANNEL=${3} |
33.1.2
by Eric Snow
Update charm-store to match up-to-date charm command. |
10 |
INITIAL_CHANNEL="edge" |
11 |
RELEASE_CHANNEL="stable" |
|
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
12 |
|
13 |
if [ -z "$ACTION" ]; then |
|
14 |
cat <<EOF
|
|
15 |
Usage: $0 ACTION [user]
|
|
16 |
actions:
|
|
17 |
push - push to 'unpublished' channel
|
|
18 |
publish-latest - publish the latest copy
|
|
19 |
diff - diff your branch to the latest stable channel copy
|
|
20 |
user:
|
|
21 |
charm store user name
|
|
22 |
EOF
|
|
23 |
exit 1 |
|
24 |
fi
|
|
25 |
||
26 |
if [ "$ACTION" == "push" ]; then |
|
24.1.4
by David Britton
update to postgresql-42 |
27 |
echo "# Will be pushing new [unpublished] versions to the charm store" |
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
28 |
echo "# as user: $STORE_USER" |
24.1.4
by David Britton
update to postgresql-42 |
29 |
fi
|
6
by David Britton
Add simple helper and Makefile for interacting with charm-store [trivial] |
30 |
|
24.1.3
by David Britton
charm-store script now does charm pull |
31 |
for target in landscape-dense-maas landscape-dense landscape-scalable; do |
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
32 |
|
24.1.11
by David Britton
don't pull the charm for the 'push' action. |
33 |
if [ "$ACTION" == "diff" ]; then |
33.1.4
by Eric Snow
Support specifying the target channel. |
34 |
if [ -z $CHANNEL ]; then |
35 |
CHANNEL=$RELEASE_CHANNEL |
|
36 |
fi
|
|
37 |
echo "# [$target] Pulling fresh copy from $CHANNEL channel" |
|
38 |
(set -x; charm pull --channel $CHANNEL "cs:~${STORE_USER}/bundle/${target}" build/${target}-${CHANNEL}) |
|
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
39 |
|
33.1.4
by Eric Snow
Support specifying the target channel. |
40 |
echo "# [$target] Diff from latest $CHANNEL" |
41 |
(set +e; set -x; diff -Naur --exclude bundles.yaml build/${target}-${CHANNEL} build/${target}); RC=$? |
|
42 |
if [ $RC -eq 0 ]; then |
|
43 |
echo "<local bundle matches $CHANNEL channel>" |
|
44 |
fi
|
|
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
45 |
fi
|
46 |
||
47 |
if [ "$ACTION" == "push" ]; then |
|
48 |
echo "# [$target] Pushing to namespace ~${STORE_USER}, unpublished channel" |
|
33.1.2
by Eric Snow
Update charm-store to match up-to-date charm command. |
49 |
url=$( (set -x; charm push build/${target} cs:~${STORE_USER}/bundle/${target}) | grep ^url | awk '{ print $2 }') |
24.1.15
by David Britton
add a development channel publish after every push. |
50 |
|
33.1.6
by Eric Snow
By default, do not release when uploading a charm. |
51 |
if [ -n $CHANNEL ]; then |
52 |
echo "# [$target] Publishing to ${CHANNEL} channel" |
|
53 |
(set -x; charm release --channel ${CHANNEL} $url) |
|
33.1.4
by Eric Snow
Support specifying the target channel. |
54 |
fi
|
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
55 |
fi
|
56 |
||
57 |
if [ "$ACTION" == "publish-latest" ]; then |
|
24.1.16
by David Britton
add --channel unpublished to show command |
58 |
latest=$(charm show --channel unpublished --format=json cs:~${STORE_USER}/bundle/${target} | jq -r '.["revision-info"].Revisions[0]') |
33.1.4
by Eric Snow
Support specifying the target channel. |
59 |
|
60 |
if [ -z $CHANNEL ]; then |
|
61 |
CHANNEL=$RELEASE_CHANNEL |
|
62 |
fi
|
|
63 |
echo "# [$target] Publishing latest unpublished revision to ${CHANNEL} channel" |
|
64 |
(set -x; charm release --channel ${CHANNEL} $latest) |
|
24.1.4
by David Britton
update to postgresql-42 |
65 |
fi
|
66 |
||
6
by David Britton
Add simple helper and Makefile for interacting with charm-store [trivial] |
67 |
done
|
24.1.3
by David Britton
charm-store script now does charm pull |
68 |
|
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
69 |
cat <<EOF
|
70 |
#
|
|
71 |
# You can manually examine things if you wish:"
|
|
72 |
# ll build/*"
|
|
73 |
# ll build/*-stable"
|
|
74 |
#
|
|
24.1.15
by David Britton
add a development channel publish after every push. |
75 |
# Show details in the store:
|
33.1.4
by Eric Snow
Support specifying the target channel. |
76 |
# charm show cs:~${STORE_USER}/bundle/landscape-dense-maas
|
77 |
# charm show --channel unpublished cs:~${STORE_USER}/bundle/landscape-dense-maas
|
|
24.1.15
by David Britton
add a development channel publish after every push. |
78 |
#
|
79 |
# Make sure everyone can use your charm if you want:
|
|
80 |
# charm grant cs:~${STORE_USER}/bundle/BUNDLE_NAME-VERSION everyone
|
|
81 |
#
|
|
24.1.6
by David Britton
make targets more explicit to protect people from publishing in the wrong namespace, better usage, add publish option. |
82 |
# Publish like this (controls what clients see by default, you can
|
83 |
# even set it to a previous known good version):
|
|
84 |
# charm publish cs:~${STORE_USER}/bundle/BUNDLE_NAME-VERSION
|
|
85 |
#
|
|
86 |
EOF
|