ci: fixes for new Go version

We need to make exceptions for older uplink versions, because it does
not compile with newer Go versions due to quic dependency.

Change-Id: I3e073694f0942029c56740f0689088058ee068c3
This commit is contained in:
Egon Elbre 2022-11-01 16:24:31 +02:00
parent 5e5d6ecf6c
commit 947cdf0fb4
4 changed files with 20 additions and 6 deletions

4
Jenkinsfile vendored
View File

@ -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

View File

@ -1,4 +1,4 @@
GO_VERSION ?= 1.17.12
GO_VERSION ?= 1.18.8
GOOS ?= linux
GOARCH ?= amd64
GOPATH ?= $(shell go env GOPATH)

View File

@ -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})

View File

@ -34,7 +34,7 @@ setup(){
random_bytes_file () {
size=$1
output=$2
head -c $size </dev/urandom > $output
head -c $size </dev/urandom > $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)