launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31648
[Merge] ~lgp171188/launchpad-bastion-scripts:fix-auto-upgrade-script-issues into launchpad-bastion-scripts:main
Guruprasad has proposed merging ~lgp171188/launchpad-bastion-scripts:fix-auto-upgrade-script-issues into launchpad-bastion-scripts:main.
Commit message:
Fix the issues in the auto-upgrade-{qa,}staging scripts
* Fix incorrect nested quoting.
* When the build labels on any of the selected units from each stage
doesn't match the latest commit from the corresponding branch (`stable`
for qastaging and `db-stable` for staging), proceed with the deployment
attempt instead of erroring out.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~lgp171188/launchpad-bastion-scripts/+git/launchpad-bastion-scripts/+merge/474513
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad-bastion-scripts:fix-auto-upgrade-script-issues into launchpad-bastion-scripts:main.
diff --git a/auto-upgrade-qastaging b/auto-upgrade-qastaging
index c730212..e77e3ba 100755
--- a/auto-upgrade-qastaging
+++ b/auto-upgrade-qastaging
@@ -13,38 +13,38 @@ stage3_app="launchpad-ppa-publisher"
stable_commit="$(git ls-remote https://git.launchpad.net/launchpad refs/heads/stable | cut -f1)"
-stage1_app_deployed_commit="$(juju config "$stage1_app" build_label)"
-stage2_app_deployed_commit="$(juju config "$stage2_app" build_label)"
-stage3_app_deployed_commit="$(juju config "$stage3_app" build_label)"
+stage1_app_deployed_commit="$(juju config $stage1_app build_label)"
+stage2_app_deployed_commit="$(juju config $stage2_app build_label)"
+stage3_app_deployed_commit="$(juju config $stage3_app build_label)"
-# Check if the deployed commits are different
-if [ "$stage1_app_deployed_commit" != "$stage2_app_deployed_commit" ] || [ "$stage2_app_deployed_commit" != "$stage3_app_deployed_commit" ]; then
- echo "Error: Not all build labels are the same."
- exit 1
-fi
-
-# Continue with the deployment if all build labels are the same
-swift_storage_url="$(juju config launchpad-appserver swift_storage_url)"
-swift_container_name="$(juju config launchpad-appserver swift_container_name)"
-if curl -Isf -o /dev/null "$swift_storage_url/$swift_container_name/launchpad-builds/$stable_commit/launchpad.tar.gz"; then
- mkdir -p "$HOME/logs"
- exec >>"$HOME/logs/$(date +%F)-qastaging.log" 2>&1
- echo "Deploying $stable_commit"
- set-local-config launchpad-admin build_label="$stable_commit"
- set-local-config launchpad-appserver build_label="$stable_commit"
- set-local-config launchpad-assets build_label="$stable_commit"
- set-local-config launchpad-buildd-manager build_label="$stable_commit"
- set-local-config launchpad-codehosting build_label="$stable_commit"
- set-local-config launchpad-copy-archive-publisher build_label="$stable_commit"
- set-local-config launchpad-db-update build_label="$stable_commit"
- set-local-config launchpad-debian-importer build_label="$stable_commit"
- set-local-config launchpad-ftpmaster-publisher build_label="$stable_commit"
- set-local-config launchpad-ftpmaster-uploader build_label="$stable_commit"
- set-local-config launchpad-librarian build_label="$stable_commit"
- set-local-config launchpad-loggerhead build_label="$stable_commit"
- set-local-config launchpad-ppa-publisher build_label="$stable_commit"
- set-local-config launchpad-ppa-uploader build_label="$stable_commit"
- set-local-config launchpad-scripts build_label="$stable_commit"
- set-local-config launchpad-scripts-bzrsyncd build_label="$stable_commit"
- run-one mojo run "$MOJO_SPEC" "$MOJO_WORKSPACE"
+if [ "$stable_commit" != "$stage1_app_deployed_commit" ] || \
+ [ "$stable_commit" != "$stage2_app_deployed_commit" ] || \
+ [ "$stable_commit" != "$stage3_app_deployed_commit" ]
+then
+ # Attempt a deployment since at least one of the applications doesn't have
+ # the same build label as the `stable`` branch.
+ swift_storage_url="$(juju config launchpad-appserver swift_storage_url)"
+ swift_container_name="$(juju config launchpad-appserver swift_container_name)"
+ if curl -Isf -o /dev/null "$swift_storage_url/$swift_container_name/launchpad-builds/$stable_commit/launchpad.tar.gz"; then
+ mkdir -p "$HOME/logs"
+ exec >>"$HOME/logs/$(date +%F)-qastaging.log" 2>&1
+ echo "Deploying $stable_commit"
+ set-local-config launchpad-admin build_label="$stable_commit"
+ set-local-config launchpad-appserver build_label="$stable_commit"
+ set-local-config launchpad-assets build_label="$stable_commit"
+ set-local-config launchpad-buildd-manager build_label="$stable_commit"
+ set-local-config launchpad-codehosting build_label="$stable_commit"
+ set-local-config launchpad-copy-archive-publisher build_label="$stable_commit"
+ set-local-config launchpad-db-update build_label="$stable_commit"
+ set-local-config launchpad-debian-importer build_label="$stable_commit"
+ set-local-config launchpad-ftpmaster-publisher build_label="$stable_commit"
+ set-local-config launchpad-ftpmaster-uploader build_label="$stable_commit"
+ set-local-config launchpad-librarian build_label="$stable_commit"
+ set-local-config launchpad-loggerhead build_label="$stable_commit"
+ set-local-config launchpad-ppa-publisher build_label="$stable_commit"
+ set-local-config launchpad-ppa-uploader build_label="$stable_commit"
+ set-local-config launchpad-scripts build_label="$stable_commit"
+ set-local-config launchpad-scripts-bzrsyncd build_label="$stable_commit"
+ run-one mojo run "$MOJO_SPEC" "$MOJO_WORKSPACE"
+ fi
fi
diff --git a/auto-upgrade-staging b/auto-upgrade-staging
index 8ad58e4..94d61df 100755
--- a/auto-upgrade-staging
+++ b/auto-upgrade-staging
@@ -13,31 +13,32 @@ stage3_app="launchpad-scripts"
db_stable_commit="$(git ls-remote https://git.launchpad.net/launchpad refs/heads/db-stable | cut -f1)-db"
-stage1_app_deployed_commit="$(juju config "$stage1_app" build_label)"
-stage2_app_deployed_commit="$(juju config "$stage2_app" build_label)"
-stage3_app_deployed_commit="$(juju config "$stage3_app" build_label)"
+stage1_app_deployed_commit="$(juju config $stage1_app build_label)"
+stage2_app_deployed_commit="$(juju config $stage2_app build_label)"
+stage3_app_deployed_commit="$(juju config $stage3_app build_label)"
-# Check if the deployed commits are different
-if [ "$stage1_app_deployed_commit" != "$stage2_app_deployed_commit" ] || [ "$stage2_app_deployed_commit" != "$stage3_app_deployed_commit" ]; then
- echo "Error: Not all build labels are the same."
- exit 1
-fi
-
-swift_storage_url="$(juju config launchpad-appserver swift_storage_url)"
-swift_container_name="$(juju config launchpad-appserver swift_container_name)"
-if curl -Isf -o /dev/null "$swift_storage_url/$swift_container_name/launchpad-builds/$db_stable_commit/launchpad.tar.gz"; then
- mkdir -p "$HOME/logs"
- exec >>"$HOME/logs/$(date +%F)-staging.log" 2>&1
- echo "Deploying $db_stable_commit"
- set-local-config launchpad-admin build_label="$db_stable_commit"
- set-local-config launchpad-appserver build_label="$db_stable_commit"
- set-local-config launchpad-assets build_label="$db_stable_commit"
- set-local-config launchpad-buildd-manager build_label="$db_stable_commit"
- set-local-config launchpad-codehosting build_label="$db_stable_commit"
- set-local-config launchpad-db-update build_label="$db_stable_commit"
- set-local-config launchpad-librarian build_label="$db_stable_commit"
- set-local-config launchpad-loggerhead build_label="$db_stable_commit"
- set-local-config launchpad-scripts build_label="$db_stable_commit"
- set-local-config launchpad-scripts-bzrsyncd build_label="$db_stable_commit"
- run-one mojo run "$MOJO_SPEC" "$MOJO_WORKSPACE"
+if [ "$db_stable_commit" != "$stage1_app_deployed_commit" ] || \
+ [ "$db_stable_commit" != "$stage2_app_deployed_commit" ] || \
+ [ "$db_stable_commit" != "$stage3_app_deployed_commit" ]
+then
+ # Attempt a deployment since at least one of the applications doesn't have
+ # the same build label as the `db-stable`` branch.
+ swift_storage_url="$(juju config launchpad-appserver swift_storage_url)"
+ swift_container_name="$(juju config launchpad-appserver swift_container_name)"
+ if curl -Isf -o /dev/null "$swift_storage_url/$swift_container_name/launchpad-builds/$db_stable_commit/launchpad.tar.gz"; then
+ mkdir -p "$HOME/logs"
+ exec >>"$HOME/logs/$(date +%F)-staging.log" 2>&1
+ echo "Deploying $db_stable_commit"
+ set-local-config launchpad-admin build_label="$db_stable_commit"
+ set-local-config launchpad-appserver build_label="$db_stable_commit"
+ set-local-config launchpad-assets build_label="$db_stable_commit"
+ set-local-config launchpad-buildd-manager build_label="$db_stable_commit"
+ set-local-config launchpad-codehosting build_label="$db_stable_commit"
+ set-local-config launchpad-db-update build_label="$db_stable_commit"
+ set-local-config launchpad-librarian build_label="$db_stable_commit"
+ set-local-config launchpad-loggerhead build_label="$db_stable_commit"
+ set-local-config launchpad-scripts build_label="$db_stable_commit"
+ set-local-config launchpad-scripts-bzrsyncd build_label="$db_stable_commit"
+ run-one mojo run "$MOJO_SPEC" "$MOJO_WORKSPACE"
+ fi
fi