forked from storj/storj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile.verify
More file actions
235 lines (219 loc) · 9.47 KB
/
Jenkinsfile.verify
File metadata and controls
235 lines (219 loc) · 9.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
pipeline {
agent {
docker {
label 'main'
image 'storjlabs/ci:latest'
alwaysPull true
args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod -v /tmp/golangci-lint:/root/.cache/golangci-lint -v /tmp/gocache/build:/root/.cache/go-build -v "/tmp/npm":/npm'
}
}
options {
timeout(time: 40, unit: 'MINUTES')
skipDefaultCheckout(true)
}
environment {
NPM_CONFIG_CACHE = '/npm/cache'
GOTRACEBACK = 'all'
COCKROACH_MEMPROF_INTERVAL=0
}
stages {
stage('Checkout') {
steps {
// Delete any content left over from a previous run.
sh "chmod -R 777 ."
// Bash requires extglob option to support !(.git) syntax,
// and we don't want to delete .git to have faster clones.
sh 'bash -O extglob -c "rm -rf !(.git)"'
checkout scm
sh 'mkdir -p .build'
sh 'git restore-mtime'
// download dependencies
sh 'go mod download'
// pre-check that we cannot do at a later stage reliably
sh 'check-large-files'
}
}
stage('Gerrit status') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-trigger-ssh', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
sh './scripts/gerrit-status.sh verify start 0'
}
}
}
stage('Build') {
parallel {
stage('db') {
steps {
dir('.build') {
sh 'cockroach start-single-node --insecure --store=type=mem,size=3GiB --listen-addr=localhost:26256 --http-addr=localhost:8086 --cache 1024MiB --max-sql-memory 1024MiB --background'
}
}
}
}
}
stage('Build Web') {
// The build code depends on the following assets being loaded.
parallel {
stage('web/satellite') {
steps {
sh './web/satellite/build-if-changed.sh'
}
}
stage('wasm') {
steps {
sh './testsuite/wasm/start.sh'
}
}
stage('web/storagenode') {
steps {
sh './web/storagenode/build-if-changed.sh'
}
}
stage('web/multinode') {
steps {
sh './web/multinode/build-if-changed.sh'
}
}
stage('satellite/admin/ui') {
steps {
sh './satellite/admin/ui/build-if-changed.sh'
}
}
}
}
stage('Lint') {
parallel {
stage('Storj Checks') {
steps {
sh 'check-mod-tidy'
sh 'check-copyright'
sh 'check-imports -race ./...'
sh 'check-peer-constraints -race'
sh 'check-atomic-align ./...'
sh 'check-monkit ./...'
sh 'check-errs ./...'
sh 'check-deferloop ./...'
sh 'check-downgrades'
sh 'make check-monitoring'
sh 'make test-wasm-size'
sh './scripts/check-package-lock.sh'
}
}
stage('Staticcheck') {
steps {
sh 'staticcheck ./...'
}
}
stage('Other') {
steps {
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 --timeout=5m run --show-stats --verbose'
sh 'protolock status'
sh 'go vet ./...'
dir("testsuite/storjscan") {
sh 'go vet ./...'
}
}
}
stage('Storage Node 1.20 (Windows)') {
steps {
sh './scripts/generate-gomod-for-storagenode-go1.20.sh go.mod .build/go.storagenode.mod'
sh 'GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC="zig cc -target x86_64-windows-gnu" go.min vet -modfile .build/go.storagenode.mod ./...'
}
}
}
}
stage('Tests') {
environment {
STORJ_TEST_HOST = '127.0.0.20;127.0.0.21;127.0.0.22;127.0.0.23;127.0.0.24;127.0.0.25'
STORJ_TEST_COCKROACH = 'omit'
STORJ_TEST_COCKROACH_NODROP = 'true'
STORJ_TEST_POSTGRES = 'omit'
STORJ_TEST_LOG_LEVEL = 'info'
COVERFLAGS = "${ env.BRANCH_NAME == 'main' ? '-coverprofile=.build/coverprofile -coverpkg=storj.io/storj/private/...,storj.io/storj/satellite/...,storj.io/storj/storagenode/...,storj.io/storj/versioncontrol/...' : ''}"
GOEXPERIMENT = 'nocoverageredesign'
STORJ_TEST_SPANNER = 'spanner://127.0.0.1:9010?emulator|' +
'spanner://127.0.0.1:9011?emulator|' +
'spanner://127.0.0.1:9012?emulator|' +
'spanner://127.0.0.1:9013?emulator|' +
'spanner://127.0.0.1:9014?emulator|' +
'spanner://127.0.0.1:9015?emulator|' +
'spanner://127.0.0.1:9016?emulator'
SPANNER_DISABLE_BUILTIN_METRICS = 'true'
}
steps {
sh '/usr/local/bin/spanner_emulator --host_port 127.0.0.1:9010 &'
sh '/usr/local/bin/spanner_emulator --host_port 127.0.0.1:9011 &'
sh '/usr/local/bin/spanner_emulator --host_port 127.0.0.1:9012 &'
sh '/usr/local/bin/spanner_emulator --host_port 127.0.0.1:9013 &'
sh '/usr/local/bin/spanner_emulator --host_port 127.0.0.1:9014 &'
sh '/usr/local/bin/spanner_emulator --host_port 127.0.0.1:9015 &'
sh '/usr/local/bin/spanner_emulator --host_port 127.0.0.1:9016 &'
sh 'use-ports -from 1024 -to 10000 &'
sh 'go test -parallel 6 -p 12 -vet=off $COVERFLAGS -timeout 32m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml'
}
post {
always {
archiveArtifacts artifacts: '.build/tests.json'
sh script: 'cat .build/tests.json | tparse -all -slow 100', returnStatus: true
junit '.build/tests.xml'
script {
if(fileExists(".build/coverprofile")){
sh script: 'filter-cover-profile < .build/coverprofile > .build/clean.coverprofile', returnStatus: true
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',
lineCoverageTargets: '70, 60, 50',
autoUpdateHealth: false,
autoUpdateStability: false,
failUnhealthy: true
}
}
}
}
}
stage('Satellite UI Tests') {
environment {
STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26256/uitestcockroach?sslmode=disable'
STORJ_TEST_COCKROACH_NODROP = 'true'
STORJ_TEST_POSTGRES = 'omit'
STORJ_TEST_LOG_LEVEL = 'debug'
}
steps {
sh 'cockroach sql --insecure --host=localhost:26256 -e \'create database uitestcockroach;\''
sh 'make test-satellite-ui'
}
post {
failure {
sh script: 'tar -zcvf .build/test-results.tar.gz ./testsuite/playwright-ui/test-results/'
archiveArtifacts artifacts: '.build/test-results.tar.gz'
}
}
}
stage('Post') {
parallel {
stage('Lint') {
steps {
sh 'check-clean-directory'
}
}
}
}
}
post {
success {
withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-trigger-ssh', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
sh './scripts/gerrit-status.sh verify success +1'
}
}
failure {
withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-trigger-ssh', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
sh './scripts/gerrit-status.sh verify failure -1'
}
}
aborted {
withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-trigger-ssh', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
sh './scripts/gerrit-status.sh verify failure -1'
}
}
}
}