Skip to content

Commit

Permalink
update CI script
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed Sep 24, 2024
1 parent 8b988f9 commit d460158
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions tools/check_go_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,9 @@ if [ -z "${GO_MOD_VERSION}" ]; then
exit 1
fi

# ci workflows excluding upgrade/downgrade tests
TPL_GO_VERSIONS="$(find .github/workflows test/templates -type f \( -name '*.yml' -o -name '*.tpl' \) \
! -name 'upgrade_downgrade_test*.yml' \
-exec awk '/go-version: /{print $(NF-0)}' {} + | sort -u)"
TPL_GO_VERSIONS_COUNT=$(echo "$TPL_GO_VERSIONS" | wc -l | tr -d [:space:])
if [ "${TPL_GO_VERSIONS_COUNT}" -gt 1 ]; then
echo -e "expected a consistent 'go-version:' in CI workflow files/templates, found versions:\n${TPL_GO_VERSIONS}"
exit 1
fi
TPL_GO_VERSION="${TPL_GO_VERSIONS}"
if [[ ! "${TPL_GO_VERSION}" =~ "${GO_MOD_VERSION}" ]]; then
echo "expected go-version in test/templates/* to be equal to go.mod: '${TPL_GO_VERSION}' != '${GO_MOD_VERSION}'"
exit 1
fi

# docker/bootstrap/Dockerfile.common
BOOTSTRAP_GO_VERSION="$(awk -F ':' '/golang:/{print $(NF-0)}' docker/bootstrap/Dockerfile.common | cut -d- -f1)"
if [[ ! "${BOOTSTRAP_GO_VERSION}" =~ "${GO_MOD_VERSION}" ]]; then
echo "expected golang docker version in docker/bootstrap/Dockerfile.common to be equal to go.mod: '${TPL_GO_VERSION}' != '${GO_MOD_VERSION}'"
exit 1
elif [ "${TPL_GO_VERSION}" != "${BOOTSTRAP_GO_VERSION}" ]; then
echo "expected equal go version in CI workflow files/templates and bootstrap Dockerfile: '${TPL_GO_VERSIONS}' != '${BOOTSTRAP_GO_VERSION}'"
exit 1
fi
fi

0 comments on commit d460158

Please sign in to comment.