From abac9c4321fb68cb2cc296d6b68d08fac1013b4c Mon Sep 17 00:00:00 2001 From: Vineeth Bandi Date: Wed, 17 Jul 2024 10:53:57 -0500 Subject: [PATCH] updated check_upstream_golang.sh to properly set empty variables --- builder-base/scripts/check_upstream_golang.sh | 2 +- eks-distro-base/scripts/check_upstream_golang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builder-base/scripts/check_upstream_golang.sh b/builder-base/scripts/check_upstream_golang.sh index 974499ba1..60a775536 100755 --- a/builder-base/scripts/check_upstream_golang.sh +++ b/builder-base/scripts/check_upstream_golang.sh @@ -60,7 +60,7 @@ ACTIVE_VERSIONS=$(curl https://go.dev/dl/?mode=json | jq -r '.[].version' | sed for version in ${ACTIVE_VERSIONS}; do # pull golang versions in the versions.yaml MAJORVERSION=$(if [[ $(echo "$version" | awk -F'.' '{print NF}') -ge 3 ]]; then echo ${version%.*}; else echo ${version%-*}; fi) - BUILDER_BASE_GO_VERSION=$(cat "${VERSIONS_YAML}" | grep -E "^GOLANG_VERSION_${MAJORVERSION//./}") || "" + BUILDER_BASE_GO_VERSION=$(cat "${VERSIONS_YAML}" | grep -E "^GOLANG_VERSION_${MAJORVERSION//./}") || echo "" # check builder-base versions for the upstream version of golang # if the version doesn't exist in the builder base update the versions yaml. if [[ -n $BUILDER_BASE_GO_VERSION && ! $BUILDER_BASE_GO_VERSION =~ $version ]]; then diff --git a/eks-distro-base/scripts/check_upstream_golang b/eks-distro-base/scripts/check_upstream_golang index a9782b94d..c5a4b22bb 100755 --- a/eks-distro-base/scripts/check_upstream_golang +++ b/eks-distro-base/scripts/check_upstream_golang @@ -41,7 +41,7 @@ ACTIVE_VERSIONS=$(curl https://go.dev/dl/?mode=json | jq -r '.[].version' | sed for version in ${ACTIVE_VERSIONS}; do # pull golang versions in the versions.yaml MAJORVERSION=$(if [[ $(echo "$version" | awk -F'.' '{print NF}') -ge 3 ]]; then echo ${version%.*}; else echo ${version%-*}; fi) - MINIMAL_GO_VERSION=$(cat "${VERSIONS_YAML}" | grep -E "^GOLANG_${MAJORVERSION}_FULL_VERSION") || "" + MINIMAL_GO_VERSION=$(yq ".golang.versions[\"GOLANG_${MAJORVERSION}_FULL_VERSION\"]" "$VERSIONS_YAML" || echo "") # check builder-base versions for the upstream version of golang # if the version doesn't exist in the builder base update the versions yaml. if [[ ! $MINIMAL_GO_VERSION =~ $version ]]; then