Skip to content

Commit

Permalink
feat(ISV-5130): optionally enable SBOM processing
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Jediny <[email protected]>
  • Loading branch information
jedinym committed Nov 18, 2024
1 parent edb7fa5 commit 1f5a40a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 8 deletions.
8 changes: 8 additions & 0 deletions pipelines/rh-advisories/rh-advisories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ spec:
runAfter:
- collect-data
- name: create-product-sbom
when:
- input: "$(tasks.collect-atlas-params.results.secretName)"
operator: notin
values: [""]
params:
- name: dataJsonPath
value: "$(tasks.collect-data.results.data)"
Expand All @@ -561,6 +565,10 @@ spec:
runAfter:
- check-data-keys
- name: upload-product-sbom
when:
- input: "$(tasks.collect-atlas-params.results.secretName)"
operator: notin
values: [""]
params:
- name: sbomDir
value: "$(tasks.create-product-sbom.results.productSBOMPath)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ spec:
runAfter:
- collect-data
- name: create-product-sbom
when:
- input: "$(tasks.collect-atlas-params.results.secretName)"
operator: notin
values: [""]
params:
- name: dataJsonPath
value: "$(tasks.collect-data.results.data)"
Expand All @@ -276,6 +280,10 @@ spec:
runAfter:
- check-data-keys
- name: upload-product-sbom
when:
- input: "$(tasks.collect-atlas-params.results.secretName)"
operator: notin
values: [""]
params:
- name: sbomDir
value: "$(tasks.create-product-sbom.results.productSBOMPath)"
Expand Down
12 changes: 6 additions & 6 deletions tasks/collect-atlas-params/collect-atlas-params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ spec:
atlasServer=$(jq -r '.atlas.server' "$DATA_FILE")
if [ "$atlasServer" = "null" ]; then
echo "ERROR: The JSON file does not contain the 'atlasServer' field."
exit 1
fi
if [ "$atlasServer" = "stage" ]; then
# In this case, SBOM processing will be skipped.
bombasticApiUrl=""
ssoTokenUrl=""
secretName=""
elif [ "$atlasServer" = "stage" ]; then
bombasticApiUrl="https://sbom.atlas.release.stage.devshift.net"
ssoTokenUrl="https://auth.stage.redhat.com/auth/realms/EmployeeIDP/protocol/openid-connect/token"
secretName="atlas-staging-sso-secret"
Expand All @@ -65,7 +65,7 @@ spec:
ssoTokenUrl="https://auth.redhat.com/auth/realms/EmployeeIDP/protocol/openid-connect/token"
secretName="atlas-prod-sso-secret"
else
echo "ERROR: Unknown Atlas server value '$atlasServer'. Expected 'stage' or 'production'."
echo "ERROR: Unknown .atlas.server value '$atlasServer'. Expected 'stage' or 'production'."
exit 1
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: test-collect-atlas-params-nonexistent
annotations:
test/assert-task-failure: "run-task"
spec:
description: |
Run the collect-atlas-params task with a missing atlasServer key.
Expand Down Expand Up @@ -36,3 +34,38 @@ spec:
workspace: tests-workspace
runAfter:
- setup
- name: check-result
params:
- name: secretName
value: $(tasks.run-task.results.secretName)
- name: ssoTokenUrl
value: $(tasks.run-task.results.ssoTokenUrl)
- name: bombasticApiUrl
value: $(tasks.run-task.results.bombasticApiUrl)
- name: updateComponentSBOM
value: $(tasks.run-task.results.updateComponentSBOM)
taskSpec:
params:
- name: secretName
- name: ssoTokenUrl
- name: bombasticApiUrl
- name: updateComponentSBOM
steps:
- name: check-result
image: quay.io/konflux-ci/release-service-utils:d320c36f3d707cd5bfe55fe783f70236c06cc2e5
env:
- name: "SECRET_NAME"
value: '$(params.secretName)'
- name: "SSO_TOKEN_URL"
value: '$(params.ssoTokenUrl)'
- name: "BOMBASTIC_API_URL"
value: '$(params.bombasticApiUrl)'
- name: "UPDATE_COMPONENT_SBOM"
value: '$(params.updateComponentSBOM)'
script: |
#!/usr/bin/env sh
set -eux
test "$SECRET_NAME" = ""
test "$SSO_TOKEN_URL" = ""
test "$BOMBASTIC_API_URL" = ""

0 comments on commit 1f5a40a

Please sign in to comment.