Skip to content

Commit 7eda8f4

Browse files
committed
asdf
1 parent 58c7272 commit 7eda8f4

File tree

3 files changed

+70
-73
lines changed

3 files changed

+70
-73
lines changed

.tekton/jupyter-minimal-ubi9-python-3-11-pull-request.yaml

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -648,49 +648,23 @@ spec:
648648
value: $(params.COSIGN_VERSION)
649649
script: |
650650
#!/bin/bash
651-
echo "Hello world, Stuchy!"
652651
env
653-
wget --output-document=cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-amd64"
654-
chmod a+x cosign
655-
656-
dnf install -y jq skopeo
657652
658-
download_sbom_with_retry() {
659-
status=-1
660-
max_try=5
661-
wait_sec=2
653+
set -x
654+
REPO_SPACE=$(echo "${GIT_URL}" | sed 's#.*github.com/\(.*\)#\1#')
655+
FILE_NAME="konflux-check-software.sh"
656+
FILE_PATH="ci/${FILE_NAME}"
662657
663-
PLATFORM_ARG="${1}"
664-
for run in $(seq 1 ${max_try}); do
665-
status=0
666-
./cosign download sbom $PLATFORM_ARG $IMAGE_URL 2>>err
667-
status=$?
668-
if [ "$status" -eq 0 ]; then
669-
break
670-
fi
671-
sleep $wait_sec
672-
done
673-
if [ "$status" -ne 0 ]; then
674-
echo "Failed to get SBOM after ${max_try} tries" >&2
675-
cat err >&2
676-
fi
677-
}
658+
wget --progress=bar "https://raw.githubusercontent.com/${REPO_SPACE}/${GIT_COMMIT}/${FILE_PATH}"
659+
chmod a+x "${FILE_NAME}"
660+
set +x
678661
679-
RAW_OUTPUT=$(skopeo inspect --no-tags --raw docker://${IMAGE_URL})
680-
if [ "$(jq 'has("manifests")' <<< "$RAW_OUTPUT")" == "true" ] ; then
681-
# Multi arch
682-
ARCHES=$(jq -r '.manifests[].platform.architecture' <<< $RAW_OUTPUT)
683-
else
684-
ARCHES=""
685-
fi
662+
wget --progress=bar --output-document=cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-amd64"
663+
chmod a+x cosign
686664
687-
if [ -z "${ARCHES}" ] ; then
688-
# single arch image
689-
download_sbom_with_retry ""
690-
else
691-
download_sbom_with_retry " --platform=${PLATFORM} "
692-
fi
665+
dnf install -y jq skopeo
693666
667+
./${FILE_NAME}
694668
workspaces:
695669
- name: git-auth
696670
optional: true

.tekton/jupyter-minimal-ubi9-python-3-11-push.yaml

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -644,48 +644,23 @@ spec:
644644
value: $(params.COSIGN_VERSION)
645645
script: |
646646
#!/bin/bash
647-
echo "Hello world, Stuchy!"
648647
env
649-
wget --output-document=cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-amd64"
650-
chmod a+x cosign
651648
652-
dnf install -y jq skopeo
649+
set -x
650+
REPO_SPACE=$(echo "${GIT_URL}" | sed 's#.*github.com/\(.*\)#\1#')
651+
FILE_NAME="konflux-check-software.sh"
652+
FILE_PATH="ci/${FILE_NAME}"
653653
654-
download_sbom_with_retry() {
655-
status=-1
656-
max_try=5
657-
wait_sec=2
654+
wget --progress=bar "https://raw.githubusercontent.com/${REPO_SPACE}/${GIT_COMMIT}/${FILE_PATH}"
655+
chmod a+x "${FILE_NAME}"
656+
set +x
658657
659-
PLATFORM_ARG="${1}"
660-
for run in $(seq 1 ${max_try}); do
661-
status=0
662-
./cosign download sbom $PLATFORM_ARG $IMAGE_URL 2>>err
663-
status=$?
664-
if [ "$status" -eq 0 ]; then
665-
break
666-
fi
667-
sleep $wait_sec
668-
done
669-
if [ "$status" -ne 0 ]; then
670-
echo "Failed to get SBOM after ${max_try} tries" >&2
671-
cat err >&2
672-
fi
673-
}
658+
wget --progress=bar --output-document=cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-amd64"
659+
chmod a+x cosign
674660
675-
RAW_OUTPUT=$(skopeo inspect --no-tags --raw docker://${IMAGE_URL})
676-
if [ "$(jq 'has("manifests")' <<< "$RAW_OUTPUT")" == "true" ] ; then
677-
# Multi arch
678-
ARCHES=$(jq -r '.manifests[].platform.architecture' <<< $RAW_OUTPUT)
679-
else
680-
ARCHES=""
681-
fi
661+
dnf install -y jq skopeo
682662
683-
if [ -z "${ARCHES}" ] ; then
684-
# single arch image
685-
download_sbom_with_retry ""
686-
else
687-
download_sbom_with_retry " --platform=${PLATFORM} "
688-
fi
663+
./${FILE_NAME}
689664
workspaces:
690665
- name: git-auth
691666
optional: true

ci/konflux-check-software.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
#
3+
# TODO - description, prereq and usage etc...
4+
5+
download_sbom_with_retry() {
6+
local status=-1
7+
local max_try=5
8+
local wait_sec=2
9+
10+
local platform_arg="${1}"
11+
local image_url="${2}"
12+
13+
for run in $(seq 1 ${max_try}); do
14+
status=0
15+
./cosign download sbom ${platform_arg} ${image_url} 2>>err
16+
status=$?
17+
if [ "$status" -eq 0 ]; then
18+
break
19+
fi
20+
sleep $wait_sec
21+
done
22+
if [ "$status" -ne 0 ]; then
23+
echo "Failed to get SBOM after ${max_try} tries" >&2
24+
cat err >&2
25+
fi
26+
}
27+
28+
RAW_OUTPUT=$(skopeo inspect --no-tags --raw "docker://${IMAGE_URL}")
29+
if [ "$(jq 'has("manifests")' <<< "$RAW_OUTPUT")" == "true" ] ; then
30+
# Multi arch
31+
OS=$(jq -r '.manifests[].platform.os' <<< $RAW_OUTPUT)
32+
ARCH=$(jq -r '.manifests[].platform.architecture' <<< $RAW_OUTPUT)
33+
if test "${ARCH}" = "amd64"; then
34+
ARCH="x86-64"
35+
fi
36+
PLATFORM="${OS}-${ARCH}"
37+
else
38+
PLATFORM=""
39+
fi
40+
41+
if [ -z "${PLATFORM}" ] ; then
42+
# single arch image
43+
# download_sbom_with_retry "" "${IMAGE_URL}"
44+
download_sbom_with_retry "" "${IMAGE_URL}-${PLATFORM}"
45+
else
46+
# download_sbom_with_retry " --platform=${PLATFORM} " "${IMAGE_URL}"-
47+
download_sbom_with_retry "" "${IMAGE_URL}-${PLATFORM}"
48+
fi

0 commit comments

Comments
 (0)