Skip to content

Commit b1b861d

Browse files
34fathombelowschakrad
authored andcommitted
fix: sign container images by digest (argoproj#11151)
* chore: sign container images by digest Signed-off-by: Justin Marquis <34fathombelow@protonmail.com> * use sha hash Signed-off-by: Justin Marquis <34fathombelow@protonmail.com> Signed-off-by: Justin Marquis <34fathombelow@protonmail.com> Signed-off-by: schakrad <chakradari.sindhu@gmail.com>
1 parent 704db21 commit b1b861d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/image.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ jobs:
7171
- name: Install cosign
7272
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b # v2.8.1
7373
with:
74-
cosign-release: 'v1.13.0'
74+
cosign-release: 'v1.13.1'
75+
76+
- name: Install crane to get digest of image
77+
uses: imjasonh/setup-crane@e82f1b9a8007d399333baba4d75915558e9fb6a4
7578

7679
- name: Sign Argo CD latest image
7780
run: |
78-
cosign sign --key env://COSIGN_PRIVATE_KEY quay.io/argoproj/argocd:latest
81+
echo "IMAGE_DIGEST=$(crane digest quay.io/argoproj/argocd:latest)" >> $GITHUB_ENV
82+
cosign sign --key env://COSIGN_PRIVATE_KEY quay.io/argoproj/argocd@${{ env.IMAGE_DIGEST }}
7983
# Displays the public key to share.
8084
cosign public-key --key env://COSIGN_PRIVATE_KEY
8185
env:

.github/workflows/release.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,15 @@ jobs:
217217
- name: Install cosign
218218
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b # v2.8.1
219219
with:
220-
cosign-release: 'v1.13.0'
220+
cosign-release: 'v1.13.1'
221+
222+
- name: Install crane to get digest of image
223+
uses: imjasonh/setup-crane@e82f1b9a8007d399333baba4d75915558e9fb6a4
221224

222225
- name: Sign Argo CD container images and assets
223226
run: |
224-
cosign sign --key env://COSIGN_PRIVATE_KEY ${IMAGE_NAMESPACE}/argocd:v${TARGET_VERSION}
227+
echo "IMAGE_DIGEST=$(crane digest quay.io/argoproj/argocd:v${TARGET_VERSION})" >> $GITHUB_ENV
228+
cosign sign --key env://COSIGN_PRIVATE_KEY ${IMAGE_NAMESPACE}/argocd@${{ env.IMAGE_DIGEST }}
225229
cosign sign-blob --key env://COSIGN_PRIVATE_KEY ./dist/argocd-${TARGET_VERSION}-checksums.txt > ./dist/argocd-${TARGET_VERSION}-checksums.sig
226230
# Retrieves the public key to release as an asset
227231
cosign public-key --key env://COSIGN_PRIVATE_KEY > ./dist/argocd-cosign.pub

0 commit comments

Comments
 (0)