@@ -10,12 +10,12 @@ metadata:
10
10
build.appstudio.redhat.com/target_branch : ' {{target_branch}}'
11
11
pipelinesascode.tekton.dev/cancel-in-progress : " true"
12
12
pipelinesascode.tekton.dev/max-keep-runs : ' 3'
13
- pipelinesascode.tekton.dev/on-cel-expression : event == "pull_request" && target_branch
14
- == "main" && ( "jupyter/minimal/ubi9-python-3.11/Pipfile.lock".pathChanged()
15
- || "jupyter/minimal/ubi9-python-3.11/start-notebook.sh".pathChanged() || "jupyter/utils/***".pathChanged()
16
- || ".tekton/jupyter-minimal-ubi9-python-3-11-pull-request.yaml".pathChanged()
17
- || "jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu".pathChanged() ) && has(body.repository)
18
- && body.repository.full_name == "opendatahub-io/notebooks"
13
+ # pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && target_branch
14
+ # == "main" && ( "jupyter/minimal/ubi9-python-3.11/Pipfile.lock".pathChanged()
15
+ # || "jupyter/minimal/ubi9-python-3.11/start-notebook.sh".pathChanged() || "jupyter/utils/***".pathChanged()
16
+ # || ".tekton/jupyter-minimal-ubi9-python-3-11-pull-request.yaml".pathChanged()
17
+ # || "jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu".pathChanged() ) && has(body.repository)
18
+ # && body.repository.full_name == "opendatahub-io/notebooks"
19
19
creationTimestamp : null
20
20
labels :
21
21
appstudio.openshift.io/application : notebooks
@@ -598,6 +598,97 @@ spec:
598
598
operator : in
599
599
values :
600
600
- " false"
601
+ - name : check-image-software
602
+ params :
603
+ - name : IMAGE_URL
604
+ value : $(tasks.build-image-index.results.IMAGE_URL)
605
+ # - name: PLATFORM
606
+ # value: $(tasks.build-image-index.results.IMAGE_URL)
607
+ - name : CHAINS-GIT_URL
608
+ value : $(tasks.clone-repository.results.url)
609
+ - name : CHAINS-GIT_COMMIT
610
+ value : $(tasks.clone-repository.results.commit)
611
+ - name : COSIGN_VERSION
612
+ value : v2.4.3
613
+ runAfter :
614
+ - build-image-index
615
+ # taskRef:
616
+ # params:
617
+ # - name: name
618
+ # value: show-sbom
619
+ # - name: bundle
620
+ # value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04f15cbce548e1db7770eee3f155ccb2cc0140a6c371dc67e9a34d83673ea0c0
621
+ # - name: kind
622
+ # value: task
623
+ # resolver: bundles
624
+ taskSpec :
625
+ params :
626
+ - name : IMAGE_URL
627
+ # - name: PLATFORM
628
+ - name : CHAINS-GIT_URL
629
+ - name : CHAINS-GIT_COMMIT
630
+ - name : COSIGN_VERSION
631
+ results :
632
+ - name : CHECK_OUTPUT
633
+ description : Check output
634
+ steps :
635
+ - name : check-image-software
636
+ image : registry.redhat.io/openshift4/ose-cli:latest
637
+ env :
638
+ - name : IMAGE_URL
639
+ value : $(params.IMAGE_URL)
640
+ # - name: PLATFORM
641
+ # value: $(params.PLATFORM)
642
+ - name : GIT_URL
643
+ value : $(params.CHAINS-GIT_URL)
644
+ - name : GIT_COMMIT
645
+ value : $(params.CHAINS-GIT_COMMIT)
646
+ - name : COSIGN_VERSION
647
+ value : $(params.COSIGN_VERSION)
648
+ script : |
649
+ #!/bin/bash
650
+ echo "Hello world, Stuchy!"
651
+ env
652
+ wget --output-document=cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-amd64"
653
+ chmod a+x cosign
654
+ ./cosign download sbom $PLATFORM_ARG $IMAGE_URL 2>>err
655
+
656
+ download_sbom_with_retry() {
657
+ status=-1
658
+ max_try=5
659
+ wait_sec=2
660
+
661
+ PLATFORM_ARG="${1}"
662
+ for run in $(seq 1 ${max_try}); do
663
+ status=0
664
+ cosign download sbom $PLATFORM_ARG $IMAGE_URL 2>>err
665
+ status=$?
666
+ if [ "$status" -eq 0 ]; then
667
+ break
668
+ fi
669
+ sleep $wait_sec
670
+ done
671
+ if [ "$status" -ne 0 ]; then
672
+ echo "Failed to get SBOM after ${max_try} tries" >&2
673
+ cat err >&2
674
+ fi
675
+ }
676
+
677
+ RAW_OUTPUT=$(skopeo inspect --no-tags --raw docker://${IMAGE_URL})
678
+ if [ "$(jq 'has("manifests")' <<< "$RAW_OUTPUT")" == "true" ] ; then
679
+ # Multi arch
680
+ ARCHES=$(jq -r '.manifests[].platform.architecture' <<< $RAW_OUTPUT)
681
+ else
682
+ ARCHES=""
683
+ fi
684
+
685
+ if [ -z "${ARCHES}" ] ; then
686
+ # single arch image
687
+ download_sbom_with_retry ""
688
+ else
689
+ download_sbom_with_retry " --platform=${PLATFORM} "
690
+ fi
691
+
601
692
workspaces :
602
693
- name : git-auth
603
694
optional : true
0 commit comments