diff --git a/Jenkinsfile b/Jenkinsfile index ced1c6b98..bed5a8e0d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,7 +32,7 @@ node('node') { sh 'docker exec postgres-$BUILD_NUMBER createdb -U postgres teststorj' // fetch the remote main branch sh 'git fetch --no-tags --progress -- https://github.com/storj/storj.git +refs/heads/main:refs/remotes/origin/main' - sh 'docker run -u $(id -u):$(id -g) --rm -i -v $PWD:$PWD -w $PWD --entrypoint $PWD/scripts/tests/testversions/test-sim-versions.sh -e STORJ_SIM_POSTGRES -e STORJ_SIM_REDIS --link redis-$BUILD_NUMBER:redis --link postgres-$BUILD_NUMBER:postgres -e CC=gcc storjlabs/golang:1.16.12' + sh 'docker run -u $(id -u):$(id -g) --rm -i -v $PWD:$PWD -w $PWD --entrypoint $PWD/scripts/tests/testversions/test-sim-versions.sh -e STORJ_SIM_POSTGRES -e STORJ_SIM_REDIS --link redis-$BUILD_NUMBER:redis --link postgres-$BUILD_NUMBER:postgres -e CC=gcc storjlabs/golang:1.18.8' } catch(err){ throw err @@ -69,7 +69,7 @@ node('node') { sh 'docker exec postgres-$BUILD_NUMBER createdb -U postgres teststorj' // fetch the remote main branch sh 'git fetch --no-tags --progress -- https://github.com/storj/storj.git +refs/heads/main:refs/remotes/origin/main' - sh 'docker run -u $(id -u):$(id -g) --rm -i -v $PWD:$PWD -w $PWD --entrypoint $PWD/scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh -e BRANCH_NAME -e STORJ_SIM_POSTGRES -e STORJ_SIM_REDIS -e STORJ_MIGRATION_DB --link redis-$BUILD_NUMBER:redis --link postgres-$BUILD_NUMBER:postgres -e CC=gcc storjlabs/golang:1.16.12' + sh 'docker run -u $(id -u):$(id -g) --rm -i -v $PWD:$PWD -w $PWD --entrypoint $PWD/scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh -e BRANCH_NAME -e STORJ_SIM_POSTGRES -e STORJ_SIM_REDIS -e STORJ_MIGRATION_DB --link redis-$BUILD_NUMBER:redis --link postgres-$BUILD_NUMBER:postgres -e CC=gcc storjlabs/golang:1.18.8' } catch(err){ throw err diff --git a/Makefile b/Makefile index 60d350054..08baaf4e8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -GO_VERSION ?= 1.17.12 +GO_VERSION ?= 1.18.8 GOOS ?= linux GOARCH ?= amd64 GOPATH ?= $(shell go env GOPATH) diff --git a/scripts/tests/testversions/test-sim-versions.sh b/scripts/tests/testversions/test-sim-versions.sh index f7b076f35..99baf4196 100755 --- a/scripts/tests/testversions/test-sim-versions.sh +++ b/scripts/tests/testversions/test-sim-versions.sh @@ -3,6 +3,12 @@ set -ueo pipefail set -x +if ! command -v go1.16.15 &> /dev/null +then + echo "Installing old Go version" + go install golang.org/dl/go1.16.15@latest && go1.16.15 download +fi + cleanup(){ ret=$? echo "EXIT STATUS: $ret" @@ -20,6 +26,11 @@ populate_sno_versions(){ seq $number_of_nodes | xargs -n1 -I{} echo $version } +# version_ge returns true if version $1 is greater than or equal to $2 +version_ge(){ + [ "$( ( echo "$1"; echo "$2" ) | sort -V | head -n 1 )" = "$2" ] +} + # set this var to anything else than `jenkins` to run tests locally RUN_TYPE=${RUN_TYPE:-"jenkins"} @@ -207,7 +218,6 @@ for version in ${unique_versions}; do if [[ $version = $current_release_version || $version = "main" ]] then - echo "Installing storj-sim for ${version} in ${dir}." install_sim ${dir} ${bin_dir} echo "finished installing" @@ -225,7 +235,11 @@ for version in ${unique_versions}; do pushd ${dir} mkdir -p ${bin_dir} - go build -race -v -o ${bin_dir}/uplink storj.io/storj/cmd/uplink >/dev/null 2>&1 + if version_ge "$version" "v1.64.0"; then + go build -race -v -o ${bin_dir}/uplink storj.io/storj/cmd/uplink >/dev/null 2>&1 + else + go1.16.15 build -race -v -o ${bin_dir}/uplink storj.io/storj/cmd/uplink >/dev/null 2>&1 + fi popd echo "Finished installing. ${bin_dir}:" $(ls ${bin_dir}) diff --git a/scripts/tests/testversions/test-versions.sh b/scripts/tests/testversions/test-versions.sh index c15a373c3..355bfa23d 100755 --- a/scripts/tests/testversions/test-versions.sh +++ b/scripts/tests/testversions/test-versions.sh @@ -34,7 +34,7 @@ setup(){ random_bytes_file () { size=$1 output=$2 - head -c $size $output + head -c $size $output } random_bytes_file "2KiB" "$test_files_dir/small-upload-testfile" # create 2kb file of random bytes (inline) random_bytes_file "5KiB" "$test_files_dir/big-upload-testfile" # create 5kb file of random bytes (remote)