forked from rcarrata/devsecops-demo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
bootstrap/roles/ocp4-install-pipelines/templates/task-syft-sbom.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: syft-sbom | ||
namespace: cicd | ||
spec: | ||
description: This Task can be used to generate a SBOM file with Syft. | ||
params: | ||
- default: $(workspaces.source.path) | ||
description: Application folder to scan | ||
name: APP_PATH | ||
type: string | ||
- default: reports | ||
description: The reports repository username | ||
name: REPORTS_REPO_USERNAME | ||
type: string | ||
- default: reports | ||
description: The reports repository password | ||
name: REPORTS_REPO_PASSWORD | ||
type: string | ||
- default: 'http://reports-repo:8080' | ||
description: >- | ||
The reports repository host based on | ||
https://github.com/chmouel/openshift-django-uploader | ||
name: REPORTS_REPO_HOST | ||
type: string | ||
steps: | ||
- env: | ||
- name: PIPELINERUN_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: 'metadata.labels[''tekton.dev/pipelineRun'']' | ||
image: 'registry.access.redhat.com/ubi8/ubi:latest' | ||
name: syft-scan | ||
resources: {} | ||
script: > | ||
#!/usr/bin/env bash | ||
|
||
echo '## Getting Syft ##' | ||
|
||
pwd | ||
|
||
curl -sSfL | ||
https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s | ||
-- -b . | ||
|
||
chmod +x ./syft | ||
|
||
echo '## Scanning folder and generating SBOM ##' | ||
|
||
./syft $(params.APP_PATH) -o spdx-json=sbom.json | ||
|
||
echo '## SBOM content ##' | ||
|
||
cat ./sbom.json | ||
|
||
echo "Uploading the report into the report server" | ||
|
||
curl -u $(params.REPORTS_REPO_USERNAME):$(params.REPORTS_REPO_PASSWORD) | ||
-F path=$PIPELINERUN_NAME/$'PIPELINERUN_NAME'-sbom.json -F [email protected] -X | ||
POST $(params.REPORTS_REPO_HOST)/upload; echo "" | ||
workspaces: | ||
- description: The workspace consisting of maven project. | ||
name: source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters