Skip to content

Commit 9e80d3e

Browse files
authored
Save digest artifacts into own directory per run (#182)
* Save digest artifacts into own directory per run Currently it seems that we have too many digests in the folder and I think this breaks the assembly of the multiarch docker image. With this change only digests for the same run are saved in the same directory. * Fail docker image merge on wrong number of digests * Clean digests dir
1 parent 7d73c05 commit 9e80d3e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Diff for: .github/actions/docker-image/action.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ runs:
4444
cache-to: type=gha,mode=max
4545
outputs: type=image,name=${{ inputs.images }},push-by-digest=true,name-canonical=true,push=true
4646

47+
# This will upload the digest for each architecture to the same artifact,
48+
# Note: upload-artifact@v4 will no longer support this.
49+
# https://github.com/actions/upload-artifact?tab=readme-ov-file#not-uploading-to-the-same-artifact
4750
- name: Export digest
4851
shell: bash
4952
run: |
50-
digest_dir="${{ runner.temp }}/${{ inputs.target }}-digests"
53+
digest_dir="${{ runner.temp }}/${{ inputs.target }}-${{ github.run_number }}-digests"
5154
mkdir -p "${digest_dir}"
5255
digest="${{ steps.build.outputs.digest }}"
5356
touch "${digest_dir}/${digest#sha256:}"
@@ -56,6 +59,6 @@ runs:
5659
uses: actions/upload-artifact@v3
5760
with:
5861
name: "${{ inputs.target }}-digests"
59-
path: "${{ runner.temp }}/${{ inputs.target }}-digests/*"
62+
path: "${{ runner.temp }}/${{ inputs.target }}-${{ github.run_number }}-digests/*"
6063
if-no-files-found: error
6164
retention-days: 1

Diff for: .github/workflows/espresso-docker.yml

+13
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ jobs:
146146
username: ${{ github.repository_owner }}
147147
password: ${{ secrets.GITHUB_TOKEN }}
148148

149+
- name: Remove digests dir
150+
run: |
151+
rm -rf "${{ runner.temp }}/digests"
152+
149153
- name: Download digests
150154
uses: actions/download-artifact@v3
151155
with:
@@ -161,6 +165,15 @@ jobs:
161165
- name: Create manifest list and push
162166
working-directory: "${{ runner.temp }}/digests"
163167
run: |
168+
# Count the number of files in the directory
169+
file_count=$(find . -type f | wc -l)
170+
171+
if [ "$file_count" -ne 2 ]; then
172+
echo "Should have exactly 2 digests to combine, something went wrong"
173+
ls -lah
174+
exit 1
175+
fi
176+
164177
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
165178
$(printf '${{ matrix.image }}@sha256:%s ' *)
166179
- name: Inspect image

0 commit comments

Comments
 (0)