Skip to content

Commit 369110a

Browse files
authored
Start the olbase build from the deploy wizard with gh (#13947)
If the olbase image is out of date and the gh CLI is installed, the wizard now triggers olbase.yaml itself before the announcement and waits for it with `gh run watch` before the openlibrary deploy. Without gh it falls back to the existing "click Run workflow" prompt.
1 parent 387deba commit 369110a

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

‎scripts/deployment/deploy.sh‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,16 @@ check_olbase_image_up_to_date() {
411411
fi
412412
}
413413

414+
# Start the olbase build with the gh CLI, if installed, so it builds during the rest
415+
# of the deploy. Sets OLBASE_RUN_ID. Returns 1 if gh is missing or the dispatch fails.
416+
start_olbase_build() {
417+
command -v gh &> /dev/null || return 1
418+
local run_url
419+
run_url=$(gh workflow run olbase.yaml --repo internetarchive/openlibrary --ref "${GIT_BRANCH:-master}" | grep /actions/runs/) || return 1
420+
OLBASE_RUN_ID=${run_url##*/}
421+
echo "✓ Started olbase build: $run_url"
422+
}
423+
414424
deploy_openlibrary() {
415425
HOSTNAMES=${SERVERS:-$ALL_HOSTNAMES}
416426
FQDNS=$(echo $HOSTNAMES | sed "s/ /$SERVER_SUFFIX /g")$SERVER_SUFFIX
@@ -940,6 +950,15 @@ deploy_wizard() {
940950
fi
941951
echo ""
942952

953+
# Start the olbase image build before the announcement so it builds during the
954+
# announcement and olsystem deploy. Without gh, it has to be started by hand.
955+
if ! check_olbase_image_up_to_date; then
956+
if ! start_olbase_build; then
957+
read -p "Once you've clicked 'Run workflow', press Enter to continue..."
958+
fi
959+
fi
960+
echo ""
961+
943962
# Announce the deploy
944963
echo "[Now] Announce deploy to #openlibrary-g, #openlibrary, and #open-librarians-g:"
945964
echo ""
@@ -951,11 +970,6 @@ deploy_wizard() {
951970
read -p "Once announced, press Enter to continue..."
952971
echo ""
953972

954-
if ! check_olbase_image_up_to_date; then
955-
read -p "Once you've clicked 'Run workflow', press Enter to continue..."
956-
fi
957-
echo ""
958-
959973
# Deploy olsystem
960974
echo "[Next] Run olsystem deploy (~2m30 as of 2024-12-06):"
961975
echo "time SERVER_SUFFIX='$SERVER_SUFFIX' ./scripts/deployment/deploy.sh olsystem"
@@ -967,8 +981,11 @@ deploy_wizard() {
967981
fi
968982
echo ""
969983

984+
if [ -n "$OLBASE_RUN_ID" ]; then
985+
gh run watch "$OLBASE_RUN_ID" --repo internetarchive/openlibrary --exit-status --compact --interval 30 || true
986+
fi
970987
until check_olbase_image_up_to_date; do
971-
read -p "Once built, press Enter to continue..."
988+
read -p "Image still out of date. Check the olbase build, then press Enter to recheck..."
972989
done
973990
echo ""
974991

0 commit comments

Comments
 (0)