Skip to content

Commit d438876

Browse files
authored
add sigstore prober (#224)
Signed-off-by: Brian DeHamer <[email protected]>
1 parent 8f30a5c commit d438876

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: GitHub Sigstore Prober
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# run every 5 minutes, as often as Github Actions allows
7+
- cron: '*/5 * * * *'
8+
9+
jobs:
10+
prober:
11+
permissions:
12+
attestations: write
13+
id-token: write
14+
secrets: inherit
15+
uses: ./.github/workflows/prober.yml
16+
with:
17+
sigstore: github
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Public-Good Sigstore Prober
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# run every 5 minutes, as often as Github Actions allows
7+
- cron: '*/5 * * * *'
8+
9+
jobs:
10+
prober:
11+
permissions:
12+
attestations: write
13+
id-token: write
14+
secrets: inherit
15+
uses: ./.github/workflows/prober.yml
16+
with:
17+
sigstore: public-good

.github/workflows/prober.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Prober Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
sigstore:
7+
description: 'Which Sigstore instance to use for signing'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
probe:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
attestations: write
16+
id-token: write
17+
18+
steps:
19+
- name: Request OIDC Token
20+
run: |
21+
curl "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=nobody" \
22+
-H "Authorization: bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" \
23+
-H "Accept: application/json; api-version=2.0" \
24+
-H "Content-Type: application/json" \
25+
--silent | jq -r '.value' | jq -R 'split(".") | .[0],.[1] | @base64d | fromjson'
26+
27+
- name: Create artifact
28+
run: |
29+
date > artifact
30+
31+
- name: Attest build provenance
32+
uses: actions/attest-build-provenance@v1
33+
env:
34+
INPUT_PRIVATE-SIGNING: ${{ inputs.sigstore == 'github' && 'true' || 'false' }}
35+
with:
36+
subject-path: artifact
37+
38+
- name: Verify build artifact
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
run: |
42+
gh attestation verify ./artifact --owner "$GITHUB_REPOSITORY_OWNER"
43+
44+
- name: Upload build artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
path: "artifact"
48+
49+
- name: Report attestation prober success
50+
if: ${{ success() }}
51+
uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
52+
with:
53+
api-key: "${{ secrets.DATADOG_API_KEY }}"
54+
service-checks: |
55+
- check: "attestation-integration.actions.prober"
56+
status: 0
57+
host_name: github.com
58+
tags:
59+
- "catalog_service:${{ secrets.CATALOG_SERVICE }}"
60+
- "service:${{ secrets.CATALOG_SERVICE }}"
61+
- "deployed_to:production"
62+
- "env:production"
63+
- "repo:${{ github.repository }}"
64+
- "team:${{ secrets.TEAM }}"
65+
- "sigstore:${{ inputs.sigstore }}"
66+
67+
- name: Report attestation prober failure
68+
if: ${{ failure() }}
69+
uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
70+
with:
71+
api-key: "${{ secrets.DATADOG_API_KEY }}"
72+
service-checks: |
73+
- check: "attestation-integration.actions.prober"
74+
message: "${{ github.repository_owner }} failed prober check"
75+
status: 2
76+
host_name: github.com
77+
tags:
78+
- "catalog_service:${{ secrets.CATALOG_SERVICE }}"
79+
- "service:${{ secrets.CATALOG_SERVICE }}"
80+
- "deployed_to:production"
81+
- "env:production"
82+
- "repo:${{ github.repository }}"
83+
- "team:${{ secrets.TEAM }}"
84+
- "sigstore:${{ inputs.sigstore }}"

0 commit comments

Comments
 (0)