ci: mirror update-dev-builder-version.sh for the epoch-bump PR flow

Align the lockstep step with the repository's established dev-image
tag-update convention instead of the force-pushed long-lived branch:

- timestamped ci/update-query-regression-epoch-YYYYMMDDHHMMSS branch
  per rebuild, plain (non-force) push
- fresh PR per rebuild with the same reviewer list as the dev-builder
  script, plus WenyXu (query-regression runner owner)
- bot identity greptimedb-ci@greptime.com and a signed commit,
  matching .github/scripts/update-dev-builder-version.sh

The QUERY_REGRESSION_ECS_IMAGE_ID variable still updates only after
the PR exists (same-toolchain swaps are cache-ABI-safe).

Signed-off-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
Ning Sun
2026-09-28 17:13:01 +08:00
parent 3657fac7d8
commit 3a66d92bb9
@@ -337,16 +337,18 @@ jobs:
# temporary pay-as-you-go ECS builder, snapshots a new custom image,
# then completes the documented lockstep updates in order:
# 1. bumps RUNNER_IMAGE_EPOCH in query-regression.yml (target-cache
# invalidation) and pushes the commit to main, and only then
# invalidation) via a PR from a timestamped ci/ branch (main is
# branch-protected; mirrors update-dev-builder-version.sh), and
# 2. points the repo variable QUERY_REGRESSION_ECS_IMAGE_ID at the
# new image, so the next regression run picks up image and epoch
# together.
# new image. Same-toolchain image swaps are cache-ABI-safe (the
# cache marker also keys on RUSTUP_TOOLCHAIN), so not waiting for
# the PR merge is fine.
#
# Required repository configuration (same names the provisioning job
# uses): vars ALIYUN_ECS_REGION_ID, ALIYUN_ECS_VSWITCH_ID,
# ALIYUN_ECS_SECURITY_GROUP_ID, optionally ALIYUN_ECS_RESOURCE_GROUP_ID
# and ALIYUN_ECS_BASE_IMAGE_ID (deterministic base-image pin; otherwise
# the rebuild auto-resolves the latest public Ubuntu 24.04 image).
# the rebuild auto-resolves the latest public Ubuntu LTS image).
# Secrets: ALICLOUD_ECS_ACCESS_KEY_ID, ALICLOUD_ECS_ACCESS_KEY_SECRET,
# GH_PERSONAL_ACCESS_TOKEN (repo push + actions-variable write).
name: Rebuild query-regression runner image
@@ -407,28 +409,33 @@ jobs:
new_epoch=$((old_epoch + 1))
# main is branch-protected (required reviews + status checks), so
# the epoch bump rides a dedicated bot branch with one long-lived
# PR; a force-push reuses the same PR for repeated rebuilds. Do NOT
# use [skip ci] on the commit: the required checks must be able to
# run for the PR to become mergeable.
BRANCH="ci/query-regression-runner-image-epoch"
# the epoch bump cannot be pushed there directly. Mirror
# .github/scripts/update-dev-builder-version.sh: timestamped bot
# branch, plain push, and a PR with reviewers. Do NOT use [skip ci]
# on the commit: the required checks must be able to run for the PR
# to become mergeable.
BRANCH="ci/update-query-regression-epoch-$(date +%Y%m%d%H%M%S)"
git config user.name "greptimedb-ci"
git config user.email "greptimedb-ci@users.noreply.github.com"
git config user.email "greptimedb-ci@greptime.com"
git fetch origin main
git checkout -B "${BRANCH}" origin/main
git checkout -b "${BRANCH}" origin/main
sed -i "s/readonly RUNNER_IMAGE_EPOCH=\"${old_epoch}\"/readonly RUNNER_IMAGE_EPOCH=\"${new_epoch}\"/" \
.github/workflows/query-regression.yml
git add .github/workflows/query-regression.yml
git commit -m "ci(query-regression): bump RUNNER_IMAGE_EPOCH to ${new_epoch} for image ${image_id}"
git push --force origin "${BRANCH}"
git commit -s -m "ci(query-regression): bump RUNNER_IMAGE_EPOCH to ${new_epoch} for image ${image_id}"
git push origin "${BRANCH}"
if [[ "$(gh pr view "${BRANCH}" --json state --jq .state 2>/dev/null || true)" == "OPEN" ]]; then
gh pr comment "${BRANCH}" --body "Rebuild ${image_id}: RUNNER_IMAGE_EPOCH ${old_epoch} → ${new_epoch}. (Force-push updated the existing PR.)"
else
gh pr create --head "${BRANCH}" --base main \
--title "ci(query-regression): bump RUNNER_IMAGE_EPOCH to ${new_epoch}" \
--body "Auto-generated by the \`Rebuild query-regression runner image\` job in ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} for image \`${image_id}\`. Merging this invalidates the query-regression target cache (RUNNER_IMAGE_EPOCH ${old_epoch} → ${new_epoch}). The \`QUERY_REGRESSION_ECS_IMAGE_ID\` repo variable already points at the new image; the epoch bump is belt-and-suspenders for image-content drift. Needs a review and the required checks to merge."
fi
gh pr create \
--title "ci(query-regression): bump RUNNER_IMAGE_EPOCH to ${new_epoch}" \
--body "Auto-generated by the \`Rebuild query-regression runner image\` job in ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} for image \`${image_id}\`. Merging this invalidates the query-regression target cache (RUNNER_IMAGE_EPOCH ${old_epoch} → ${new_epoch}). The \`QUERY_REGRESSION_ECS_IMAGE_ID\` repo variable already points at the new image; the epoch bump is belt-and-suspenders for image-content drift." \
--base main \
--head "${BRANCH}" \
--reviewer sunng87 \
--reviewer daviderli614 \
--reviewer killme2008 \
--reviewer evenyag \
--reviewer fengjiachun \
--reviewer WenyXu
# Point the variable at the new image once the PR exists. Same-toolchain
# image swaps are cache-ABI-safe (the cache marker also keys on