|
18 | 18 | permissions: read-all |
19 | 19 |
|
20 | 20 | jobs: |
21 | | - chainloop_init: |
22 | | - name: Chainloop Init |
23 | | - uses: chainloop-dev/labs/.github/workflows/chainloop_init.yml@64839eb68c20fefda46929c6c6e893cdf0537619 |
24 | | - secrets: |
25 | | - api_token: ${{ secrets.CHAINLOOP_TOKEN }} |
26 | | - with: |
27 | | - workflow_name: "chainloop-vault-scorecards" |
28 | | - project_name: "chainloop" |
29 | | - |
30 | 21 | analysis: |
31 | 22 | name: Scorecard analysis |
32 | 23 | runs-on: ubuntu-latest |
33 | | - needs: |
34 | | - - chainloop_init |
35 | 24 | permissions: |
36 | 25 | # Needed to upload the results to code-scanning dashboard. |
37 | 26 | security-events: write |
38 | 27 | # Needed to publish results and get a badge (see publish_results below). |
39 | 28 | id-token: write |
40 | 29 | contents: read |
41 | 30 | actions: read |
| 31 | + env: |
| 32 | + CHAINLOOP_WORKFLOW_NAME: "chainloop-vault-scorecards" |
| 33 | + CHAINLOOP_PROJECT: "chainloop" |
| 34 | + CHAINLOOP_TOKEN: ${{ secrets.CHAINLOOP_TOKEN }} |
42 | 35 |
|
43 | 36 | steps: |
| 37 | + - name: Install Chainloop |
| 38 | + run: | |
| 39 | + curl -sfL https://raw.githubusercontent.com/chainloop-dev/chainloop/01ad13af08950b7bfbc83569bea207aeb4e1a285/docs/static/install.sh | bash -s |
| 40 | +
|
44 | 41 | - name: "Checkout code" |
45 | 42 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
46 | 43 | with: |
47 | 44 | persist-credentials: false |
48 | 45 |
|
| 46 | + - name: Initialize Attestation |
| 47 | + run: | |
| 48 | + chainloop attestation init --workflow $CHAINLOOP_WORKFLOW_NAME --project $CHAINLOOP_PROJECT |
| 49 | +
|
49 | 50 | - name: "Run analysis" |
50 | 51 | uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 |
51 | 52 | with: |
@@ -83,13 +84,21 @@ jobs: |
83 | 84 | with: |
84 | 85 | sarif_file: results.sarif |
85 | 86 |
|
86 | | - chainloop_push: |
87 | | - name: Chainloop Push |
88 | | - uses: chainloop-dev/labs/.github/workflows/chainloop_push.yml@25c77318e739c60e86d3dfe7e864f51c665972dd |
89 | | - needs: |
90 | | - - analysis |
91 | | - secrets: |
92 | | - api_token: ${{ secrets.CHAINLOOP_TOKEN }} |
93 | | - with: |
94 | | - attestation_name: "scorecards" |
95 | | - workflow_name: "chainloop-vault-scorecards" |
| 87 | + - name: Attest analysis |
| 88 | + run: | |
| 89 | + chainloop attestation add --name sarif-results --value results.sarif |
| 90 | +
|
| 91 | + - name: Finish and Record Attestation |
| 92 | + if: ${{ success() }} |
| 93 | + run: | |
| 94 | + chainloop attestation push |
| 95 | +
|
| 96 | + - name: Mark attestation as failed |
| 97 | + if: ${{ failure() }} |
| 98 | + run: | |
| 99 | + chainloop attestation reset |
| 100 | +
|
| 101 | + - name: Mark attestation as cancelled |
| 102 | + if: ${{ cancelled() }} |
| 103 | + run: | |
| 104 | + chainloop attestation reset --trigger cancellation |
0 commit comments