Skip to content

Commit

Permalink
CI(check-build-tools-image): change build-tools image persistent tag (#…
Browse files Browse the repository at this point in the history
…8059)

## Problem

We don't rebuild `build-tools` image for changes in a workflow that
builds this image itself
(`.github/workflows/build-build-tools-image.yml`) or in a workflow that
determines which tag to use
(`.github/workflows/check-build-tools-image.yml`)

## Summary of changes
- Use a hash of `Dockerfile.build-tools` and workflow files as a
persistent tag instead of using a commit sha.
  • Loading branch information
bayandin authored Jun 17, 2024
1 parent 16d8012 commit b6e1c09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-build-tools-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
check-image:
uses: ./.github/workflows/check-build-tools-image.yml

# This job uses older version of GitHub Actions because it's run on gen2 runners, which don't support node 20 (for newer versions)
build-image:
needs: [ check-image ]
if: needs.check-image.outputs.found == 'false'
Expand Down
23 changes: 7 additions & 16 deletions .github/workflows/check-build-tools-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,17 @@ jobs:
found: ${{ steps.check-image.outputs.found }}

steps:
- uses: actions/checkout@v4

- name: Get build-tools image tag for the current commit
id: get-build-tools-tag
env:
# Usually, for COMMIT_SHA, we use `github.event.pull_request.head.sha || github.sha`, but here, even for PRs,
# we want to use `github.sha` i.e. point to a phantom merge commit to determine the image tag correctly.
COMMIT_SHA: ${{ github.sha }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_TAG: |
${{ hashFiles('Dockerfile.build-tools',
'.github/workflows/check-build-tools-image.yml',
'.github/workflows/build-build-tools-image.yml') }}
run: |
LAST_BUILD_TOOLS_SHA=$(
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--method GET \
--field path=Dockerfile.build-tools \
--field sha=${COMMIT_SHA} \
--field per_page=1 \
--jq ".[0].sha" \
"/repos/${GITHUB_REPOSITORY}/commits"
)
echo "image-tag=${LAST_BUILD_TOOLS_SHA}" | tee -a $GITHUB_OUTPUT
echo "image-tag=${IMAGE_TAG}" | tee -a $GITHUB_OUTPUT
- name: Check if such tag found in the registry
id: check-image
Expand Down

1 comment on commit b6e1c09

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3310 tests run: 3172 passed, 0 failed, 138 skipped (full report)


Flaky tests (2)

Postgres 14

  • test_pageserver_restarts_under_worload: release
  • test_subscriber_restart: release

Code coverage* (full report)

  • functions: 32.4% (6831 of 21065 functions)
  • lines: 50.0% (53148 of 106317 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
b6e1c09 at 2024-06-17T13:07:34.206Z :recycle:

Please sign in to comment.