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

Proposed by Eric Snow
Status: Merged
Approved by: Eric Snow
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) Approve
Alberto Donato (community) Approve
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.
Revision history for this message
Alberto Donato (ack) wrote :

nice, +1

small nits inline

review: Approve
40. By Eric Snow

Small make file cleanups.

Revision history for this message
Eric Snow (ericsnowcurrently) :
Revision history for this message
Данило Шеган (danilo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2016-07-22 14:57:28 +0000
+++ Makefile 2017-01-20 20:06:39 +0000
@@ -1,29 +1,32 @@
1diff-charm-store: check-env render1
2 ./charm-store diff $${CHARM_STORE_USER}2CHARM_STORE_USER ?= "landscape"
33
4push-charm-store: check-env render4.PHONY: diff-charm-store
5 ./charm-store push $${CHARM_STORE_USER}5diff-charm-store: render
66 ./charm-store diff ${CHARM_STORE_USER} ${CHANNEL}
7publish-charm-store: check-env render7
8 ./charm-store publish-latest $${CHARM_STORE_USER}8.PHONY: upload
99upload: render
10check-env:10 ./charm-store push ${CHARM_STORE_USER} ${CHANNEL}
11ifndef CHARM_STORE_USER11
12 $(error CHARM_STORE_USER is undefined, hint: launchpad id.)12.PHONY: release-latest
13endif13release-latest:
1414 ./charm-store publish-latest ${CHARM_STORE_USER} ${CHANNEL}
15clean:15
16 @rm -rf build16.PHONY: render
17
18render: deps clean17render: deps clean
19 @./render-bundles18 @./render-bundles
20 19
20.PHONY: update-charm-revisions
21update-charm-revisions: deps21update-charm-revisions: deps
22 @./update-charm-revisions \22 @./update-charm-revisions \
23 $(EXTRA_UPDATE_ARGUMENTS) \23 $(EXTRA_UPDATE_ARGUMENTS) \
24 postgresql haproxy rabbitmq-server24 postgresql haproxy rabbitmq-server
2525
26.PHONY: deps
26deps:27deps:
27 @./ubuntu-deps28 @./ubuntu-deps
2829
29.PHONY: clean render commit-charm-store update-charm-revisions compare-charm-store deps30.PHONY: clean
31clean:
32 @rm -rf build
3033
=== modified file 'charm-store'
--- charm-store 2016-07-22 13:49:55 +0000
+++ charm-store 2017-01-20 20:06:39 +0000
@@ -6,6 +6,9 @@
66
7ACTION=$17ACTION=$1
8STORE_USER=${2:-landscape}8STORE_USER=${2:-landscape}
9CHANNEL=${3}
10INITIAL_CHANNEL="edge"
11RELEASE_CHANNEL="stable"
912
10if [ -z "$ACTION" ]; then13if [ -z "$ACTION" ]; then
11 cat <<EOF14 cat <<EOF
@@ -28,25 +31,37 @@
28for target in landscape-dense-maas landscape-dense landscape-scalable; do31for target in landscape-dense-maas landscape-dense landscape-scalable; do
2932
30 if [ "$ACTION" == "diff" ]; then33 if [ "$ACTION" == "diff" ]; then
31 echo "# [$target] Pulling fresh copy from stable channel"34 if [ -z $CHANNEL ]; then
32 charm pull --channel stable "cs:~${STORE_USER}/bundle/${target}" build/${target}-stable35 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})
3339
34 echo "# [$target] Diff from latest stable"40 echo "# [$target] Diff from latest $CHANNEL"
35 diff -Naur --exclude bundles.yaml build/${target}-stable build/${target} || /bin/true41 (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
36 fi45 fi
3746
38 if [ "$ACTION" == "push" ]; then47 if [ "$ACTION" == "push" ]; then
39 echo "# [$target] Pushing to namespace ~${STORE_USER}, unpublished channel"48 echo "# [$target] Pushing to namespace ~${STORE_USER}, unpublished channel"
40 url=$(charm push build/${target} cs:~${STORE_USER}/bundle/${target} | grep ^url | awk '{ print $2 }')49 url=$( (set -x; charm push build/${target} cs:~${STORE_USER}/bundle/${target}) | grep ^url | awk '{ print $2 }')
4150
42 echo "# [$target] Publishing to development channel"51 if [ -n $CHANNEL ]; then
43 charm publish --channel development $url52 echo "# [$target] Publishing to ${CHANNEL} channel"
53 (set -x; charm release --channel ${CHANNEL} $url)
54 fi
44 fi55 fi
4556
46 if [ "$ACTION" == "publish-latest" ]; then57 if [ "$ACTION" == "publish-latest" ]; then
47 latest=$(charm show --channel unpublished --format=json cs:~${STORE_USER}/bundle/${target} | jq -r '.["revision-info"].Revisions[0]')58 latest=$(charm show --channel unpublished --format=json cs:~${STORE_USER}/bundle/${target} | jq -r '.["revision-info"].Revisions[0]')
48 echo "# [$target] Publishing latest unpublished revision, stable channel"59
49 charm publish $latest60 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)
50 fi65 fi
5166
52done67done
@@ -58,7 +73,8 @@
58# ll build/*-stable"73# ll build/*-stable"
59#74#
60# Show details in the store:75# Show details in the store:
61# charm show [--channel unpublished] cs:~${STORE_USER}/bundle/landscape-dense-maas76# charm show cs:~${STORE_USER}/bundle/landscape-dense-maas
77# charm show --channel unpublished cs:~${STORE_USER}/bundle/landscape-dense-maas
62#78#
63# Make sure everyone can use your charm if you want:79# Make sure everyone can use your charm if you want:
64# charm grant cs:~${STORE_USER}/bundle/BUNDLE_NAME-VERSION everyone80# charm grant cs:~${STORE_USER}/bundle/BUNDLE_NAME-VERSION everyone

Subscribers

People subscribed via source and target branches

to all changes: