From 1cd13adc1c2b73b0b3baa4c286b0b32c85e7c526 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Wed, 9 Jun 2021 14:50:57 +0300 Subject: [PATCH] ci: clearer initial build We can run a lot of the code building and downloading steps in parallel. We were using Makefile, however, that doesn't integrate with Jenkins, which means, when there's a failure, you have no clue where. This separates the concurrent build steps and makes it clear what we are running concurrently. Change-Id: I1c1dccd09dab67d2ef428a58d5eb9e004b11a74c --- Jenkinsfile.public | 107 +++++++++++++++++++++++++++++++++------------ 1 file changed, 78 insertions(+), 29 deletions(-) diff --git a/Jenkinsfile.public b/Jenkinsfile.public index 7bd8096e3..d0ff17bd2 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -15,29 +15,81 @@ pipeline { COCKROACH_MEMPROF_INTERVAL=0 } stages { - stage('Build') { + stage('Checkout') { steps { checkout scm - sh 'mkdir -p .build' - // make a backup of the mod file in case, for later linting sh 'cp go.mod .build/go.mod.orig' - // download dependencies sh 'go mod download' + } + } + stage('Build') { + parallel { + stage('go') { + steps { + sh 'go build -v ./...' + } + } + stage('go -race') { + steps { + sh 'go build -v -race ./...' - sh 'service postgresql start' + // install storj-sim + sh 'go install -race -v storj.io/storj/cmd/satellite '+ + 'storj.io/storj/cmd/storagenode ' + + 'storj.io/storj/cmd/storj-sim ' + + 'storj.io/storj/cmd/versioncontrol ' + + 'storj.io/storj/cmd/uplink ' + + 'storj.io/storj/cmd/identity ' + + 'storj.io/storj/cmd/certificates ' + + 'storj.io/storj/cmd/multinode' + } + } + stage('go -race gateway') { + steps { + // install gateway for storj-sim + sh 'go install -race -v storj.io/gateway@latest' + } + } - sh 'make -j4 build-packages' - sh 'make install-sim' + stage('db') { + steps { + sh 'service postgresql start' + dir('.build') { + sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26256 --http-addr=localhost:8086 --cache 512MiB --max-sql-memory 512MiB --background' + sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26257 --http-addr=localhost:8087 --cache 512MiB --max-sql-memory 512MiB --background' + sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26258 --http-addr=localhost:8088 --cache 512MiB --max-sql-memory 512MiB --background' + sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26259 --http-addr=localhost:8089 --cache 512MiB --max-sql-memory 512MiB --background' + sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26260 --http-addr=localhost:8090 --cache 256MiB --max-sql-memory 256MiB --background' + } + } + } - dir(".build") { - sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26256 --http-addr=localhost:8086 --cache 512MiB --max-sql-memory 512MiB --background' - sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26257 --http-addr=localhost:8087 --cache 512MiB --max-sql-memory 512MiB --background' - sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26258 --http-addr=localhost:8088 --cache 512MiB --max-sql-memory 512MiB --background' - sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26259 --http-addr=localhost:8089 --cache 512MiB --max-sql-memory 512MiB --background' - sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26260 --http-addr=localhost:8090 --cache 256MiB --max-sql-memory 256MiB --background' + stage('web/satellite') { + steps { + dir('web/satellite') { + sh 'npm ci --prefer-offline --no-audit' + sh 'npm run build' + } + } + } + stage('web/storagenode') { + steps { + dir('web/storagenode') { + sh 'npm ci --prefer-offline --no-audit' + sh 'npm run build' + } + } + } + stage('web/multinode') { + steps { + dir('web/multinode') { + sh 'npm ci --prefer-offline --no-audit' + sh 'npm run build' + } + } } } } @@ -204,17 +256,6 @@ pipeline { } } - stage('satellite npm') { - steps { - dir("web/satellite") { - sh 'npm run build' - sh 'npm run lint' - sh script: 'npm audit', returnStatus: true - sh 'npm run test' - } - } - } - stage('wasm npm') { steps { dir(".build") { @@ -225,10 +266,9 @@ pipeline { } } - stage('storagenode npm') { + stage('web/satellite') { steps { - dir("web/storagenode") { - sh 'npm run build' + dir("web/satellite") { sh 'npm run lint' sh script: 'npm audit', returnStatus: true sh 'npm run test' @@ -236,10 +276,19 @@ pipeline { } } - stage('multinode npm') { + stage('web/storagenode') { + steps { + dir("web/storagenode") { + sh 'npm run lint' + sh script: 'npm audit', returnStatus: true + sh 'npm run test' + } + } + } + + stage('web/multinode') { steps { dir("web/multinode") { - sh 'npm run build' sh 'npm run lint' sh script: 'npm audit', returnStatus: true sh 'npm run test'