Skip to content

Commit 9366997

Browse files
committed
ci: sign docker images with cosign and github oidc identity
1 parent e2a9b78 commit 9366997

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ jobs:
101101
- name: Set up Docker Buildx
102102
uses: docker/setup-buildx-action@v2
103103

104+
- name: Install Cosign
105+
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
106+
107+
- name: Get Cosign OIDC Token
108+
id: cosign-token
109+
run: |
110+
OIDC_TOKEN="$(
111+
curl -sSL -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN"
112+
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sigstore" | jq -r .value
113+
)"
114+
test -n "$OIDC_TOKEN"
115+
echo "::add-mask::$OIDC_TOKEN"
116+
echo "token=$OIDC_TOKEN" >> $GITHUB_OUTPUT
117+
104118
- name: Authenticate to AWS
105119
uses: aws-actions/configure-aws-credentials@v1-node16
106120
with:
@@ -134,6 +148,16 @@ jobs:
134148
push: true
135149
tags: ${{ steps.odyn-metadata.outputs.tags }}
136150

151+
- name: Sign Odyn Image
152+
run: |
153+
for tag in $tags
154+
do
155+
cosign sign --yes --identity-token "$COSIGN_OIDC_TOKEN" "$tag"
156+
done
157+
env:
158+
tags: ${{ steps.odyn-metadata.outputs.tags }}
159+
COSIGN_OIDC_TOKEN: ${{ steps.cosign-token.outputs.token }}
160+
137161
- name: Generate Runtime Base Image Metadata
138162
id: wrapper-base-metadata
139163
uses: docker/metadata-action@v4
@@ -155,6 +179,16 @@ jobs:
155179
push: true
156180
tags: ${{ steps.wrapper-base-metadata.outputs.tags }}
157181

182+
- name: Sign Runtime Base Image
183+
run: |
184+
for tag in $tags
185+
do
186+
cosign sign --yes --identity-token "$COSIGN_OIDC_TOKEN" "$tag"
187+
done
188+
env:
189+
tags: ${{ steps.wrapper-base-metadata.outputs.tags }}
190+
COSIGN_OIDC_TOKEN: ${{ steps.cosign-token.outputs.token }}
191+
158192
- name: Generate CLI Image Metadata
159193
id: cli-metadata
160194
uses: docker/metadata-action@v4
@@ -176,6 +210,16 @@ jobs:
176210
push: true
177211
tags: ${{ steps.cli-metadata.outputs.tags }}
178212

213+
- name: Sign CLI Image
214+
run: |
215+
for tag in $tags
216+
do
217+
cosign sign --yes --identity-token "$COSIGN_OIDC_TOKEN" "$tag"
218+
done
219+
env:
220+
tags: ${{ steps.cli-metadata.outputs.tags }}
221+
COSIGN_OIDC_TOKEN: ${{ steps.cosign-token.outputs.token }}
222+
179223
upload-release-artifact:
180224
if: github.repository == 'EternisAI/enclaver' && github.ref_type == 'tag'
181225
needs: build-release-binaries

0 commit comments

Comments
 (0)