Skip to content

Commit 6baa9e3

Browse files
committed
Add JFrog RLM evidence workflow example
1 parent 60fe62f commit 6baa9e3

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: "JFrog RLM Evidence Collection Example"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
13+
env:
14+
JF_URL: ${{ vars.JF_URL }}
15+
JF_PROJECT: ${{ vars.JF_PROJECT }}
16+
BUILD_NAME: podinfo
17+
BUILD_NUMBER: ${{ github.run_number }}
18+
RC_REPO: libs-rc-local
19+
RELEASE_REPO: libs-release-local
20+
RELEASE_BUNDLE_NAME: podinfo-rlm
21+
22+
jobs:
23+
build_and_attest:
24+
name: Build + attest RC
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup JFrog CLI (OIDC)
31+
uses: jfrog/setup-jfrog-cli@v4
32+
env:
33+
JF_URL: ${{ env.JF_URL }}
34+
with:
35+
oidc-provider-name: ${{ vars.JF_OIDC_PROVIDER_NAME }}
36+
37+
- name: Build binary
38+
run: |
39+
make build
40+
41+
- name: Upload RC artifact to dedicated repo
42+
run: |
43+
jf rt upload "./dist/**" "${RC_REPO}/podinfo/${GITHUB_SHA}/" \
44+
--project="${JF_PROJECT}" \
45+
--build-name="${BUILD_NAME}" \
46+
--build-number="${BUILD_NUMBER}"
47+
48+
- name: Capture build info & git metadata
49+
run: |
50+
jf rt build-collect-env "${BUILD_NAME}" "${BUILD_NUMBER}"
51+
jf rt build-add-git "${BUILD_NAME}" "${BUILD_NUMBER}"
52+
53+
- name: Generate SBOM (example evidence)
54+
uses: anchore/sbom-action@v0
55+
with:
56+
path: .
57+
output-file: sbom.spdx.json
58+
59+
- name: Install cosign
60+
uses: sigstore/cosign-installer@v3
61+
62+
- name: Create signed attestation (keyless via OIDC)
63+
env:
64+
COSIGN_EXPERIMENTAL: "1"
65+
run: |
66+
cosign attest \
67+
--predicate sbom.spdx.json \
68+
--type spdx \
69+
--yes \
70+
"${RC_REPO}/podinfo/${GITHUB_SHA}/"
71+
72+
- name: Attach signed evidence to build
73+
run: |
74+
# Evidence Collection: attach SBOM + provenance to the build
75+
# Replace arguments with your preferred predicate/subject types.
76+
jf evc add \
77+
--build-name="${BUILD_NAME}" \
78+
--build-number="${BUILD_NUMBER}" \
79+
--predicate="sbom.spdx.json" \
80+
--predicate-type="spdx"
81+
82+
- name: Publish build info
83+
run: |
84+
jf rt build-publish "${BUILD_NAME}" "${BUILD_NUMBER}" \
85+
--project="${JF_PROJECT}"
86+
87+
- name: Create Release Bundle v2 (RC)
88+
run: |
89+
jf rbc create "${RELEASE_BUNDLE_NAME}" "${BUILD_NUMBER}" \
90+
--builds "${BUILD_NAME}/${BUILD_NUMBER}" \
91+
--project "${JF_PROJECT}"
92+
93+
verify_and_promote:
94+
name: Verify + promote to production
95+
runs-on: ubuntu-latest
96+
needs: build_and_attest
97+
environment: production
98+
steps:
99+
- name: Setup JFrog CLI (OIDC)
100+
uses: jfrog/setup-jfrog-cli@v4
101+
env:
102+
JF_URL: ${{ env.JF_URL }}
103+
with:
104+
oidc-provider-name: ${{ vars.JF_OIDC_PROVIDER_NAME }}
105+
106+
- name: Verify release integrity
107+
run: |
108+
# Verify the evidence chain before promoting to production.
109+
# This guards against tampering or accidental changes.
110+
jf evc verify \
111+
--release-bundle "${RELEASE_BUNDLE_NAME}" \
112+
--version "${BUILD_NUMBER}" \
113+
--project "${JF_PROJECT}"
114+
115+
- name: Promote Release Bundle to production repo
116+
run: |
117+
# Promote binaries to dedicated production repo after verification.
118+
jf rbd "${RELEASE_BUNDLE_NAME}" "${BUILD_NUMBER}" \
119+
--project "${JF_PROJECT}" \
120+
--repo "${RELEASE_REPO}"

0 commit comments

Comments
 (0)