X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;f=jjb%2Foransc%2Fverify-jobs-go.sh;h=84b3f5a090a64a53a512a5a373c7f9d3ce26d558;hb=2857436ff58d0549e0c794ca9db51e9738ca9aa6;hp=10f809cb5b8122df15340b1c911c4024c3df5a5e;hpb=c04abcac21c7b472aff425f43e4f7c2321ad6a6b;p=infra%2Fcicd.git diff --git a/jjb/oransc/verify-jobs-go.sh b/jjb/oransc/verify-jobs-go.sh index 10f809cb..84b3f5a0 100644 --- a/jjb/oransc/verify-jobs-go.sh +++ b/jjb/oransc/verify-jobs-go.sh @@ -2,29 +2,19 @@ set -euo pipefail -DIRECTORY = $WORKSPACE"/"$DIRECTORY +DIRECTORY=$WORKSPACE"/"${DIRECTORY} cd $DIRECTORY # Read desired Go version from go.mod file desired_version=$(grep '^go' go.mod | grep -Eo '[0-9]\.[0-9]+') -# Check installed Go version -installed_version=$(go version | awk '{print $3}' | sed 's/go//') +# Remove existing Go installation +sudo rm -fr /usr/local/go -if [ "$desired_version" != "$installed_version" ]; then - echo "Desired Go version: $desired_version" - echo "Installed Go version: $installed_version" +echo "Download go $desired_version" +curl -L "https://go.dev/dl/go$desired_version.linux-amd64.tar.gz" | sudo tar -C /usr/local -zxf - - # Remove existing Go installation - sudo rm -fr /usr/local/go - - echo "Download go $desired_version" - curl -L "https://go.dev/dl/go$desired_version.linux-amd64.tar.gz" | sudo tar -C /usr/local -zxf - - - export PATH=$PATH:/usr/local/go/bin -else - echo "Go version is up to date: $desired_version" -fi +export PATH=$PATH:/usr/local/go/bin echo "Download project deps" go mod tidy