From 0b4950da6a48b587ed3d0eb3a15b5959c5e86523 Mon Sep 17 00:00:00 2001 From: Mridula Peddada Date: Mon, 16 Oct 2023 16:53:10 -0400 Subject: [PATCH 1/6] chore: avoid masking errors in docker validation script --- .kokoro/verify-docker-images.sh | 38 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/.kokoro/verify-docker-images.sh b/.kokoro/verify-docker-images.sh index 794f7a8d..a40886fb 100755 --- a/.kokoro/verify-docker-images.sh +++ b/.kokoro/verify-docker-images.sh @@ -2,6 +2,8 @@ # Script to verify the presence of GraalVM docker test images tagged with the latest java-shared-config version. +set -eo pipefail + function fetch_image_names() { imageNames="$(grep " - gcr.io/cloud-devrel-public-resources/" .cloudbuild/cloudbuild.yaml | cut -d "/" -f 3 | cut -d ":" -f 1)" export imageNames @@ -21,19 +23,27 @@ javaSharedConfigVersion="$(mvn help:evaluate -Dexpression=project.version -q -Df branchName=$(git name-rev "${KOKORO_GIT_COMMIT}" | sed 's/.* //') gitCommitMessage=$(git log -1 "$(git rev-parse --short "${KOKORO_GIT_COMMIT}")" | grep "chore(main): release *") -# GraalVM docker images are not tagged with SNAPSHOT versions. -if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then - imageNames=$(fetch_image_names) - for name in $imageNames; do - fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" - echo "Verifying presence of ${fullContainerName}." - gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? - if [[ $exit_status = 0 ]]; then - echo "Success. Found $fullContainerName." - fi - done - RETURN_CODE=$? -else - echo "Skipping check for non-release and SNAPSHOT update branches" +gcloud container images describe "gcr.io/cloud-devrel-public-resources/graalvm_a:1.6.0" > /dev/null; exit_status=$? +if [[ $exit_status = 0 ]]; then + echo "Success. Found $fullContainerName." exit 0 +else + exit $exit_status fi + +# GraalVM docker images are not tagged with SNAPSHOT versions. +#if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then +# imageNames=$(fetch_image_names) +# for name in $imageNames; do +# fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" +# echo "Verifying presence of ${fullContainerName}." +# gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? +# if [[ $exit_status = 0 ]]; then +# echo "Success. Found $fullContainerName." +# fi +# done +# RETURN_CODE=$? +#else +# echo "Skipping check for non-release and SNAPSHOT update branches" +# exit 0 +#fi From bd9ae47ca1cfd67c21a4f79de84590990d110018 Mon Sep 17 00:00:00 2001 From: Mridula Peddada Date: Mon, 16 Oct 2023 17:00:09 -0400 Subject: [PATCH 2/6] add log messages for failure --- .kokoro/verify-docker-images.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.kokoro/verify-docker-images.sh b/.kokoro/verify-docker-images.sh index a40886fb..556a7e4c 100755 --- a/.kokoro/verify-docker-images.sh +++ b/.kokoro/verify-docker-images.sh @@ -3,6 +3,7 @@ # Script to verify the presence of GraalVM docker test images tagged with the latest java-shared-config version. set -eo pipefail +set -x function fetch_image_names() { imageNames="$(grep " - gcr.io/cloud-devrel-public-resources/" .cloudbuild/cloudbuild.yaml | cut -d "/" -f 3 | cut -d ":" -f 1)" @@ -28,6 +29,7 @@ if [[ $exit_status = 0 ]]; then echo "Success. Found $fullContainerName." exit 0 else + echo "Failed. Unable to find $fullContainerName." exit $exit_status fi From 901bda0bdbab3c4319ebe326a6d8deb638e8a585 Mon Sep 17 00:00:00 2001 From: Mridula Peddada Date: Mon, 16 Oct 2023 17:05:32 -0400 Subject: [PATCH 3/6] print echo statements --- .kokoro/verify-docker-images.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.kokoro/verify-docker-images.sh b/.kokoro/verify-docker-images.sh index 556a7e4c..0f95a5f5 100755 --- a/.kokoro/verify-docker-images.sh +++ b/.kokoro/verify-docker-images.sh @@ -2,7 +2,7 @@ # Script to verify the presence of GraalVM docker test images tagged with the latest java-shared-config version. -set -eo pipefail +set -o pipefail set -x function fetch_image_names() { @@ -29,7 +29,6 @@ if [[ $exit_status = 0 ]]; then echo "Success. Found $fullContainerName." exit 0 else - echo "Failed. Unable to find $fullContainerName." exit $exit_status fi From 3810d792c25b9044256ac70357b564ce19e7a5d4 Mon Sep 17 00:00:00 2001 From: Mridula Peddada Date: Mon, 16 Oct 2023 17:14:39 -0400 Subject: [PATCH 4/6] undo test code --- .kokoro/verify-docker-images.sh | 39 ++++++++++++++------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.kokoro/verify-docker-images.sh b/.kokoro/verify-docker-images.sh index 0f95a5f5..b9ac3da7 100755 --- a/.kokoro/verify-docker-images.sh +++ b/.kokoro/verify-docker-images.sh @@ -3,6 +3,8 @@ # Script to verify the presence of GraalVM docker test images tagged with the latest java-shared-config version. set -o pipefail + +# Output commands executed. set -x function fetch_image_names() { @@ -24,27 +26,20 @@ javaSharedConfigVersion="$(mvn help:evaluate -Dexpression=project.version -q -Df branchName=$(git name-rev "${KOKORO_GIT_COMMIT}" | sed 's/.* //') gitCommitMessage=$(git log -1 "$(git rev-parse --short "${KOKORO_GIT_COMMIT}")" | grep "chore(main): release *") -gcloud container images describe "gcr.io/cloud-devrel-public-resources/graalvm_a:1.6.0" > /dev/null; exit_status=$? -if [[ $exit_status = 0 ]]; then - echo "Success. Found $fullContainerName." - exit 0 +# GraalVM docker images are not tagged with SNAPSHOT versions. +if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then + imageNames=$(fetch_image_names) + for name in $imageNames; do + fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" + echo "Verifying presence of ${fullContainerName}." + gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? + if [[ $exit_status = 0 ]]; then + echo "Success. Found $fullContainerName." + else + exit $exit_status + fi + done else - exit $exit_status + echo "Skipping check for non-release and SNAPSHOT update branches" + exit 0 fi - -# GraalVM docker images are not tagged with SNAPSHOT versions. -#if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then -# imageNames=$(fetch_image_names) -# for name in $imageNames; do -# fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" -# echo "Verifying presence of ${fullContainerName}." -# gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? -# if [[ $exit_status = 0 ]]; then -# echo "Success. Found $fullContainerName." -# fi -# done -# RETURN_CODE=$? -#else -# echo "Skipping check for non-release and SNAPSHOT update branches" -# exit 0 -#fi From f48fb2d935c22b04c957b695f1b519cd700c8985 Mon Sep 17 00:00:00 2001 From: Mridula Peddada Date: Mon, 16 Oct 2023 17:28:09 -0400 Subject: [PATCH 5/6] test removal of redundant check --- .kokoro/verify-docker-images.sh | 35 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.kokoro/verify-docker-images.sh b/.kokoro/verify-docker-images.sh index b9ac3da7..2feb77c6 100755 --- a/.kokoro/verify-docker-images.sh +++ b/.kokoro/verify-docker-images.sh @@ -26,20 +26,23 @@ javaSharedConfigVersion="$(mvn help:evaluate -Dexpression=project.version -q -Df branchName=$(git name-rev "${KOKORO_GIT_COMMIT}" | sed 's/.* //') gitCommitMessage=$(git log -1 "$(git rev-parse --short "${KOKORO_GIT_COMMIT}")" | grep "chore(main): release *") +gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? +#if [[ $exit_status = 0 ]]; then +# echo "Success. Found $fullContainerName." +#fi + # GraalVM docker images are not tagged with SNAPSHOT versions. -if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then - imageNames=$(fetch_image_names) - for name in $imageNames; do - fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" - echo "Verifying presence of ${fullContainerName}." - gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? - if [[ $exit_status = 0 ]]; then - echo "Success. Found $fullContainerName." - else - exit $exit_status - fi - done -else - echo "Skipping check for non-release and SNAPSHOT update branches" - exit 0 -fi +#if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then +# imageNames=$(fetch_image_names) +# for name in $imageNames; do +# fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" +# echo "Verifying presence of ${fullContainerName}." +# gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? +# if [[ $exit_status = 0 ]]; then +# echo "Success. Found $fullContainerName." +# fi +# done +#else +# echo "Skipping check for non-release and SNAPSHOT update branches" +# exit 0 +#fi From 6629dc90204b95ca206e43ee2dcde0b2ff6408ff Mon Sep 17 00:00:00 2001 From: Mridula Peddada Date: Mon, 16 Oct 2023 17:40:35 -0400 Subject: [PATCH 6/6] undo change --- .kokoro/verify-docker-images.sh | 35 +++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/.kokoro/verify-docker-images.sh b/.kokoro/verify-docker-images.sh index 2feb77c6..b9ac3da7 100755 --- a/.kokoro/verify-docker-images.sh +++ b/.kokoro/verify-docker-images.sh @@ -26,23 +26,20 @@ javaSharedConfigVersion="$(mvn help:evaluate -Dexpression=project.version -q -Df branchName=$(git name-rev "${KOKORO_GIT_COMMIT}" | sed 's/.* //') gitCommitMessage=$(git log -1 "$(git rev-parse --short "${KOKORO_GIT_COMMIT}")" | grep "chore(main): release *") -gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? -#if [[ $exit_status = 0 ]]; then -# echo "Success. Found $fullContainerName." -#fi - # GraalVM docker images are not tagged with SNAPSHOT versions. -#if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then -# imageNames=$(fetch_image_names) -# for name in $imageNames; do -# fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" -# echo "Verifying presence of ${fullContainerName}." -# gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? -# if [[ $exit_status = 0 ]]; then -# echo "Success. Found $fullContainerName." -# fi -# done -#else -# echo "Skipping check for non-release and SNAPSHOT update branches" -# exit 0 -#fi +if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then + imageNames=$(fetch_image_names) + for name in $imageNames; do + fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" + echo "Verifying presence of ${fullContainerName}." + gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? + if [[ $exit_status = 0 ]]; then + echo "Success. Found $fullContainerName." + else + exit $exit_status + fi + done +else + echo "Skipping check for non-release and SNAPSHOT update branches" + exit 0 +fi