2019-04-22 14:45:53 +01:00
|
|
|
pipeline {
|
|
|
|
agent {
|
2019-12-16 15:25:12 +00:00
|
|
|
docker {
|
2019-06-19 20:56:52 +01:00
|
|
|
label 'main'
|
2020-01-06 14:01:46 +00:00
|
|
|
image docker.build("storj-ci", "--pull https://github.com/storj/ci.git").id
|
2019-12-16 15:25:12 +00:00
|
|
|
args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod -v "/tmp/npm":/tmp/npm'
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
}
|
2019-05-02 16:48:04 +01:00
|
|
|
options {
|
2019-09-20 15:44:43 +01:00
|
|
|
timeout(time: 26, unit: 'MINUTES')
|
2019-05-02 16:48:04 +01:00
|
|
|
}
|
2019-09-05 14:32:46 +01:00
|
|
|
environment {
|
|
|
|
NPM_CONFIG_CACHE = '/tmp/npm/cache'
|
|
|
|
}
|
2019-04-22 14:45:53 +01:00
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
2019-04-24 16:33:01 +01:00
|
|
|
|
2019-06-27 17:09:37 +01:00
|
|
|
sh 'mkdir -p .build'
|
2019-04-24 16:33:01 +01:00
|
|
|
|
|
|
|
// make a backup of the mod file in case, for later linting
|
|
|
|
sh 'cp go.mod .build/go.mod.orig'
|
2019-10-11 15:30:06 +01:00
|
|
|
|
2019-04-24 16:33:01 +01:00
|
|
|
// download dependencies
|
2019-04-22 14:45:53 +01:00
|
|
|
sh 'go mod download'
|
|
|
|
|
2019-10-11 15:30:06 +01:00
|
|
|
sh 'service postgresql start'
|
|
|
|
|
2019-09-05 14:32:46 +01:00
|
|
|
sh 'make -j3 build-packages'
|
2019-04-22 14:45:53 +01:00
|
|
|
sh 'make install-sim'
|
2019-11-22 19:59:46 +00:00
|
|
|
|
2019-12-30 12:22:53 +00:00
|
|
|
sh 'cockroach start-single-node --insecure --store=\'/tmp/crdb\' --listen-addr=localhost:26257 --http-addr=localhost:8080 --cache 512MiB --max-sql-memory 512MiB --background'
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-11 15:30:06 +01:00
|
|
|
|
2019-04-22 14:45:53 +01:00
|
|
|
stage('Verification') {
|
|
|
|
parallel {
|
|
|
|
stage('Lint') {
|
|
|
|
steps {
|
2019-12-16 15:25:12 +00:00
|
|
|
sh 'check-copyright'
|
|
|
|
sh 'check-large-files'
|
|
|
|
sh 'check-imports -race ./...'
|
|
|
|
sh 'check-peer-constraints -race'
|
|
|
|
sh 'check-atomic-align ./...'
|
|
|
|
sh 'check-errs ./...'
|
2019-04-22 14:45:53 +01:00
|
|
|
sh 'bash ./scripts/check-dbx-version.sh'
|
2019-11-14 08:31:30 +00:00
|
|
|
sh 'staticcheck ./...'
|
2019-12-16 15:25:12 +00:00
|
|
|
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run'
|
|
|
|
sh 'check-mod-tidy -mod .build/go.mod.orig'
|
2019-06-04 18:12:27 +01:00
|
|
|
sh 'make check-satellite-config-lock'
|
2019-10-15 18:00:14 +01:00
|
|
|
sh 'make check-monitoring'
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Tests') {
|
|
|
|
environment {
|
2019-12-10 16:32:54 +00:00
|
|
|
STORJ_COCKROACH_TEST = 'cockroach://root@localhost:26257/testcockroach?sslmode=disable'
|
2019-04-22 14:45:53 +01:00
|
|
|
STORJ_POSTGRES_TEST = 'postgres://postgres@localhost/teststorj?sslmode=disable'
|
2019-12-30 12:22:53 +00:00
|
|
|
COVERFLAGS = "${ env.BRANCH_NAME != 'master' ? '' : '-coverprofile=.build/coverprofile -coverpkg=storj.io/storj/private/...,storj.io/storj/lib/...,storj.io/storj/pkg/...,storj.io/storj/satellite/...,storj.io/storj/storage/...,storj.io/storj/storagenode/...,storj.io/storj/uplink/...,storj.io/storj/versioncontrol/...'}"
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
steps {
|
2019-12-10 16:32:54 +00:00
|
|
|
sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach;\''
|
2019-04-22 14:45:53 +01:00
|
|
|
sh 'psql -U postgres -c \'create database teststorj;\''
|
2019-12-16 15:25:12 +00:00
|
|
|
sh 'use-ports -from 1024 -to 10000 &'
|
|
|
|
sh 'go test -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 20m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml'
|
|
|
|
sh 'check-clean-directory'
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
always {
|
2019-04-24 16:33:01 +01:00
|
|
|
sh script: 'cat .build/tests.json | tparse -all -top -slow 100', returnStatus: true
|
|
|
|
archiveArtifacts artifacts: '.build/tests.json'
|
|
|
|
junit '.build/tests.xml'
|
2019-04-26 14:39:11 +01:00
|
|
|
|
|
|
|
script {
|
|
|
|
if(fileExists(".build/coverprofile")){
|
2019-12-16 15:25:12 +00:00
|
|
|
sh script: 'filter-cover-profile < .build/coverprofile > .build/clean.coverprofile', returnStatus: true
|
2019-04-26 14:39:11 +01:00
|
|
|
sh script: 'gocov convert .build/clean.coverprofile > .build/cover.json', returnStatus: true
|
|
|
|
sh script: 'gocov-xml < .build/cover.json > .build/cobertura.xml', returnStatus: true
|
|
|
|
cobertura coberturaReportFile: '.build/cobertura.xml'
|
|
|
|
}
|
|
|
|
}
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Integration') {
|
|
|
|
environment {
|
|
|
|
// use different hostname to avoid port conflicts
|
|
|
|
STORJ_NETWORK_HOST4 = '127.0.0.2'
|
|
|
|
STORJ_NETWORK_HOST6 = '127.0.0.2'
|
2019-05-14 16:13:18 +01:00
|
|
|
|
|
|
|
STORJ_SIM_POSTGRES = 'postgres://postgres@localhost/teststorj2?sslmode=disable'
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
steps {
|
2019-05-14 16:13:18 +01:00
|
|
|
sh 'psql -U postgres -c \'create database teststorj2;\''
|
2019-04-22 14:45:53 +01:00
|
|
|
sh 'make test-sim'
|
2019-09-25 16:16:11 +01:00
|
|
|
// sh 'make test-certificates' // flaky
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
}
|
2019-08-14 16:34:12 +01:00
|
|
|
|
2019-12-10 19:18:02 +00:00
|
|
|
stage('Cockroach Integration') {
|
2019-08-14 16:34:12 +01:00
|
|
|
environment {
|
2019-12-10 19:18:02 +00:00
|
|
|
STORJ_NETWORK_HOST4 = '127.0.0.4'
|
|
|
|
STORJ_NETWORK_HOST6 = '127.0.0.4'
|
2019-08-18 15:51:33 +01:00
|
|
|
|
2019-12-10 19:18:02 +00:00
|
|
|
STORJ_SIM_POSTGRES = 'cockroach://root@localhost:26257/testcockroach4?sslmode=disable'
|
2019-08-14 16:34:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
steps {
|
2019-12-10 19:18:02 +00:00
|
|
|
sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach4;\''
|
|
|
|
sh 'make test-sim'
|
2019-08-14 16:34:12 +01:00
|
|
|
}
|
|
|
|
}
|
2019-09-05 14:32:46 +01:00
|
|
|
|
2019-12-10 19:18:02 +00:00
|
|
|
stage('Backwards Compatibility') {
|
2019-11-22 19:59:46 +00:00
|
|
|
environment {
|
2019-12-10 19:18:02 +00:00
|
|
|
STORJ_NETWORK_HOST4 = '127.0.0.3'
|
|
|
|
STORJ_NETWORK_HOST6 = '127.0.0.3'
|
|
|
|
|
|
|
|
STORJ_SIM_POSTGRES = 'postgres://postgres@localhost/teststorj3?sslmode=disable'
|
2019-11-22 19:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
steps {
|
2019-12-10 19:18:02 +00:00
|
|
|
sh 'psql -U postgres -c \'create database teststorj3;\''
|
|
|
|
sh 'make test-sim-backwards-compatible'
|
2019-11-22 19:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-30 12:27:28 +00:00
|
|
|
stage('Build [gomobile]') {
|
|
|
|
steps {
|
|
|
|
// just to verify its building with recent changes
|
2019-11-01 15:42:07 +00:00
|
|
|
sh '(cd .build && ./../lib/uplink-gomobile/build.sh)'
|
2019-10-30 12:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-05 14:32:46 +01:00
|
|
|
stage('npm') {
|
|
|
|
steps {
|
|
|
|
dir("web/satellite") {
|
|
|
|
sh 'npm run build'
|
|
|
|
sh 'npm run lint'
|
|
|
|
// TODO: reenable with vue4
|
|
|
|
sh script: 'npm audit', returnStatus: true
|
|
|
|
sh 'npm run test'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
always {
|
2019-04-24 16:33:01 +01:00
|
|
|
sh "chmod -R 777 ." // ensure Jenkins agent can delete the working directory
|
|
|
|
deleteDir()
|
2019-04-22 14:45:53 +01:00
|
|
|
}
|
|
|
|
}
|
2019-05-09 06:40:00 +01:00
|
|
|
}
|