From aedeb37220e77f1c875030b4a2543782277a9508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JC=20Gr=C3=BCnhage?= Date: Wed, 19 Mar 2025 10:34:28 +0100 Subject: [PATCH] fix(ci): put the BUILD_TAG of the upcoming release into RC PR artifacts (#11304) ## Problem #11061 changed how artifacts for releases are built, by reusing/retagging the artifacts from release PRs. This resulted in the BUILD_TAG that's baked into the images to not be as expected. Context: https://neondb.slack.com/archives/C08JBTT3R1Q/p1742333300129069 ## Summary of changes Set BUILD_TAG to the release tag of the upcoming release when running inside release PRs. --- .github/workflows/_meta.yml | 29 +++++++++++++++++++++------- .github/workflows/build_and_test.yml | 6 +++--- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/_meta.yml b/.github/workflows/_meta.yml index 44802f0525..c5b171688c 100644 --- a/.github/workflows/_meta.yml +++ b/.github/workflows/_meta.yml @@ -9,6 +9,9 @@ on: build-tag: description: "Tag for the current workflow run" value: ${{ jobs.tags.outputs.build-tag }} + release-tag: + description: "Tag for the release if this is an RC PR run" + value: ${{ jobs.tags.outputs.release-tag }} previous-storage-release: description: "Tag of the last storage release" value: ${{ jobs.tags.outputs.storage }} @@ -35,7 +38,8 @@ jobs: tags: runs-on: ubuntu-22.04 outputs: - build-tag: ${{ steps.build-tag.outputs.tag }} + build-tag: ${{ steps.build-tag.outputs.build-tag }} + release-tag: ${{ steps.build-tag.outputs.release-tag }} compute: ${{ steps.previous-releases.outputs.compute }} proxy: ${{ steps.previous-releases.outputs.proxy }} storage: ${{ steps.previous-releases.outputs.storage }} @@ -79,16 +83,16 @@ jobs: run: | case $RUN_KIND in push-main) - echo "tag=$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT + echo "build-tag=$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT ;; storage-release) - echo "tag=release-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT + echo "build-tag=release-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT ;; proxy-release) - echo "tag=release-proxy-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT + echo "build-tag=release-proxy-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT ;; compute-release) - echo "tag=release-compute-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT + echo "build-tag=release-compute-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT ;; pr|storage-rc-pr|compute-rc-pr|proxy-rc-pr) BUILD_AND_TEST_RUN_ID=$(gh api --paginate \ @@ -96,10 +100,21 @@ jobs: -H "X-GitHub-Api-Version: 2022-11-28" \ "/repos/${GITHUB_REPOSITORY}/actions/runs?head_sha=${CURRENT_SHA}&branch=${CURRENT_BRANCH}" \ | jq '[.workflow_runs[] | select(.name == "Build and Test")][0].id // ("Error: No matching workflow run found." | halt_error(1))') - echo "tag=$BUILD_AND_TEST_RUN_ID" | tee -a $GITHUB_OUTPUT + echo "build-tag=$BUILD_AND_TEST_RUN_ID" | tee -a $GITHUB_OUTPUT + case $RUN_KIND in + storage-rc-pr) + echo "release-tag=release-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT + ;; + proxy-rc-pr) + echo "release-tag=release-proxy-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT + ;; + compute-rc-pr) + echo "release-tag=release-compute-$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT + ;; + esac ;; workflow-dispatch) - echo "tag=$GITHUB_RUN_ID" | tee -a $GITHUB_OUTPUT + echo "build-tag=$GITHUB_RUN_ID" | tee -a $GITHUB_OUTPUT ;; *) echo "Unexpected RUN_KIND ('${RUN_KIND}'), failing to assign build-tag!" diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index bc88da316a..ac1ec94311 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -544,7 +544,7 @@ jobs: build-args: | ADDITIONAL_RUSTFLAGS=${{ matrix.arch == 'arm64' && '-Ctarget-feature=+lse -Ctarget-cpu=neoverse-n1' || '' }} GIT_VERSION=${{ github.event.pull_request.head.sha || github.sha }} - BUILD_TAG=${{ needs.meta.outputs.build-tag }} + BUILD_TAG=${{ needs.meta.outputs.release-tag || needs.meta.outputs.build-tag }} TAG=${{ needs.build-build-tools-image.outputs.image-tag }}-bookworm DEBIAN_VERSION=bookworm provenance: false @@ -647,7 +647,7 @@ jobs: build-args: | GIT_VERSION=${{ github.event.pull_request.head.sha || github.sha }} PG_VERSION=${{ matrix.version.pg }} - BUILD_TAG=${{ needs.meta.outputs.build-tag }} + BUILD_TAG=${{ needs.meta.outputs.release-tag || needs.meta.outputs.build-tag }} TAG=${{ needs.build-build-tools-image.outputs.image-tag }}-${{ matrix.version.debian }} DEBIAN_VERSION=${{ matrix.version.debian }} provenance: false @@ -667,7 +667,7 @@ jobs: build-args: | GIT_VERSION=${{ github.event.pull_request.head.sha || github.sha }} PG_VERSION=${{ matrix.version.pg }} - BUILD_TAG=${{ needs.meta.outputs.build-tag }} + BUILD_TAG=${{ needs.meta.outputs.release-tag || needs.meta.outputs.build-tag }} TAG=${{ needs.build-build-tools-image.outputs.image-tag }}-${{ matrix.version.debian }} DEBIAN_VERSION=${{ matrix.version.debian }} provenance: false