From dede7823852a96828b836e0720b7d21ba7f9b2b6 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 28 Nov 2024 09:47:19 +0100 Subject: [PATCH] Remove dependency local image Tagging is necessary when building for single arch because there may be nothing in cache yet. Removing the image is necessary for multipaltform build because local docker image store can only tag one arch. All per-arch build results are still in cache from the single arch build. Removing twice, which happens only for release pushing, was failing. So, hoist removal out. --- .github/workflows/build-ruby.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-ruby.yml b/.github/workflows/build-ruby.yml index eb0c036..bf1bd85 100644 --- a/.github/workflows/build-ruby.yml +++ b/.github/workflows/build-ruby.yml @@ -421,6 +421,10 @@ jobs: docker buildx build ${{ steps.vars.outputs.SRC }} "${cache_from[@]}" --output=type=image,push=true --build-arg BUILDKIT_INLINE_CACHE=1 --platform ${{ steps.vars.outputs.DOCKER_PLATFORMS }} -f ${{ steps.vars.outputs.DOCKERFILE }} --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc # TODO: hardcoded musl, unify gnu instead + - name: Remove dependency local image (${{ join(matrix.arch, ', ') }}) + if: ${{ matrix.libc == 'musl' }} + run: | + docker image rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }} - name: Push commit compiler image (${{ join(matrix.arch, ', ') }}) if: ${{ matrix.libc == 'musl' }} run: | @@ -432,7 +436,6 @@ jobs: done cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc) cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}) - docker image rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }} docker buildx build ${{ steps.vars.outputs.SRC }} "${cache_from[@]}" --output=type=image,push=true --build-arg BUILDKIT_INLINE_CACHE=1 --platform ${{ steps.vars.outputs.DOCKER_PLATFORMS }} -f ${{ steps.vars.outputs.DOCKERFILE }}.gcc --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc-g${{ github.sha }} - name: Push release compiler image (${{ join(matrix.arch, ', ') }}) if: ${{ inputs.push && matrix.libc == 'musl' }} @@ -445,5 +448,4 @@ jobs: done cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc) cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}) - docker image rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }} docker buildx build ${{ steps.vars.outputs.SRC }} "${cache_from[@]}" --output=type=image,push=true --build-arg BUILDKIT_INLINE_CACHE=1 --platform ${{ steps.vars.outputs.DOCKER_PLATFORMS }} -f ${{ steps.vars.outputs.DOCKERFILE }}.gcc --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc