Skip to content

Save digest artifacts into own directory per run #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/actions/docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ runs:
cache-to: type=gha,mode=max
outputs: type=image,name=${{ inputs.images }},push-by-digest=true,name-canonical=true,push=true

# This will upload the digest for each architecture to the same artifact,
# Note: upload-artifact@v4 will no longer support this.
# https://github.com/actions/upload-artifact?tab=readme-ov-file#not-uploading-to-the-same-artifact
- name: Export digest
shell: bash
run: |
digest_dir="${{ runner.temp }}/${{ inputs.target }}-digests"
digest_dir="${{ runner.temp }}/${{ inputs.target }}-${{ github.run_number }}-digests"
mkdir -p "${digest_dir}"
digest="${{ steps.build.outputs.digest }}"
touch "${digest_dir}/${digest#sha256:}"
Expand All @@ -56,6 +59,6 @@ runs:
uses: actions/upload-artifact@v3
with:
name: "${{ inputs.target }}-digests"
path: "${{ runner.temp }}/${{ inputs.target }}-digests/*"
path: "${{ runner.temp }}/${{ inputs.target }}-${{ github.run_number }}-digests/*"
if-no-files-found: error
retention-days: 1
13 changes: 13 additions & 0 deletions .github/workflows/espresso-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Remove digests dir
run: |
rm -rf "${{ runner.temp }}/digests"

- name: Download digests
uses: actions/download-artifact@v3
with:
Expand All @@ -161,6 +165,15 @@ jobs:
- name: Create manifest list and push
working-directory: "${{ runner.temp }}/digests"
run: |
# Count the number of files in the directory
file_count=$(find . -type f | wc -l)

if [ "$file_count" -ne 2 ]; then
echo "Should have exactly 2 digests to combine, something went wrong"
ls -lah
exit 1
fi

docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ matrix.image }}@sha256:%s ' *)
- name: Inspect image
Expand Down
Loading