Merge lp:~ericsnowcurrently/landscape-bundles/new-charm-command into lp:landscape-bundles

Proposed by Eric Snow on 2017-01-20
Status: Merged
Approved by: Eric Snow on 2017-01-20
Approved revision: 40
Merged at revision: 34
Proposed branch: lp:~ericsnowcurrently/landscape-bundles/new-charm-command
Merge into: lp:landscape-bundles
Diff against target: 126 lines (+48/-29)
2 files modified
Makefile (+22/-19)
charm-store (+26/-10)
To merge this branch: bzr merge lp:~ericsnowcurrently/landscape-bundles/new-charm-command
Reviewer Review Type Date Requested Status
Данило Шеган (community) 2017-01-20 Approve on 2017-01-23
Alberto Donato 2017-01-20 Approve on 2017-01-20
Review via email: mp+315189@code.launchpad.net

Commit message

Update the scripts to the latest charm command.

I've also cleaned a few things up.

Description of the change

Update the scripts to the latest charm command.

I've also cleaned a few things up.

Testing instructions:

charm login # use your charm store user
make diff-charm-store
make upload CHARM_STORE_USER=<your username>
make diff-charm-store CHARM_STORE_USER=<your username> CHANNEL=edge # will fail
make release CHARM_STORE_USER=<your username> CHANNEL=edge
make diff-charm-store CHARM_STORE_USER=<your username> CHANNEL=edge
make release CHARM_STORE_USER=<your username> CHANNEL=beta
make release CHARM_STORE_USER=<your username>
make diff-charm-store CHARM_STORE_USER=<your username>
charm list
charm show <bundle URL>
# You can deploy the bundle at this point.

charm login # log in as "landscape"
make upload CHANNEL=edge
# You can deploy the bundle at this point.
charm show --channel edge <bundle URL>

To post a comment you must log in.
Alberto Donato (ack) wrote :

nice, +1

small nits inline

review: Approve
40. By Eric Snow on 2017-01-20

Small make file cleanups.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2016-07-22 14:57:28 +0000
3+++ Makefile 2017-01-20 20:06:39 +0000
4@@ -1,29 +1,32 @@
5-diff-charm-store: check-env render
6- ./charm-store diff $${CHARM_STORE_USER}
7-
8-push-charm-store: check-env render
9- ./charm-store push $${CHARM_STORE_USER}
10-
11-publish-charm-store: check-env render
12- ./charm-store publish-latest $${CHARM_STORE_USER}
13-
14-check-env:
15-ifndef CHARM_STORE_USER
16- $(error CHARM_STORE_USER is undefined, hint: launchpad id.)
17-endif
18-
19-clean:
20- @rm -rf build
21-
22+
23+CHARM_STORE_USER ?= "landscape"
24+
25+.PHONY: diff-charm-store
26+diff-charm-store: render
27+ ./charm-store diff ${CHARM_STORE_USER} ${CHANNEL}
28+
29+.PHONY: upload
30+upload: render
31+ ./charm-store push ${CHARM_STORE_USER} ${CHANNEL}
32+
33+.PHONY: release-latest
34+release-latest:
35+ ./charm-store publish-latest ${CHARM_STORE_USER} ${CHANNEL}
36+
37+.PHONY: render
38 render: deps clean
39 @./render-bundles
40-
41+
42+.PHONY: update-charm-revisions
43 update-charm-revisions: deps
44 @./update-charm-revisions \
45 $(EXTRA_UPDATE_ARGUMENTS) \
46 postgresql haproxy rabbitmq-server
47
48+.PHONY: deps
49 deps:
50 @./ubuntu-deps
51
52-.PHONY: clean render commit-charm-store update-charm-revisions compare-charm-store deps
53+.PHONY: clean
54+clean:
55+ @rm -rf build
56
57=== modified file 'charm-store'
58--- charm-store 2016-07-22 13:49:55 +0000
59+++ charm-store 2017-01-20 20:06:39 +0000
60@@ -6,6 +6,9 @@
61
62 ACTION=$1
63 STORE_USER=${2:-landscape}
64+CHANNEL=${3}
65+INITIAL_CHANNEL="edge"
66+RELEASE_CHANNEL="stable"
67
68 if [ -z "$ACTION" ]; then
69 cat <<EOF
70@@ -28,25 +31,37 @@
71 for target in landscape-dense-maas landscape-dense landscape-scalable; do
72
73 if [ "$ACTION" == "diff" ]; then
74- echo "# [$target] Pulling fresh copy from stable channel"
75- charm pull --channel stable "cs:~${STORE_USER}/bundle/${target}" build/${target}-stable
76+ if [ -z $CHANNEL ]; then
77+ CHANNEL=$RELEASE_CHANNEL
78+ fi
79+ echo "# [$target] Pulling fresh copy from $CHANNEL channel"
80+ (set -x; charm pull --channel $CHANNEL "cs:~${STORE_USER}/bundle/${target}" build/${target}-${CHANNEL})
81
82- echo "# [$target] Diff from latest stable"
83- diff -Naur --exclude bundles.yaml build/${target}-stable build/${target} || /bin/true
84+ echo "# [$target] Diff from latest $CHANNEL"
85+ (set +e; set -x; diff -Naur --exclude bundles.yaml build/${target}-${CHANNEL} build/${target}); RC=$?
86+ if [ $RC -eq 0 ]; then
87+ echo "<local bundle matches $CHANNEL channel>"
88+ fi
89 fi
90
91 if [ "$ACTION" == "push" ]; then
92 echo "# [$target] Pushing to namespace ~${STORE_USER}, unpublished channel"
93- url=$(charm push build/${target} cs:~${STORE_USER}/bundle/${target} | grep ^url | awk '{ print $2 }')
94+ url=$( (set -x; charm push build/${target} cs:~${STORE_USER}/bundle/${target}) | grep ^url | awk '{ print $2 }')
95
96- echo "# [$target] Publishing to development channel"
97- charm publish --channel development $url
98+ if [ -n $CHANNEL ]; then
99+ echo "# [$target] Publishing to ${CHANNEL} channel"
100+ (set -x; charm release --channel ${CHANNEL} $url)
101+ fi
102 fi
103
104 if [ "$ACTION" == "publish-latest" ]; then
105 latest=$(charm show --channel unpublished --format=json cs:~${STORE_USER}/bundle/${target} | jq -r '.["revision-info"].Revisions[0]')
106- echo "# [$target] Publishing latest unpublished revision, stable channel"
107- charm publish $latest
108+
109+ if [ -z $CHANNEL ]; then
110+ CHANNEL=$RELEASE_CHANNEL
111+ fi
112+ echo "# [$target] Publishing latest unpublished revision to ${CHANNEL} channel"
113+ (set -x; charm release --channel ${CHANNEL} $latest)
114 fi
115
116 done
117@@ -58,7 +73,8 @@
118 # ll build/*-stable"
119 #
120 # Show details in the store:
121-# charm show [--channel unpublished] cs:~${STORE_USER}/bundle/landscape-dense-maas
122+# charm show cs:~${STORE_USER}/bundle/landscape-dense-maas
123+# charm show --channel unpublished cs:~${STORE_USER}/bundle/landscape-dense-maas
124 #
125 # Make sure everyone can use your charm if you want:
126 # charm grant cs:~${STORE_USER}/bundle/BUNDLE_NAME-VERSION everyone

Subscribers

People subscribed via source and target branches

to all changes: