initial commit

This commit is contained in:
allard committed 2025-11-23 18:58:51 +01:00
commit 376a944abc
1553 files changed
+314731

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
FROM ubuntu
RUN apt update && apt upgrade -y
RUN apt install curl -y
@@ -0,0 +1 @@
{"$schema":"http://cyclonedx.org/schema/bom-1.5.schema.json","bomFormat":"CycloneDX","specVersion":"1.5","serialNumber":"urn:uuid:1c597c0c-0517-40a2-aa05-950ef1ceeb16","version":1,"metadata":{"timestamp":"2024-05-24T17:08:47+02:00","tools":{"components":[{"type":"application","author":"anchore","name":"syft","version":"1.4.1"}]},"component":{"bom-ref":"ef878e682849debe","type":"container","name":"harbor-dev.alldcs.nl/allard/olproperties","version":"1.1"},"properties":[{"name":"syft:image:labels:architecture","value":"aarch64"},{"name":"syft:image:labels:build-date","value":"2024-03-27T02:06:00"},{"name":"syft:image:labels:com.redhat.component","value":"ubi8-container"},{"name":"syft:image:labels:com.redhat.license_terms","value":"https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"},{"name":"syft:image:labels:description","value":"This image contains the system microservice running with the Open Liberty runtime."},{"name":"syft:image:labels:distribution-scope","value":"public"},{"name":"syft:image:labels:io.buildah.version","value":"1.23.3"},{"name":"syft:image:labels:io.k8s.description","value":"The Universal Base Image is designed and engineered to be the base layer for all of your containerized applications, middleware and utilities. This base image is freely redistributable, but Red Hat only supports Red Hat technologies through subscriptions for Red Hat products. This image is maintained by Red Hat and updated regularly."},{"name":"syft:image:labels:io.k8s.display-name","value":"Red Hat Universal Base Image 8"},{"name":"syft:image:labels:io.openliberty.image.tag","value":"kernel-slim-java17-openj9-ubi"},{"name":"syft:image:labels:io.openshift.tags","value":"base rhel8"},{"name":"syft:image:labels:liberty.image.tag","value":"kernel-slim-java17-openj9-ubi"},{"name":"syft:image:labels:maintainer","value":"Red Hat, Inc."},{"name":"syft:image:labels:name","value":"system"},{"name":"syft:image:labels:org.opencontainers.image.authors","value":"Your Name"},{"name":"syft:image:labels:org.opencontainers.image.revision","value":"SNAPSHOT"},{"name":"syft:image:labels:org.opencontainers.image.source","value":"https://github.com/OpenLiberty/guide-getting-started"},{"name":"syft:image:labels:org.opencontainers.image.url","value":"local"},{"name":"syft:image:labels:org.opencontainers.image.vendor","value":"IBM"},{"name":"syft:image:labels:org.opencontainers.image.version","value":"1.0"},{"name":"syft:image:labels:release","value":"17"},{"name":"syft:image:labels:run","value":"docker run --rm -ti <image_name:tag> /bin/bash"},{"name":"syft:image:labels:summary","value":"The system microservice from the Getting Started guide"},{"name":"syft:image:labels:url","value":"https://access.redhat.com/containers/#/registry.access.redhat.com/ubi8/images/8.9-1160"},{"name":"syft:image:labels:vcs-ref","value":"16023543dff146b00b5868ad23202e2af8b40a8a"},{"name":"syft:image:labels:vcs-type","value":"git"},{"name":"syft:image:labels:vendor","value":"Open Liberty"},{"name":"syft:image:labels:version","value":"1.0-SNAPSHOT"}]},"components":[{"bom-ref":"pkg:nuget/Apache%20Commons%20Daemon%20Service%20Runner@1.2.2.0?package-id=efc789e37e29ade7","type":"library","name":"Apache Commons Daemon Service Runner","version":"1.2.2.0","cpe":"cpe:2.3:a:Apache_Commons_Daemon_Service_Runner:Apache_Commons_Daemon_Service_Runner:1.2.2.0:*:*:*:*:*:*:*","purl":"pkg:nuget/Apache%20Commons%20Daemon%20Service%20Runner@1.2.2.0","properties":[{"name":"syft:package:foundBy","value":"dotnet-portable-executable-cataloger"},{"name":"syft:package:language","value":"dotnet"},{"name":"syft:package:type","value":"dotnet"},{"name":"syft:package:metadataType","value":"dotnet-portable-executable-entry"},{"name":"syft:location:0:layerID","value":"sha256:7aebf6e3b1026bb60f6a20966f902dc484c33b0806ad9911c3313af5af0d36be"},{"name":"syft:location:0:path","value":"/opt/ol/wlp/bin/tools/win/prunsrv.exe"}]},{"bom-ref":"pkg:pypi/pygobject@3.28.3?package-id=2c576430fd210a48","type":"library","author":"James Henstridge <james@daa.com.au>","name":"PyGObject","version":"3.28.3","licenses":[{"license":{"name":"GNU LGPL"}}],"cpe":"cpe:2.3:a:james_henstridge_project:python-PyGObject:3.28.3:*:*:*:*:*:*:*","purl":"pkg:pypi/PyGObject@3.28.3","properties":[{"name":"syft:package:foundBy","value":"python-installed-package-cataloger"},{"name":"syft:package:language","value":"python"},{"name":"syft:package:type","value":"python"},{"name":"syft:package:metadataType","value":"python-package"},{"name":"syft:cpe23","value":"cpe:2.3:a:james_henstridge_project:python_PyGObject:3.28.3:*:*:*:*:*:*:*"},{"name":"syft:cpe23","value":"cpe:2.3:a:james_henstridgeproject:python-PyGObject:3.28.3:*:*:*:*:*:*:*"},{"name":"syft:cpe23","value":"cpe:2.3:a:james_henstridgeproject:python_PyGObject:3.28.3:*:*:*:*:*:*:*"},{"name":"syft:cpe23","value":"cpe:2.3:a:james_henstridge_project:PyGObject:3.28.3:*:*:*:*:*:*:*"},{"name":"syft:cpe23","value":"cpe:2.3:a:james_henstridge:python-PyGObject:3.28.3:*Line truncated
+50
View File
@@ -0,0 +1,50 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: push-sbom
namespace: default
spec:
params:
- description: The name of sbom
name: sbom
type: string
- description: The deptrack-authorisation-key to upload the sbom, put in secret
name: deptrack-apiKey
type: string
- description: The name of the deptrack-project
name: deptrack-projectName
type: string
- description: The version of the deptrack-project
name: deptrack-projectVersion
type: string
steps:
- computeResources: {}
image: allardkrings/ubuntu-curl:1.0
name: push-sbom
script: |
#!/usr/bin/env bash
if
curl -X POST \
-H 'Content-Type: multipart/form-data; boundary=__X_BOM__' \
-H "X-API-Key: odt_UPC8l0R9vzQILZIphSoK15J4u4Ns3HEy" \
-F "autoCreate=true" \
-F "projectName=olproperties" \
-F "projectVersion=1.1" \
-F "bom=@olproperties.sbom.json" \
"https://deptracka-dev.allarddcs.nl/api/v1/bom" \
| grep "token"
then
echo "sbom uploaded succesfully"
else
echo odt_UPC8l0R9vzQILZIphSoK15J4u4Ns3HEy
echo olproperties
echo 1.1
echo olproperties.sbom.json
ls
echo "upload sbom failed"
exit -1
fi
workingDir: $(workspaces.source-dir.path)
workspaces:
- name: source-dir
optional: true
+56
View File
@@ -0,0 +1,56 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: push-sbom
namespace: default
spec:
params:
- description: The name of sbom
name: sbom
type: string
- description: The deptrack-authorisation-key to upload the sbom, put in secret
name: deptrack-apiKey
type: string
- description: The name of the deptrack-project
name: deptrack-projectName
type: string
- description: The version of the deptrack-project
name: deptrack-projectVersion
type: string
- description: The URL of the DepTrack API
name: deptrack-url
type: string
steps:
- computeResources: {}
image: harbor-dev.allarddcs.nl/allard/curl:1.0
name: push-sbom
script: |
#!/usr/bin/env bash
# Run curl command and capture the output and error messages
response=$(curl -v -k -X POST \
-H 'Content-Type: multipart/form-data; boundary=__X_BOM__' \
-H "X-API-Key: $(params.deptrack-apiKey)" \
-F "autoCreate=true" \
-F "projectName=$(params.deptrack-projectName)" \
-F "projectVersion=$(params.deptrack-projectVersion)" \
-F "bom=@$(params.sbom)" \
"$(params.deptrack-url)/api/v1/bom" 2>&1)
# Check the response for a specific token or success message
if echo "$response" | grep -q "token"; then
echo "SBOM uploaded successfully"
else
# Print the error response from curl to diagnose the failure
echo $(params.deptrack-url)
echo $(params.deptrack-apiKey)
echo $(params.deptrack-projectName)
echo $(params.deptrack-projectVersion)
echo $(params.sbom)
echo "Failed to upload SBOM. Response from curl:"
echo "$response"
exit 1
fi
workingDir: $(workspaces.source-dir.path)
workspaces:
- name: source-dir
optional: true
+50
View File
@@ -0,0 +1,50 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: push-sbom
namespace: default
spec:
params:
- description: name of the image
name: image-reference
type: string
- description: The name of sbom
name: sbom
type: string
- description: The deptrack-authorisation-key to upload the sbom, put in secret
name: deptrack-apiKey
type: string
- description: The name of the deptrack-project
name: deptrack-projectName
type: string
- description: The version of the deptrack-project
name: deptrack-projectVersion
type: string
- description: The URL of the DepTrack API
name: deptrack-url
type: string
steps:
- computeResources: {}
image: harbor-dev.allarddcs.nl/allard/curl:1.0
name: push-sbom
script: |
#!/usr/bin/env bash
if curl -k -X POST \
-H 'Content-Type: multipart/form-data; boundary=__X_BOM__' \
-H "X-API-Key: $(params.deptrack-apiKey)" \
-F "autoCreate=true" \
-F "projectName=$(params.deptrack-projectName)" \
-F "projectVersion=$(params.deptrack-projectVersion)" \
-F "bom=@$(params.sbom)" \
"$(params.deptrack-url)/api/v1/bom" \
| grep "token"
then
echo "sbom uploaded successfully"
else
echo "Failed to upload sbom"
exit -1
fi
workingDir: $(workspaces.source-dir.path)
workspaces:
- name: source-dir
optional: true
+30
View File
@@ -0,0 +1,30 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: syft-push-pipeline-run-
spec:
pipelineRef:
name: generate-and-push-sbom
params:
- name: image-reference
value: harbor-dev.allarddcs.nl/allard/olproperties:1.0
- name: deptrack-url
value: http://deptrack-apiserver.deptrack.svc.cluster.local:8080
- name: deptrack-projectName
value: olproperties
- name: deptrack-projectVersion
value: 1.1
- name: deptrack-apiKey
value: odt_BRpq4el8T0XqdeunYMnefniaS0n8Yxd8
- name: deptrack-options
value:
- ""
workspaces:
- name: shared-data
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
+55
View File
@@ -0,0 +1,55 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: generate-and-push-sbom
spec:
description: |
This pipeline generates an sbom with syft and pushes the sbom to deptrack
params:
- name: image-reference
type: string
- name: deptrack-url
type: string
- name: deptrack-projectName
type: string
- name: deptrack-projectVersion
type: string
- name: deptrack-options
type: array
- name: deptrack-apiKey
type: string
workspaces:
- name: shared-data
tasks:
- name: syft
taskRef:
name: syft
params:
- name: ARGS
value:
- $(params.image-reference)
- --output
- cyclonedx-json=./$(params.deptrack-projectName).sbom.json
workspaces:
- name: source-dir
workspace: shared-data
- name: push-sbom
runAfter: ["syft"]
taskref:
name: push-sbom
params:
- name: deptrack-url
value: $(params.deptrack-url)
- name: deptrack-apiKey
value: $(params.deptrack-apiKey)
- name: deptrack-projectName
value: $(params.deptrack-projectName)
- name: deptrack-projectVersion
value: $(params.deptrack-projectVersion)
- name: sbom
value: $(params.deptrack-projectName).sbom.json
workspaces:
- name: source-dir
workspace: shared-data
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
export deptrackapiKey=odt_BRpq4el8T0XqdeunYMnefniaS0n8Yxd8
export deptrackprojectName=olproperties
export deptrackprojectVersion=1.1
export sbom=olproperties.sbom.json
if
curl -X POST "https://deptracka-dev.allarddcs.nl/api/v1/bom" \
-H 'Content-Type: multipart/form-data; boundary=__X_BOM__' \
-H "X-API-Key: $deptrackapiKey" \
-F "autoCreate=true" \
-F "projectName=$deptrackprojectName" \
-F "projectVersion=$deptrackprojectVersion" \
-F "bom=@olproperties.sbom.json" \
| grep "token"
then
echo "sbom uploaded succesfully"
else
echo $deptrackapiKey
echo $deptrackprojectName
echo $deptrackprojectVersion
echo $sbom
echo "upload sbom failed"
exit -1
fi