-
Notifications
You must be signed in to change notification settings - Fork 81
207 lines (167 loc) · 6.75 KB
/
custom-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: root-signing repository tests with a Sigstore client
on:
workflow_call:
inputs:
metadata_url:
description: "URL of the sigstore TUF repository to test"
required: true
type: string
permissions:
id-token: 'write' # For signing with the GitHub workflow identity
env:
METADATA_URL: ${{ inputs.metadata_url }}
IDENTITY: ${{ github.server_url }}/${{ github.repository }}/.github/workflows/custom-test.yml@${{ github.ref }}
jobs:
sigstore-python:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: '3.11'
- name: Install sigstore-python, tweak it to use the published TUF repository
run: |
pip install sigstore
# tweak sigstore sources to use our publish URL
# TODO: remove this once sigstore-python supports "--tuf-url" or similar
SITE_PACKAGES=$(pip show sigstore | sed -n "s/^Location: //p")
TUF_PY="$SITE_PACKAGES/sigstore/_internal/tuf.py"
sed -ie "s#^DEFAULT_TUF_URL = .*#DEFAULT_TUF_URL = \"$METADATA_URL\"#" "$TUF_PY"
- name: Test published repository with sigstore-python
run: |
touch artifact
# sign, then verify using this workflows oidc identity
python -m sigstore -vv sign --bundle artifact.sigstore.json artifact
python -m sigstore verify github --cert-identity $IDENTITY --bundle artifact.sigstore.json artifact
- name: Upload the bundle for other clients to verify
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: bundle
path: artifact.sigstore.json
overwrite: true
cosign:
runs-on: ubuntu-latest
steps:
- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- name: Download initial root
run: curl -o root.json ${METADATA_URL}/5.root.json
- name: Test published repository with cosign
run: |
touch artifact
# initialize from the published repository
cosign initialize --root root.json --mirror ${METADATA_URL}
# sign, then verify using this workflows oidc identity
cosign sign-blob \
--yes \
--bundle bundle.json \
artifact
cosign verify-blob \
--certificate-identity $IDENTITY \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--bundle bundle.json \
artifact
cosign-old-version:
runs-on: ubuntu-latest
steps:
- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
with:
cosign-release: "v2.2.0"
- name: Download initial root
run: curl -o root.json ${METADATA_URL}/5.root.json
- name: Test published repository with cosign 2.2
run: |
touch artifact
# initialize from the published repository
cosign initialize --root root.json --mirror ${METADATA_URL}
# sign, then verify using this workflows oidc identity
cosign sign-blob \
--yes \
--bundle bundle.json \
artifact
cosign verify-blob \
--certificate-identity $IDENTITY \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--bundle bundle.json \
artifact
sigstore-go:
runs-on: ubuntu-latest
needs: [sigstore-python]
steps:
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: '1.22'
check-latest: true
- name: Install sigstore-go
run: go install github.com/sigstore/sigstore-go/cmd/sigstore-go@latest
- name: Download initial root
run: curl -o root.json ${METADATA_URL}/5.root.json
- name: Download bundle to verify
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: bundle
- name: Test published repository with sigstore-go
run: |
touch artifact
~/go/bin/sigstore-go \
-tufRootURL $METADATA_URL \
-tufTrustedRoot root.json \
-expectedSAN $IDENTITY \
-expectedIssuer https://token.actions.githubusercontent.com \
-artifact artifact \
artifact.sigstore.json
sigstore-js:
runs-on: ubuntu-latest
needs: [sigstore-python]
steps:
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
- name: Install sigstore-js
run: npm install -g @sigstore/cli
- name: Download initial root
run: curl -o root.json ${METADATA_URL}/1.root.json
- name: Download bundle to verify
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: bundle
- name: Test published repository with sigstore-js
run: |
touch artifact
sigstore verify \
--tuf-mirror-url $METADATA_URL \
--tuf-root-path root.json \
--certificate-identity-uri $IDENTITY \
--certificate-issuer https://token.actions.githubusercontent.com \
--blob-file=artifact \
artifact.sigstore.json
sigstore-java:
runs-on: ubuntu-latest
needs: [sigstore-python]
steps:
- name: Set up JDK
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
java-version: 17
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
repository: "sigstore/sigstore-java"
fetch-tags: true
fetch-depth: 0
- name: Build cli from latest release tag, unpack distribution
run: |
git checkout $(git describe --tags --match="v[0-9]*" --abbrev=0 HEAD)
./gradlew :sigstore-cli:build
tar -xvf sigstore-cli/build/distributions/sigstore-cli-*.tar --strip-components 1
- name: Download bundle to verify
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: bundle
- name: Test published repository with sigstore-java
run: |
touch artifact
bin/sigstore-cli verify-bundle \
--public-good-with-tuf-url-override $METADATA_URL \
--bundle artifact.sigstore.json \
--certificate-identity $IDENTITY \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
artifact