From 51b99064b88b16a47a10180c2315bca36f74c7d3 Mon Sep 17 00:00:00 2001 From: xuan-cao-swi Date: Tue, 2 Jan 2024 10:35:06 -0500 Subject: [PATCH 1/2] NH-55892: fix the exit status --- .github/workflows/script/sw_build_and_push_gem.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/script/sw_build_and_push_gem.sh b/.github/workflows/script/sw_build_and_push_gem.sh index 85abb32da..a066404ef 100755 --- a/.github/workflows/script/sw_build_and_push_gem.sh +++ b/.github/workflows/script/sw_build_and_push_gem.sh @@ -17,5 +17,9 @@ gem_version=$(grep -E "VERSION\s*=\s*'[^']+'" "$found_file" | awk -F "'" '{print gem build "opentelemetry-instrumentation-$GEM_NAME.gemspec" gem push --key github --host https://rubygems.pkg.github.com/solarwinds "opentelemetry-instrumentation-$GEM_NAME-$gem_version.gem" -# finished -echo "Finished" +if [ $? -eq 0 ]; then + echo "Finished" +else + echo "Failed" + exit 1 +fi From c3e4c6487e62726c373691dd8ce9205860990138 Mon Sep 17 00:00:00 2001 From: xuan-cao-swi Date: Tue, 2 Jan 2024 15:15:45 -0500 Subject: [PATCH 2/2] NH-55892: use set -e to exit --- .github/workflows/script/sw_build_and_push_gem.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/script/sw_build_and_push_gem.sh b/.github/workflows/script/sw_build_and_push_gem.sh index a066404ef..2ed2009d7 100755 --- a/.github/workflows/script/sw_build_and_push_gem.sh +++ b/.github/workflows/script/sw_build_and_push_gem.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + GEM_NAME="$1" cd "instrumentation/$GEM_NAME" || exit 1 @@ -17,9 +19,4 @@ gem_version=$(grep -E "VERSION\s*=\s*'[^']+'" "$found_file" | awk -F "'" '{print gem build "opentelemetry-instrumentation-$GEM_NAME.gemspec" gem push --key github --host https://rubygems.pkg.github.com/solarwinds "opentelemetry-instrumentation-$GEM_NAME-$gem_version.gem" -if [ $? -eq 0 ]; then - echo "Finished" -else - echo "Failed" - exit 1 -fi +echo "Finished"