-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathJenkinsfile
More file actions
233 lines (211 loc) · 9.65 KB
/
Jenkinsfile
File metadata and controls
233 lines (211 loc) · 9.65 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
pipeline {
agent none
options {
timeout(time: 60, unit: 'MINUTES')
skipDefaultCheckout(true)
}
environment {
GOTRACEBACK = 'all'
// COCKROACH_MEMPROF_INTERVAL = 0
// ^ doesn't work: https://github.com/cockroachdb/cockroach/issues/54793
}
stages {
stage('Build') {
agent {
docker {
label 'main'
image 'storjlabs/ci:latest'
alwaysPull true
args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod'
}
}
stages {
stage('Preparation') {
steps {
// extglob lets !(.git) work; dotglob includes dotfiles.
sh 'bash -O extglob -O dotglob -c "rm -rf !(.git|.|..)"'
checkout scm
sh 'git restore-mtime'
sh 'go mod download'
dir('testsuite') {
sh 'go mod download'
}
sh 'mkdir -p .build'
// go-junit-report isn't baked into storjlabs/ci yet.
sh 'go install github.com/jstemmer/go-junit-report/v2@v2.1.0'
}
}
stage('Verification') {
parallel {
stage('Lint') {
environment {
GOLANGCI_LINT_CONFIG = '/go/ci/.golangci.yml'
GOLANGCI_LINT_CONFIG_TESTSUITE = '/go/ci/.golangci.yml'
}
steps {
sh 'make lint'
}
}
stage('Vet') {
steps {
sh 'make vet'
}
}
stage('Test') {
environment {
JSON = true
SHORT = true
SKIP_TESTSUITE = true
STORJ_TEST_COCKROACH = 'omit'
STORJ_TEST_POSTGRES = 'omit'
STORJ_TEST_SPANNER = 'run:/usr/local/bin/spanner_emulator --override_change_stream_partition_token_alive_seconds=1'
STORJ_TEST_LOG_LEVEL = 'info'
STORJ_HASHSTORE_TABLE_DEFAULT_KIND = 'memtbl'
SPANNER_DISABLE_BUILTIN_METRICS = 'true'
GOOGLE_CLOUD_SPANNER_DISABLE_LOG_CLIENT_OPTIONS = 'true'
}
steps {
sh 'make test 2>&1 | tee .build/tests.json | go-junit-report -parser gojson -out .build/tests.xml'
}
post {
always {
sh script: 'tparse -all -slow 100 -file .build/tests.json', returnStatus: true
archiveArtifacts artifacts: '.build/tests.json'
junit '.build/tests.xml'
}
}
}
stage('Testsuite') {
environment {
JSON = true
SHORT = false
STORJ_TEST_COCKROACH = 'omit'
STORJ_TEST_POSTGRES = 'omit'
STORJ_TEST_SPANNER = 'run:/usr/local/bin/spanner_emulator --override_change_stream_partition_token_alive_seconds=1'
STORJ_TEST_LOG_LEVEL = 'info'
STORJ_HASHSTORE_TABLE_DEFAULT_KIND = 'memtbl'
SPANNER_DISABLE_BUILTIN_METRICS = 'true'
GOOGLE_CLOUD_SPANNER_DISABLE_LOG_CLIENT_OPTIONS = 'true'
STORJ_TEST_GCSTEST_BUCKET = 'gcstest-ci'
STORJ_TEST_GCSTEST_PATH_TO_JSON_KEY = credentials('gcstest-ci')
}
steps {
// Exhaust ports 1024-10000 so tests fail loudly if they hard-code one.
sh 'use-ports -from 1024 -to 10000 &'
sh 'make test-testsuite 2>&1 | tee .build/testsuite.json | go-junit-report -parser gojson -out .build/testsuite.xml'
}
post {
always {
sh script: 'tparse -all -slow 100 -file .build/testsuite.json', returnStatus: true
archiveArtifacts artifacts: '.build/testsuite.json'
junit '.build/testsuite.xml'
}
}
}
}
}
stage('Post-lint') {
steps {
sh 'check-clean-directory'
}
}
}
post {
always {
sh 'bash -O extglob -O dotglob -c "rm -rf !(.git|.|..)"'
}
}
}
stage('Integration') {
agent {
node {
label 'ondemand'
}
}
stages {
stage('Checkout') {
steps {
// delete any content leftover from a previous run.
// bash requires the extglob option to support !(.git)
// syntax, and we don't want to delete .git to have
// faster clones.
sh 'bash -O extglob -O dotglob -c "rm -rf !(.git|.|..)"'
checkout scm
// install storj-up dependency
sh 'go install storj.io/storj-up@main'
}
}
stage('Start environment') {
steps {
sh 'make integration-env-start'
}
}
stage('Test') {
steps {
script {
def tests = [:]
tests['ceph-tests'] = {
stage('ceph-tests') {
sh 'make integration-ceph-tests'
}
}
// todo(sean): figure out why duplicity fails on gateway-mt, but not gateway-st.
['awscli', 'awscli_multipart', /*'duplicity',*/ 'duplicati', 'https', 'rclone'].each { test ->
tests["gateway-st-test ${test}"] = {
stage("gateway-st-test ${test}") {
sh "TEST=${test} make integration-gateway-st-tests"
}
}
}
tests['gateway-st-test s3fs'] = {
stage('gateway-st-test s3fs') {
sh 'make integration-gateway-st-tests-s3fs'
}
}
['aws-sdk-go', 'aws-sdk-java', 'awscli', 'minio-go', 's3cmd', 's3select'].each { test ->
tests["mint-test ${test}"] = {
stage("mint-test ${test}") {
sh "TEST=${test} make integration-mint-tests"
}
}
}
parallel tests
}
}
}
// We run aws-sdk-php and aws-sdk-ruby tests sequentially because
// each of them contains a test that lists buckets and interferes
// with other tests that run in parallel.
//
// TODO: run each Mint test with different credentials.
stage('mint-test aws-sdk-php') {
steps {
sh 'TEST=aws-sdk-php make integration-mint-tests'
}
}
stage('mint-test aws-sdk-ruby') {
steps {
sh 'TEST=aws-sdk-ruby make integration-mint-tests'
}
}
}
post {
always {
junit 'gateway-st/.build/ceph.xml'
catchError {
script {
if(fileExists('gateway-st/.build/rclone-integration-tests')) {
zip zipFile: 'rclone-integration-tests.zip', archive: true, dir: 'gateway-st/.build/rclone-integration-tests'
archiveArtifacts artifacts: 'rclone-integration-tests.zip'
}
}
}
catchError {
sh 'make integration-env-purge'
}
sh 'bash -O extglob -O dotglob -c "rm -rf !(.git|.|..)"'
}
}
}
}
}