Skip to content

Commit

Permalink
build: fix image tags to actually tag latest on main branch for depen…
Browse files Browse the repository at this point in the history
…dency images

Before, the latest tag was only added to the metadata when we are on the main branch :
(github.ref == 'refs/heads/main')

Together with the fact that we build the dependency images only when we did not hit
the cache lead to the fact that the latest tag was actually never applied to our
dependency images.
  • Loading branch information
Taepper committed Jun 17, 2024
1 parent 182406a commit 1efe7e3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ jobs:
cache-from: type=gha,ref=linter-dependencies-image-cache-${{ hashFiles('conanfile.py', 'Dockerfile_linter') }}
cache-to: type=gha,mode=min,ref=linter-dependencies-image-cache-${{ hashFiles('conanfile.py', 'Dockerfile_linter') }}

- name: Retag and push existing image if cache hit
if: env.CACHE_HIT == 'true'
run: |
TAGS=(${{ steps.dockerMetadata.outputs.tags }})
for TAG in "${TAGS[@]}"; do
docker buildx imagetools create --tag $TAG ${{ env.DOCKER_LINTER_DEPENDENCY_IMAGE_NAME }}:${{ env.DIR_HASH }}
done
linter:
name: Build And Run linter
needs: linterDependencies
Expand Down Expand Up @@ -163,6 +171,14 @@ jobs:
cache-to: type=gha,mode=min,ref=builder-image-cache-${{ hashFiles('conanfile.py', 'Dockerfile') }}
platforms: linux/amd64,linux/arm64

- name: Retag and push existing image if cache hit
if: env.CACHE_HIT == 'true'
run: |
TAGS=(${{ steps.dockerMetadata.outputs.tags }})
for TAG in "${TAGS[@]}"; do
docker buildx imagetools create --tag $TAG ${{ env.DOCKER_DEPENDENCY_IMAGE_NAME }}:${{ env.DIR_HASH }}
done
dockerImageUnitTests:
name: Build Docker Image and Run Unit Tests
runs-on: ubuntu-latest
Expand Down

0 comments on commit 1efe7e3

Please sign in to comment.