From bbb25b90f77d4767434fc2a5d2b16cdcf3959785 Mon Sep 17 00:00:00 2001 From: John Duimovich Date: Wed, 27 Nov 2024 13:52:29 -0500 Subject: [PATCH 1/4] fix cosign login and tree command --- rhtap/show-sbom-rhdh.sh | 5 +++++ rhtap/summary.sh | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rhtap/show-sbom-rhdh.sh b/rhtap/show-sbom-rhdh.sh index c9e32c6..c03bb4f 100755 --- a/rhtap/show-sbom-rhdh.sh +++ b/rhtap/show-sbom-rhdh.sh @@ -14,6 +14,11 @@ function show-sbom() { echo -n "." status=0 echo + image_registry="${IMAGE_URL/\/*/}" + # If the repo is not publicly accessible we need to authenticate so ec can access it + prepare-registry-user-pass $image_registry + echo "cosign login to registry $image_registry" + cosign login --username="$IMAGE_REGISTRY_USER" --password="$IMAGE_REGISTRY_PASSWORD" $image_registry echo "SBOM_EYECATCHER_BEGIN" cosign download sbom $IMAGE_URL 2>> $RESULTS/err status=$? diff --git a/rhtap/summary.sh b/rhtap/summary.sh index ebbad1e..95dabdf 100755 --- a/rhtap/summary.sh +++ b/rhtap/summary.sh @@ -23,9 +23,22 @@ function appstudio-summary() { echo End Summary } +# missing tree command +function showTree() { + find $1 | sed -e "s/[^-][^\/]*\// ├─/g" -e "s/|\([^ ]\)/|─\1/" +} +function cosignTree() { + URL=$1 + image_registry="${URL/\/*/}" + # If the repo is not publicly accessible we need to authenticate so ec can access it + prepare-registry-user-pass $image_registry + echo "cosign login to registry $image_registry" + cosign login --username="$IMAGE_REGISTRY_USER" --password="$IMAGE_REGISTRY_PASSWORD" $image_registry +} + # Task Steps appstudio-summary -tree $BASE_RESULTS -cosign tree $IMAGE_URL +showTree $BASE_RESULTS +cosignTree $IMAGE_URL exit_with_success_result From 873bdcdb994816b555c75d5b2875fc8aa1b6965a Mon Sep 17 00:00:00 2001 From: John Duimovich Date: Wed, 27 Nov 2024 13:59:52 -0500 Subject: [PATCH 2/4] actuall run cosign tree --- rhtap/summary.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rhtap/summary.sh b/rhtap/summary.sh index 95dabdf..0eb253a 100755 --- a/rhtap/summary.sh +++ b/rhtap/summary.sh @@ -28,12 +28,13 @@ function showTree() { find $1 | sed -e "s/[^-][^\/]*\// ├─/g" -e "s/|\([^ ]\)/|─\1/" } function cosignTree() { - URL=$1 + $=$1 image_registry="${URL/\/*/}" # If the repo is not publicly accessible we need to authenticate so ec can access it prepare-registry-user-pass $image_registry echo "cosign login to registry $image_registry" cosign login --username="$IMAGE_REGISTRY_USER" --password="$IMAGE_REGISTRY_PASSWORD" $image_registry + cosign tree $URL } From 3edfa27dccbff2a1a006e163a8be9d2ad7516a0c Mon Sep 17 00:00:00 2001 From: John Duimovich Date: Wed, 27 Nov 2024 14:04:03 -0500 Subject: [PATCH 3/4] URL=$1 --- rhtap/summary.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rhtap/summary.sh b/rhtap/summary.sh index 0eb253a..22253fc 100755 --- a/rhtap/summary.sh +++ b/rhtap/summary.sh @@ -27,8 +27,8 @@ function appstudio-summary() { function showTree() { find $1 | sed -e "s/[^-][^\/]*\// ├─/g" -e "s/|\([^ ]\)/|─\1/" } -function cosignTree() { - $=$1 +function cosignTree() { + URL=$1 image_registry="${URL/\/*/}" # If the repo is not publicly accessible we need to authenticate so ec can access it prepare-registry-user-pass $image_registry From 8567b477fdf72c9ffec7b37fba83f64a1b22386d Mon Sep 17 00:00:00 2001 From: John Duimovich Date: Wed, 27 Nov 2024 14:04:27 -0500 Subject: [PATCH 4/4] make format --- rhtap/summary.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rhtap/summary.sh b/rhtap/summary.sh index 22253fc..4a606a6 100755 --- a/rhtap/summary.sh +++ b/rhtap/summary.sh @@ -24,20 +24,19 @@ function appstudio-summary() { } # missing tree command -function showTree() { +function showTree() { find $1 | sed -e "s/[^-][^\/]*\// ├─/g" -e "s/|\([^ ]\)/|─\1/" } -function cosignTree() { +function cosignTree() { URL=$1 image_registry="${URL/\/*/}" # If the repo is not publicly accessible we need to authenticate so ec can access it prepare-registry-user-pass $image_registry echo "cosign login to registry $image_registry" cosign login --username="$IMAGE_REGISTRY_USER" --password="$IMAGE_REGISTRY_PASSWORD" $image_registry - cosign tree $URL + cosign tree $URL } - # Task Steps appstudio-summary showTree $BASE_RESULTS