Skip to content

Commit c2c8a1f

Browse files
committed
Switch to cosign initialize
Signed-off-by: Aaron Lew <[email protected]>
1 parent b4d7f55 commit c2c8a1f

File tree

3 files changed

+25
-36
lines changed

3 files changed

+25
-36
lines changed

.github/workflows/prober-prod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ jobs:
3333
PAGERDUTY_INTEGRATION_KEY: ${{ secrets.PAGERDUTY_INTEGRATION_KEY }}
3434
with:
3535
triggerPagerDutyTest: ${{ github.event.inputs.triggerPagerDutyTest }}
36+
tuf_repo: "https://tuf-repo-cdn.sigstore.dev"
3637
rekor_v2_url: ${{ github.event.inputs.rekor_v2_url }}
3738
rekor_v2_public_key: ${{ github.event.inputs.rekor_v2_public_key }}

.github/workflows/prober-staging.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
with:
3535
enable_staging: true
3636
tuf_repo: "https://tuf-repo-cdn.sigstage.dev"
37-
tuf_preprod_repo: "https://sigstore.github.io/root-signing-staging"
3837
tuf_root_path: ".github/assets/sigstage.root.json"
3938
triggerPagerDutyTest: ${{ github.event.inputs.triggerPagerDutyTest }}
4039
rekor_v2_url: ${{ github.event.inputs.rekor_v2_url }}

.github/workflows/reusable-prober.yml

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,11 @@ on:
2121
tuf_repo:
2222
required: false
2323
type: string
24-
default: 'https://tuf-repo-cdn.sigstore.dev'
2524
description: 'TUF Repo'
26-
tuf_preprod_repo:
27-
required: false
28-
type: string
29-
default: 'https://sigstore.github.io/root-signing'
30-
description: 'Preprod TUF Repo'
3125
tuf_root_path:
3226
required: false
3327
type: string
34-
default: ".github/assets/sigstore.root.json"
28+
default: '.github/assets/sigstore.root.json'
3529
description: "path to the tuf root"
3630
triggerPagerDutyTest:
3731
description: 'Trigger PagerDuty test message'
@@ -107,18 +101,7 @@ jobs:
107101
metadata_url: ${{ inputs.tuf_repo }}
108102
valid_days: 2
109103
offline_valid_days: 15
110-
metadata_dir: tuf/prod/
111-
compare_source: false
112-
113-
- name: Verify preprod TUF repository state (and the upgrade from prod)
114-
if: ${{ inputs.enable_staging == false }}
115-
uses: theupdateframework/tuf-on-ci/actions/test-repository@0ef66318d40656f421781f28df93de9c69ccb9ba # v0.18.0
116-
with:
117-
metadata_url: ${{ inputs.tuf_preprod_repo }}
118-
update_base_url: ${{ inputs.tuf_repo }}
119-
valid_days: 2
120-
offline_valid_days: 15
121-
metadata_dir: tuf/preprod/
104+
metadata_dir: tuf/
122105
compare_source: false
123106

124107
- name: Set messages
@@ -186,7 +169,9 @@ jobs:
186169
docker cp binaries:/usr/local/bin/crane /usr/local/bin/
187170
188171
- name: Install cosign
189-
uses: sigstore/[email protected]
172+
uses: sigstore/[email protected]
173+
with:
174+
cosign-release: main
190175

191176
# Setup the registry on port 1338
192177
- run: |
@@ -199,25 +184,29 @@ jobs:
199184
docker tag ghcr.io/linuxcontainers/alpine ${IMAGE}
200185
docker push ${IMAGE}
201186
202-
- name: Install tufie
187+
- name: Initialize TUF root
203188
run: |
204-
bash <(curl -s https://raw.githubusercontent.com/kairoaraujo/tufie/main/install.sh)
205-
206-
- name: Set initial root.json
207-
run: cp "${{ inputs.tuf_root_path }}" ./root.json
189+
for i in {1..5}
190+
do
191+
if cosign initialize --mirror=${{ inputs.tuf_repo }} --root=${{ inputs.tuf_root_path }}; then
192+
echo "Successfully initialized" && exit 0
193+
else
194+
echo "Failed to initialize" && sleep 10
195+
fi
196+
done
197+
exit 1
208198
209-
- name: Add TUF repository to tufie
199+
- name: List cosign TUF root contents
210200
run: |
211-
tufie repository add \
212-
--name sigstore \
213-
--metadata-url ${{ inputs.tuf_repo }} \
214-
--artifact-url ${{ inputs.tuf_repo }}/targets \
215-
--root ./root.json
201+
TUF_TARGETS_DIR=~/.sigstore/root/$(echo ${{ inputs.tuf_repo }} | sed -e 's#^https://##' -e 's#/$##')/targets
202+
echo "These are the contents of the cosign TUF root: "
203+
ls $TUF_TARGETS_DIR
216204
217-
- name: Download TUF signing config and trusted root
205+
- name: Prepare signing config and trusted root
218206
run: |
219-
tufie download signing_config.v0.2.json --artifact-hash
220-
tufie download trusted_root.json --artifact-hash
207+
TUF_TARGETS_DIR=~/.sigstore/root/$(echo ${{ inputs.tuf_repo }} | sed -e 's#^https://##' -e 's#/$##')/targets
208+
cp ${TUF_TARGETS_DIR}/signing_config.v0.2.json ./signing_config.v0.2.json
209+
cp ${TUF_TARGETS_DIR}/trusted_root.json ./trusted_root.json
221210
222211
- name: Configure signing config for Rekor v1
223212
if: matrix.version == 'v1'
@@ -263,7 +252,7 @@ jobs:
263252
cosign attest --predicate ./prober/attestation.json --type slsaprovenance --signing-config signing_config.v0.2.json --trusted-root trusted_root.json ${IMAGE} --new-bundle-format
264253
cosign verify-attestation --type=slsaprovenance ${IMAGE} --trusted-root trusted_root.json --certificate-oidc-issuer=https://token.actions.githubusercontent.com --certificate-identity-regexp="$IDENTITY_REGEX" --new-bundle-format ${{ env.TIMESTAMP_VERIFY_FLAG }}
265254
266-
- name: Read entries from all Rekor shards
255+
- name: Read entries from all Rekor v1 shards
267256
if: matrix.version == 'v1'
268257
run: |
269258
# Assume the signing config contains a single Rekor v1 URL

0 commit comments

Comments
 (0)