← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ruinedyourlife/launchpad-bastion-scripts:feat-qastaging-build-label-check into launchpad-bastion-scripts:main

 

Quentin Debhi has proposed merging ~ruinedyourlife/launchpad-bastion-scripts:feat-qastaging-build-label-check into launchpad-bastion-scripts:main.

Commit message:
Check the build label of 3 apps from different stages

Errors out if the 3 build labels are not the same so we know one of the stages went wrong. This will allow us to identify quickly what the issue is to retry the deployment

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ruinedyourlife/launchpad-bastion-scripts/+git/launchpad-bastion-scripts/+merge/467020
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ruinedyourlife/launchpad-bastion-scripts:feat-qastaging-build-label-check into launchpad-bastion-scripts:main.
diff --git a/auto-upgrade-qastaging b/auto-upgrade-qastaging
old mode 100755
new mode 100644
index b590de8..c730212
--- a/auto-upgrade-qastaging
+++ b/auto-upgrade-qastaging
@@ -6,32 +6,45 @@ set -e
 # shellcheck disable=SC1091
 . "$HOME/.mojorc.qastaging"
 
+# Define the applications to check
+stage1_app="launchpad-admin"
+stage2_app="launchpad-appserver"
+stage3_app="launchpad-ppa-publisher"
+
 stable_commit="$(git ls-remote https://git.launchpad.net/launchpad refs/heads/stable | cut -f1)"
-deployed_commit="$(juju config launchpad-appserver build_label)"
 
-if [ "$stable_commit" != "$deployed_commit" ]; then
-    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
+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"
 fi

Follow ups