Skip to content

Commit

Permalink
Check Docker image is correctly tagged latest
Browse files Browse the repository at this point in the history
A recent change, #405, which added ARM64 Docker images to the build
process, introduced a bug whereby the new Docker images for each release
are no longer being tagged `latest`, as they should be.  This commit
adds a test to catch this bug, and we will fix the bug in a subsequent
commit.
  • Loading branch information
johnboyes authored Jan 19, 2024
1 parent 2ba18c6 commit a83499c
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/github_tag_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ on: # yamllint disable-line rule:truthy
types:
- closed

env:
docker_repo: agilepathway/pull-request-label-checker

jobs:

tag:
name: Tag semantic version
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.tag.outputs.tag }}
semver: ${{ steps.tag.outputs.tag }}
steps:
- name: Tag
uses: K-Phoen/[email protected]
Expand Down Expand Up @@ -65,6 +68,26 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
tags: agilepathway/pull-request-label-checker:${{ needs.tag.outputs.tag }}
tags: ${{env.docker_repo}}:${{ needs.tag.outputs.semver }}
platforms: linux/amd64,linux/arm64
push: true

check_latest_tag:
needs: [tag, build_and_push_docker_image]
runs-on: ubuntu-22.04
steps:

Check failure on line 79 in .github/workflows/github_tag_and_release.yml

View workflow job for this annotation

GitHub Actions / yamllint

[yamllint] .github/workflows/github_tag_and_release.yml#L79

[error] trailing spaces (trailing-spaces)
Raw output
./.github/workflows/github_tag_and_release.yml:79:1: [error] trailing spaces (trailing-spaces)
- name: Check Docker image for new release is tagged latest
id: check_docker_image_tagged_latest
# yamllint disable rule:line-length
run: |
docker pull ${{env.docker_repo}}:${{ needs.tag.outputs.semver }}
echo "IS_LATEST_TAGGED_CORRECTLY=$(docker image inspect ${{env.docker_repo}}:${{ needs.tag.outputs.semver }} | jq -r '.[] | (.RepoTags) | any( . == "${{env.docker_repo}}:latest") ')" >> "$GITHUB_OUTPUT"
# yamllint enable rule:line-length

Check failure on line 87 in .github/workflows/github_tag_and_release.yml

View workflow job for this annotation

GitHub Actions / yamllint

[yamllint] .github/workflows/github_tag_and_release.yml#L87

[error] trailing spaces (trailing-spaces)
Raw output
./.github/workflows/github_tag_and_release.yml:87:1: [error] trailing spaces (trailing-spaces)
- name: Fail if latest is not tagged correctly
if: ${{ steps.check_docker_image_tagged_latest.outputs.IS_LATEST_TAGGED_CORRECTLY == 'false' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('The newly released Docker image ${{ needs.tag.outputs.semver }} is not tagged latest. ')

0 comments on commit a83499c

Please sign in to comment.