Skip to content

Commit

Permalink
Fix parent caching
Browse files Browse the repository at this point in the history
The for loop wasn't splitting. Use proper bash arrays.
  • Loading branch information
lloeki committed Nov 28, 2024
1 parent e988fb7 commit 188cce8
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/build-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ jobs:
if: ${{ contains(matrix.arch, 'x86_64') }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -250,8 +250,8 @@ jobs:
if: ${{ contains(matrix.arch, 'x86_64') }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -271,8 +271,8 @@ jobs:
if: ${{ contains(matrix.arch, 'x86_64') }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -281,8 +281,8 @@ jobs:
if: ${{ contains(matrix.arch, 'x86_64') && matrix.libc == 'musl' }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc)
Expand All @@ -302,8 +302,8 @@ jobs:
if: ${{ contains(matrix.arch, 'aarch64') }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -312,8 +312,8 @@ jobs:
if: ${{ contains(matrix.arch, 'aarch64') }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -333,8 +333,8 @@ jobs:
if: ${{ contains(matrix.arch, 'aarch64') }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -343,8 +343,8 @@ jobs:
if: ${{ contains(matrix.arch, 'aarch64') && matrix.libc == 'musl' }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc)
Expand All @@ -360,17 +360,17 @@ jobs:
- name: Push CI run image (${{ join(matrix.arch, ', ') }})
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ 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 }} --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }}
- name: Push commit image (${{ join(matrix.arch, ', ') }})
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -379,8 +379,8 @@ jobs:
if: ${{ inputs.push }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -391,8 +391,8 @@ jobs:
if: ${{ inputs.push && matrix.libc == 'gnu' }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }})
Expand All @@ -403,8 +403,8 @@ jobs:
if: ${{ matrix.libc == 'gnu' || matrix.libc == 'centos' }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc)
Expand All @@ -413,8 +413,8 @@ jobs:
if: ${{ inputs.push && (matrix.libc == 'gnu' || matrix.libc == 'centos') }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc-g${sha})
done
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc)
Expand All @@ -429,8 +429,8 @@ jobs:
if: ${{ matrix.libc == 'musl' }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc-g${sha})
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
Expand All @@ -441,8 +441,8 @@ jobs:
if: ${{ inputs.push && matrix.libc == 'musl' }}
run: |
cache_from=()
parents="$(git rev-list --parents -n 1 ${{ github.sha }})"
for sha in $parents; do
parents=( $(git rev-list --parents -n 1 ${{ github.sha }}) )
for sha in "${parents[@]}"; do
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-gcc-g${sha})
cache_from+=(--cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.RELEASE_TAG }}-g${sha})
done
Expand Down

0 comments on commit 188cce8

Please sign in to comment.