Skip to content

Commit 9ff4415

Browse files
authored
fix(ci): Use chainloop action on scorecard pipeline (#715)
1 parent eb8d5c7 commit 9ff4415

File tree

2 files changed

+30
-44
lines changed

2 files changed

+30
-44
lines changed

.chainloop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ docs:
77
path: reports/sbom.spdx.json
88
- name: built-site
99
path: reports/build.tar.gz
10+
11+
scorecards:
12+
- name: sarif-results
13+
path: metadata/results.sarif

.github/workflows/scorecards.yml

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,19 @@ on:
1818
permissions: read-all
1919

2020
jobs:
21+
chainloop_init:
22+
name: Chainloop Init
23+
uses: chainloop-dev/labs/.github/workflows/chainloop_init.yml@54b18c97630a84a134c3fc93489d86c533d5a440
24+
secrets:
25+
api_token: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
26+
with:
27+
chainloop_labs_branch: 54b18c97630a84a134c3fc93489d86c533d5a440
28+
2129
analysis:
2230
name: Scorecard analysis
2331
runs-on: ubuntu-latest
32+
needs:
33+
- chainloop_init
2434
permissions:
2535
# Needed to upload the results to code-scanning dashboard.
2636
security-events: write
@@ -30,24 +40,11 @@ jobs:
3040
actions: read
3141

3242
steps:
33-
- name: Install Chainloop
34-
run: |
35-
curl -sfL https://raw.githubusercontent.com/chainloop-dev/chainloop/01ad13af08950b7bfbc83569bea207aeb4e1a285/docs/static/install.sh | bash -s -- --version v${{ env.CHAINLOOP_VERSION }}
36-
env:
37-
CHAINLOOP_VERSION: 0.83.0
38-
CHAINLOOP_ROBOT_ACCOUNT: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
39-
4043
- name: "Checkout code"
4144
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4245
with:
4346
persist-credentials: false
4447

45-
- name: Initialize Attestation
46-
run: |
47-
chainloop attestation init
48-
env:
49-
CHAINLOOP_ROBOT_ACCOUNT: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
50-
5148
- name: "Run analysis"
5249
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
5350
with:
@@ -68,18 +65,14 @@ jobs:
6865
# of the value entered here.
6966
publish_results: true
7067

71-
- name: Add Attestation (Sarif results)
72-
run: |
73-
chainloop attestation add --name sarif-results --value results.sarif
74-
env:
75-
CHAINLOOP_ROBOT_ACCOUNT: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
76-
7768
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
7869
# format to the repository Actions tab.
7970
- name: "Upload artifact"
80-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
71+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v3.1.3
8172
with:
82-
name: SARIF file
73+
# When downloading if not name is set the artifact name will be "artifact"
74+
# We need to specify the name to download it later
75+
name: metadata
8376
path: results.sarif
8477
retention-days: 5
8578

@@ -89,26 +82,15 @@ jobs:
8982
with:
9083
sarif_file: results.sarif
9184

92-
- name: Finish and Record Attestation
93-
if: ${{ success() }}
94-
run: |
95-
chainloop attestation status --full
96-
chainloop attestation push --key env://CHAINLOOP_SIGNING_KEY
97-
env:
98-
CHAINLOOP_SIGNING_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
99-
CHAINLOOP_SIGNING_KEY: ${{ secrets.COSIGN_KEY }}
100-
CHAINLOOP_ROBOT_ACCOUNT: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
101-
102-
- name: Mark attestation as failed
103-
if: ${{ failure() }}
104-
run: |
105-
chainloop attestation reset
106-
env:
107-
CHAINLOOP_ROBOT_ACCOUNT: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
108-
109-
- name: Mark attestation as cancelled
110-
if: ${{ cancelled() }}
111-
run: |
112-
chainloop attestation reset --trigger cancellation
113-
env:
114-
CHAINLOOP_ROBOT_ACCOUNT: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
85+
chainloop_push:
86+
name: Chainloop Push
87+
uses: chainloop-dev/labs/.github/workflows/chainloop_push.yml@54b18c97630a84a134c3fc93489d86c533d5a440
88+
needs:
89+
- analysis
90+
secrets:
91+
api_token: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SCORECARDS }}
92+
signing_key: ${{ secrets.COSIGN_KEY }}
93+
signing_key_password: ${{ secrets.COSIGN_PASSWORD }}
94+
with:
95+
attestation_name: "scorecards"
96+
chainloop_labs_branch: 54b18c97630a84a134c3fc93489d86c533d5a440

0 commit comments

Comments
 (0)