Skip to content

Commit c4eecf5

Browse files
committed
feat(ci): add image expiry labels for non-main branch builds
Add logic to set quay.expires-after=60d label on images built from feature branches, while keeping main branch and tag builds permanent. Also disable provenance attestation in build process because they break MTR.
1 parent 7f6d142 commit c4eecf5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ jobs:
6464
fi
6565
echo "Image tag will be: ${TAG}"
6666
echo "image-tag=${TAG}" >> "${GITHUB_OUTPUT}"
67+
- name: Determine image labels
68+
# Apply Quay expiry only to branch builds that are not main; tags stay permanent.
69+
id: image-labels
70+
run: |
71+
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
72+
echo "labels=" >> "${GITHUB_OUTPUT}"
73+
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
74+
echo "labels=" >> "${GITHUB_OUTPUT}"
75+
else
76+
echo "labels=quay.expires-after=60d" >> "${GITHUB_OUTPUT}"
77+
fi
6778
- name: Login to registry
6879
uses: docker/login-action@v3
6980
with:
@@ -83,6 +94,8 @@ jobs:
8394
tags: ${{ vars.REGISTRY_HOST }}${{ vars.REGISTRY_REPO }}:${{ steps.tag.outputs.image-tag }}
8495
cache-from: type=registry,ref=${{ vars.REGISTRY_HOST }}${{ vars.REGISTRY_REPO }}:latest
8596
cache-to: type=inline
97+
provenance: false
98+
labels: ${{ steps.image-labels.outputs.labels }}
8699
push: true
87100
platforms: linux/amd64,linux/arm64
88101

0 commit comments

Comments
 (0)