Skip to content

Commit b76d18a

Browse files
authored
Ensure Go binary exists before version check (#7059)
A missing Go binary during checking go version can cause script failure. The condition check failed to handle this case because the directory still existed. This patch improves the directory check by directly verifying the existence of `bin/go` to prevent script failure when retrieving go version. Signed-off-by: Shuyang Xin <[email protected]>
1 parent d82a0b6 commit b76d18a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ci/jenkins/utils.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function check_and_upgrade_golang() {
4444
while read -r i; do
4545
version=$(echo ${i} | jq .version | tr -d '"')
4646
if [[ "${version}" =~ "${antrea_golang_version}" ]]; then
47-
if [ -d "${GOLANG_RELEASE_DIR}/${antrea_golang_version}" ]; then
47+
if [ -f "${GOLANG_RELEASE_DIR}/${antrea_golang_version}/bin/go" ]; then
4848
current_version=$(${GOLANG_RELEASE_DIR}/${antrea_golang_version}/bin/go version | awk '{print $3}')
4949
if [[ "${version}" == "${current_version}" ]]; then
5050
echo "====== Golang ${version} is installed on the testbed, no need to download ======"

0 commit comments

Comments
 (0)