Skip to content

Commit 6e1bb33

Browse files
authored
feat(ci): Declarative Chainloop contracts (#731)
Signed-off-by: Javier Rodriguez <[email protected]>
1 parent 8d85e75 commit 6e1bb33

File tree

9 files changed

+112
-37
lines changed

9 files changed

+112
-37
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
schemaVersion: v1
2+
runner:
3+
type: GITHUB_ACTION
4+
materials:
5+
- type: ARTIFACT
6+
name: cli-linux-amd64
7+
output: true
8+
- type: ARTIFACT
9+
name: control-plane-linux-amd64
10+
output: true
11+
- type: ARTIFACT
12+
name: artifact-cas-linux-amd64
13+
output: true
14+
- type: ARTIFACT
15+
name: chainloop-plugin-discord-webhook-linux-amd64
16+
output: false
17+
- type: CONTAINER_IMAGE
18+
name: control-plane-image
19+
output: true
20+
- type: CONTAINER_IMAGE
21+
name: artifact-cas-image
22+
output: true
23+
- type: SBOM_CYCLONEDX_JSON
24+
name: sbom-control-plane
25+
output: false
26+
annotations:
27+
- name: component
28+
value: control-plane
29+
- type: SBOM_CYCLONEDX_JSON
30+
name: sbom-artifact-cas
31+
output: false
32+
annotations:
33+
- name: component
34+
value: cas

.github/workflows/contracts/build-and-test.cue

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
schemaVersion: v1
2+
runner:
3+
type: GITHUB_ACTION
4+
materials:
5+
- type: HELM_CHART
6+
name: helm-chart
7+
output: true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
schemaVersion: v1
2+
runner:
3+
type: GITHUB_ACTION
4+
materials:
5+
- type: HELM_CHART
6+
name: helm-chart
7+
output: true
8+
- type: CONTAINER_IMAGE
9+
name: control-plane-image
10+
output: true
11+
- type: CONTAINER_IMAGE
12+
name: artifact-cas-image
13+
output: true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
schemaVersion: v1
2+
runner:
3+
type: GITHUB_ACTION
4+
materials:
5+
- type: SARIF
6+
name: sarif-results
7+
output: true
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Chainloop workflow associated with .github/workflows/deploy.yml
2-
# https://docs.chainloop.dev/reference/operator/contract
31
schemaVersion: v1
2+
runner:
3+
type: GITHUB_ACTION
44
materials:
55
- type: ARTIFACT
66
name: built-site
7+
optional: false
78
output: true
89
- type: SBOM_CYCLONEDX_JSON
910
name: sbom-cdx
11+
output: false
1012
- type: SBOM_SPDX_JSON
1113
name: sbom-spdx
12-
runner:
13-
type: GITHUB_ACTION
14+
output: false

.github/workflows/contracts/releases.cue

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
schemaVersion: v1
2+
runner:
3+
type: GITHUB_ACTION
4+
materials:
5+
- type: SARIF
6+
name: sarif-results
7+
output: true
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Sync Chainloop Workflow contracts
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
schedule:
10+
- cron: "0 0 * * *" # daily at midnight
11+
12+
# Declare default permissions as read only.
13+
permissions: read-all
14+
15+
jobs:
16+
diff:
17+
name: Sync Chainloop Workflow contracts
18+
runs-on: ubuntu-latest
19+
env:
20+
CHAINLOOP_VERSION: 0.84.0
21+
CHAINLOOP_API_TOKEN: ${{ secrets.CHAINLOOP_ROBOT_ACCOUNT_SYNC_CONTRACTS }}
22+
steps:
23+
- name: Install Chainloop
24+
run: |
25+
curl -sfL https://raw.githubusercontent.com/chainloop-dev/chainloop/01ad13af08950b7bfbc83569bea207aeb4e1a285/docs/static/install.sh | bash -s -- --version v${{ env.CHAINLOOP_VERSION }}
26+
27+
- uses: actions/[email protected]
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Update contracts .github/workflows/contracts on Chainloop
32+
run: |
33+
for file in $(ls .github/workflows/contracts); do
34+
if [[ $file = *.yml || $file = *.yaml ]]; then
35+
contract_name=$(basename $file | cut -d'.' -f1)
36+
echo "Updating contract $contract_name with .github/workflows/contracts/$file"
37+
chainloop wf contract update --name $contract_name --contract .github/workflows/contracts/$file
38+
fi
39+
done

0 commit comments

Comments
 (0)