Skip to content

Commit 76ccae6

Browse files
test: add pre-submit generic e2e against slsa-verifier@main
Signed-off-by: Ramon Petgrave <[email protected]>
1 parent 163e786 commit 76ccae6

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Copyright 2023 SLSA Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: pre-submit e2e generic main
16+
17+
on:
18+
pull_request:
19+
branches: [main]
20+
merge_group:
21+
workflow_dispatch:
22+
23+
permissions: read-all
24+
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
BUILD_ARTIFACT: build-artifact
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
hashes: ${{ steps.hash.outputs.hashes }}
34+
steps:
35+
- run: echo "gundam" > build-artifact
36+
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
37+
with:
38+
name: ${{ env.BUILD_ARTIFACT }}
39+
path: ./${{ env.BUILD_ARTIFACT }}
40+
if-no-files-found: error
41+
- name: Generate hashes
42+
shell: bash
43+
id: hash
44+
env:
45+
FILE: ${{ env.BUILD_ARTIFACT }}
46+
run: |
47+
echo "hashes=$(sha256sum $FILE | base64 -w0)" >> "$GITHUB_OUTPUT"
48+
49+
attest:
50+
needs: [build]
51+
permissions:
52+
id-token: write # For signing.
53+
contents: write # For asset uploads.
54+
actions: read # For reading workflow info.
55+
uses: ./.github/workflows/generator_generic_slsa3.yml
56+
with:
57+
base64-subjects: ${{ needs.build.outputs.hashes }}
58+
compile-generator: true
59+
provenance-name: build.intoto.jsonl
60+
61+
verify:
62+
needs: [build, attest]
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
66+
with:
67+
name: ${{ env.BUILD_ARTIFACT }}
68+
- run: go install github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier@main
69+
- env:
70+
SLSA_VERIFIER_TESTING: "true"
71+
ARTIFACT: ./${{ env.BUILD_ARTIFACT }}
72+
PROVENANCE: ./${{ needs.attest.outputs.provenance-name }}
73+
SOURCE: github.com/${{ env.GITHUB_REPOSITORY }}
74+
REF: ${{ env.GITHUB_REF }}
75+
run: slsa-verifier verify-artifact --provenance-path "$PROVENANCE" \
76+
--source-uri "$SOURCE" \
77+
--source-tag "$REF" \
78+
"$ARTIFACT"

0 commit comments

Comments
 (0)