ci: isolate digest artifacts on self-hosted runners
Build and publish used /tmp/digests, which persists on evoo-ci hosts. Uploading /tmp/digests/* picked up stale digest markers from earlier runs, so the manifest step saw 13 digests instead of one amd64 image. Use RUNNER_TEMP for recording, uploading, and assembling digests so each job only sees its own architecture marker. Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
parent
a35e431d1c
commit
3eb6adec9d
16
.github/workflows/publish-server-image.yml
vendored
16
.github/workflows/publish-server-image.yml
vendored
@ -161,16 +161,19 @@ jobs:
|
|||||||
provenance: mode=max
|
provenance: mode=max
|
||||||
sbom: true
|
sbom: true
|
||||||
- name: Record the architecture digest
|
- name: Record the architecture digest
|
||||||
|
id: digest
|
||||||
env:
|
env:
|
||||||
DIGEST: ${{ steps.build.outputs.digest }}
|
DIGEST: ${{ steps.build.outputs.digest }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
mkdir -p /tmp/digests
|
digest_dir="${RUNNER_TEMP}/digest"
|
||||||
touch "/tmp/digests/${DIGEST#sha256:}"
|
mkdir -p "$digest_dir"
|
||||||
|
touch "${digest_dir}/${DIGEST#sha256:}"
|
||||||
|
echo "dir=${digest_dir}" >> "$GITHUB_OUTPUT"
|
||||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||||
with:
|
with:
|
||||||
name: digest-${{ matrix.name }}-${{ matrix.arch }}
|
name: digest-${{ matrix.name }}-${{ matrix.arch }}
|
||||||
path: /tmp/digests/*
|
path: ${{ steps.digest.outputs.dir }}/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
@ -193,10 +196,13 @@ jobs:
|
|||||||
- name: updater
|
- name: updater
|
||||||
- name: computer
|
- name: computer
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare an isolated digest directory
|
||||||
|
id: digest_dir
|
||||||
|
run: echo "path=${RUNNER_TEMP}/digests" >> "$GITHUB_OUTPUT"
|
||||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||||
with:
|
with:
|
||||||
pattern: digest-${{ matrix.name }}-*
|
pattern: digest-${{ matrix.name }}-*
|
||||||
path: /tmp/digests
|
path: ${{ steps.digest_dir.outputs.path }}
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||||
- name: Log in to GHCR
|
- name: Log in to GHCR
|
||||||
@ -223,7 +229,7 @@ jobs:
|
|||||||
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
|
||||||
- name: Assemble and verify the manifest
|
- name: Assemble and verify the manifest
|
||||||
id: manifest
|
id: manifest
|
||||||
working-directory: /tmp/digests
|
working-directory: ${{ steps.digest_dir.outputs.path }}
|
||||||
env:
|
env:
|
||||||
IMAGE: ghcr.io/${{ steps.ns.outputs.repo }}/${{ matrix.name }}
|
IMAGE: ghcr.io/${{ steps.ns.outputs.repo }}/${{ matrix.name }}
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
TAGS: ${{ steps.meta.outputs.tags }}
|
||||||
|
|||||||
@ -43,6 +43,11 @@ describe("server image publish workflow", () => {
|
|||||||
expect(workflowText).toContain("actions/attest-build-provenance@");
|
expect(workflowText).toContain("actions/attest-build-provenance@");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("stores digest markers under RUNNER_TEMP so self-hosted runners do not leak stale files", () => {
|
||||||
|
expect(workflowText).not.toContain("/tmp/digests");
|
||||||
|
expect(workflowText).toContain("RUNNER_TEMP");
|
||||||
|
});
|
||||||
|
|
||||||
it("names every image under the lowercase repository namespace", () => {
|
it("names every image under the lowercase repository namespace", () => {
|
||||||
expect(workflowText).not.toContain("ghcr.io/${{ github.repository }}");
|
expect(workflowText).not.toContain("ghcr.io/${{ github.repository }}");
|
||||||
const references =
|
const references =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user