From 6657cc2d334a56cb59f73f5259a4c62c709bb5c0 Mon Sep 17 00:00:00 2001 From: "alvarez.mauriciotm@gmail.com" Date: Fri, 7 Feb 2025 14:40:06 -0800 Subject: [PATCH] errors out of sh script --- scripts/get-version-matrix.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/get-version-matrix.sh b/scripts/get-version-matrix.sh index b0f5edac7..d09c157f4 100755 --- a/scripts/get-version-matrix.sh +++ b/scripts/get-version-matrix.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 @@ -14,4 +15,12 @@ function get_latest_version() { fi } -echo "matrix=[$(get_latest_version v1.0), $(get_latest_version v1.3), $(get_latest_version v1.5), $(get_latest_version v1.7), $(get_latest_version v1.9)]" >> "$GITHUB_OUTPUT" +# Call get_latest_version for each version and handle errors +v1_0=$(get_latest_version v1.0) || exit 1 +v1_3=$(get_latest_version v1.3) || exit 1 +v1_5=$(get_latest_version v1.5) || exit 1 +v1_7=$(get_latest_version v1.7) || exit 1 +v1_9=$(get_latest_version v1.9) || exit 1 + +# Construct the matrix +echo "matrix=[$v1_0, $v1_3, $v1_5, $v1_7, $v1_9]" \ No newline at end of file