Skip to content

Commit 999694a

Browse files
committed
feat(ISV-5783): use new workflow in SBOM update
The update-component-sbom uses new SBOM workflow, where SBOMs are generated from the mapped snapshot spec. Signed-off-by: Martin Jediny <jedinym@proton.me>
1 parent 7340148 commit 999694a

File tree

4 files changed

+36
-86
lines changed

4 files changed

+36
-86
lines changed

tasks/managed/update-component-sbom/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ Tekton task to update component-level SBOMs with purls containing release-time i
1818
| taskGitUrl | The url to the git repo where the release-service-catalog tasks and stepactions to be used are stored | No | "" |
1919
| taskGitRevision | The revision in the taskGitUrl repo to be used | No | "" |
2020

21+
## Changes in 2.0.0
22+
* Refactored task to use the new SBOM generation workflow. SBOMs are now
23+
generated from mapped snapshot specs.
24+
* Removed `sbomJsonPath`, `downloadedSbomPath` params. This task is no longer
25+
dependent on sbom data from `populate-release-notes-images` and build-time
26+
SBOMs from `push-rpm-data-to-pyxis`.
27+
2128
## Changes in 1.0.0
2229
* This task now supports Trusted artifacts
2330

tasks/managed/update-component-sbom/tests/mocks.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ function update_component_sbom() {
55
echo Mock update_component_sbom called with: "$*"
66
echo "$*" >> "$(params.dataDir)/mock_update.txt"
77

8-
if [[ "$*" != "--data-path $(params.dataDir)/$(params.subdirectory)/data.json --input-path $(params.dataDir)/$(params.subdirectory)/downloaded-sboms --output-path $(params.dataDir)/$(params.subdirectory)/downloaded-sboms" ]]
9-
then
10-
echo Error: Unexpected call
8+
if [[ "$1" != "--snapshot-path" ]] ||
9+
[[ "$2" != "$(params.dataDir)/$(params.subdirectory)/snapshot_spec.json" ]] ||
10+
[[ "$3" != "--output-path" ]] ||
11+
[[ "$4" != "$(params.dataDir)/$(params.subdirectory)/sboms" ]]; then
12+
echo "Error: Unexpected call"
1113
exit 1
1214
fi
1315
}

tasks/managed/update-component-sbom/tests/test-update-component-sbom-basic.yaml

Lines changed: 5 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -60,69 +60,6 @@ spec:
6060
- name: "DEBUG"
6161
value: "$(params.trustedArtifactsDebug)"
6262
steps:
63-
- name: setup-values
64-
image: quay.io/konflux-ci/release-service-utils:d320c36f3d707cd5bfe55fe783f70236c06cc2e5
65-
script: |
66-
#!/usr/bin/env sh
67-
set -eux
68-
69-
mkdir -p "$(params.dataDir)/$(context.pipelineRun.uid)"
70-
cat > "$(params.dataDir)/$(context.pipelineRun.uid)/test_data.json" << EOF
71-
{
72-
"mapping": {
73-
"components": [
74-
{
75-
"name": "comp1",
76-
"repository": "repo1"
77-
},
78-
{
79-
"name": "comp2",
80-
"repository": "repo2"
81-
},
82-
{
83-
"name": "comp3",
84-
"repository": "repo3a"
85-
},
86-
{
87-
"name": "comp4",
88-
"customfield": "custom"
89-
}
90-
]
91-
}
92-
}
93-
EOF
94-
95-
cat > "$(params.dataDir)/$(context.pipelineRun.uid)/test_snapshot_spec.json" << EOF
96-
{
97-
"application": "myapp",
98-
"components": [
99-
{
100-
"name": "comp1",
101-
"containerImage": "imageurl1@sha256:123456",
102-
"source": {
103-
"git": {
104-
"revision": "myrev",
105-
"url": "myurl"
106-
}
107-
}
108-
},
109-
{
110-
"name": "comp3",
111-
"containerImage": "imageurl3@sha256:123456",
112-
"repository": "repo3"
113-
},
114-
{
115-
"name": "comp4",
116-
"containerImage": "imageurl4@sha256:123456",
117-
"repository": "repo4"
118-
},
119-
{
120-
"name": "comp5",
121-
"containerImage": "imageurl5@sha256:123456"
122-
}
123-
]
124-
}
125-
EOF
12663
- name: skip-trusted-artifact-operations
12764
ref:
12865
name: skip-trusted-artifact-operations
@@ -156,10 +93,10 @@ spec:
15693
taskRef:
15794
name: update-component-sbom
15895
params:
159-
- name: sbomJsonPath
160-
value: "$(context.pipelineRun.uid)/data.json"
161-
- name: downloadedSbomPath
162-
value: "$(context.pipelineRun.uid)/downloaded-sboms"
96+
- name: snapshotSpec
97+
value: "$(context.pipelineRun.uid)/snapshot_spec.json"
98+
- name: sbomPath
99+
value: "$(context.pipelineRun.uid)/sboms"
163100
- name: ociStorage
164101
value: $(params.ociStorage)
165102
- name: orasOptions
@@ -225,7 +162,7 @@ spec:
225162
- name: sourceDataArtifact
226163
value: $(params.sourceDataArtifact)
227164
- name: check-result
228-
image: quay.io/konflux-ci/release-service-utils:4a67d0c959e63cbb4bc0d37db1ce962091d6072a
165+
image: quay.io/konflux-ci/release-service-utils:20e010a0dde28e31826ce91914d5852d73437fc2
229166
script: |
230167
#!/usr/bin/env bash
231168
set -eux

tasks/managed/update-component-sbom/update-component-sbom.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,14 @@ kind: Task
44
metadata:
55
name: update-component-sbom
66
labels:
7-
app.kubernetes.io/version: "1.0.0"
7+
app.kubernetes.io/version: "2.0.0"
88
annotations:
99
tekton.dev/pipelines.minVersion: "0.12.1"
1010
tekton.dev/tags: release
1111
spec:
1212
description: >-
1313
Update component-level SBOM with purls with release-time info.
1414
params:
15-
- name: sbomJsonPath
16-
description: Relative path to the SBOM data file in the workspace.
17-
type: string
18-
- name: downloadedSbomPath
19-
description: |
20-
Path to the directory holding previously downloaded SBOMs to be updated.
21-
type: string
2215
- name: ociStorage
2316
description: The OCI repository where the Trusted Artifacts are stored.
2417
type: string
@@ -49,6 +42,13 @@ spec:
4942
description: The location where data will be stored
5043
type: string
5144
default: $(workspaces.data.path)
45+
- name: snapshotSpec
46+
type: string
47+
description: Path to the mapped snapshot spec.
48+
- name: sbomPath
49+
type: string
50+
description: Path to store the updated SBOMs to.
51+
default: "sboms"
5252
- name: taskGitUrl
5353
type: string
5454
description: The url to the git repo where the release-service-catalog tasks and stepactions to be used are stored
@@ -62,6 +62,9 @@ spec:
6262
- description: Produced trusted data artifact
6363
name: sourceDataArtifact
6464
type: string
65+
- name: sbomPath
66+
description: Path to the directory containing updated SBOMs.
67+
type: string
6568
volumes:
6669
- name: workdir
6770
emptyDir: {}
@@ -107,19 +110,20 @@ spec:
107110
value: $(params.dataDir)
108111
- name: sourceDataArtifact
109112
value: $(params.sourceDataArtifact)
110-
- name: update-component-sbom-purls
111-
image: quay.io/konflux-ci/release-service-utils:4a67d0c959e63cbb4bc0d37db1ce962091d6072a
113+
- name: update-sboms
114+
image: quay.io/konflux-ci/release-service-utils:20e010a0dde28e31826ce91914d5852d73437fc2
112115
script: |
113116
#!/usr/bin/env bash
114117
set -eux
115118
116-
INPUT_PATH="$(params.dataDir)/$(params.downloadedSbomPath)"
119+
sbom_path="$(params.dataDir)/$(params.sbomPath)"
120+
mkdir -p "$sbom_path"
117121
118-
#update the SBOM files in place
119122
update_component_sbom \
120-
--data-path "$(params.dataDir)/$(params.sbomJsonPath)" \
121-
--input-path "$INPUT_PATH" \
122-
--output-path "$INPUT_PATH"
123+
--snapshot-path "$(params.dataDir)/$(params.snapshotSpec)" \
124+
--output-path "$sbom_path"
125+
126+
echo -n "$sbom_path" > "$(results.sbomPath.path)"
123127
- name: create-trusted-artifact
124128
ref:
125129
resolver: "git"

0 commit comments

Comments
 (0)