From 8ef03b0967f03eac21cf8eee7f1c00c17f27d97a Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Thu, 23 Sep 2021 13:48:20 +0300 Subject: [PATCH] ci: cleanup ws before build, fix gateway install Jenkins uses the same folder for different PR-s. Sometimes other runs do not cleanup after themselves (e.g. timeout), hence add a cleanWs step to ensure we delete files in the workspace. gateway-st introduced a replace directive in go.mod, which does not work with go install. Hardcode to the last version without the directive. Using this fix to unblock ci builds. Change-Id: I5e5d75bf47e30a5a8b6d835867c0c9176f25e08a --- Jenkinsfile.public | 10 ++++++++-- Makefile | 2 +- scripts/test-sim-backwards.sh | 1 + .../tests/rollingupgrade/test-sim-rolling-upgrade.sh | 2 +- scripts/tests/testversions/test-sim-versions.sh | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile.public b/Jenkinsfile.public index 1a77b7732..8f47511e5 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -8,7 +8,8 @@ pipeline { } } options { - timeout(time: 36, unit: 'MINUTES') + timeout(time: 36, unit: 'MINUTES') + skipDefaultCheckout(true) } environment { NPM_CONFIG_CACHE = '/npm/cache' @@ -18,6 +19,11 @@ pipeline { stages { stage('Checkout') { steps { + cleanWs( + deleteDirs: true, + disableDeferredWipeout: true, + ) + checkout scm sh 'mkdir -p .build' @@ -64,7 +70,7 @@ pipeline { stage('go -race gateway') { steps { // install gateway for storj-sim - sh 'go install -race -v storj.io/gateway@latest' + sh 'go install -race -v storj.io/gateway@5da0ff79b964560906bab67ce6f1eb16b89a93de' } } diff --git a/Makefile b/Makefile index 7beaa631c..9c905ed49 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ install-sim: ## install storj-sim ## install exact version of storj/gateway ## TODO replace 'main' with 'latest' when gateway with multipart will be released - go install -race -v storj.io/gateway@main + go install -race -v storj.io/gateway@5da0ff79b964560906bab67ce6f1eb16b89a93de ##@ Test diff --git a/scripts/test-sim-backwards.sh b/scripts/test-sim-backwards.sh index b46096be3..288c99a5a 100755 --- a/scripts/test-sim-backwards.sh +++ b/scripts/test-sim-backwards.sh @@ -68,6 +68,7 @@ EOF SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +sed -i -e 's#storj.io/gateway@main#storj.io/gateway@5da0ff79b964560906bab67ce6f1eb16b89a93de#g' "$RELEASE_DIR"/Makefile GOBIN="$RELEASE_DIR"/bin make -C "$RELEASE_DIR" install-sim GOBIN="$BRANCH_DIR"/bin make -C "$BRANCH_DIR" install-sim diff --git a/scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh b/scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh index ee4af6523..2dce5a48a 100755 --- a/scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh +++ b/scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh @@ -118,7 +118,7 @@ install_sim(){ mkdir -p .build/gateway-tmp pushd .build/gateway-tmp ## TODO replace 'main' with 'latest' when gateway with multipart will be released - go mod init gatewaybuild && GOBIN=${bin_dir} GO111MODULE=on go get storj.io/gateway@main + go mod init gatewaybuild && GOBIN=${bin_dir} GO111MODULE=on go get storj.io/gateway@5da0ff79b964560906bab67ce6f1eb16b89a93de popd fi diff --git a/scripts/tests/testversions/test-sim-versions.sh b/scripts/tests/testversions/test-sim-versions.sh index 1cdb05ac2..8c6939b55 100755 --- a/scripts/tests/testversions/test-sim-versions.sh +++ b/scripts/tests/testversions/test-sim-versions.sh @@ -93,7 +93,7 @@ install_sim(){ else mkdir -p ${work_dir}/build/gateway-tmp ## TODO replace 'main' with 'latest' when gateway with multipart will be released - (cd ${work_dir}/build/gateway-tmp && go mod init gatewaybuild && GOBIN=${bin_dir} GO111MODULE=on go get storj.io/gateway@main;) + (cd ${work_dir}/build/gateway-tmp && go mod init gatewaybuild && GOBIN=${bin_dir} GO111MODULE=on go get storj.io/gateway@5da0ff79b964560906bab67ce6f1eb16b89a93de;) rm -rf ${work_dir}/build/gateway-tmp fi if [ -d "${work_dir}/cmd/multinode" ]; then