@@ -11,8 +11,6 @@ pipeline {
11
11
EE_BUILD_TAG = " cb_sg_enterprise"
12
12
SGW_REPO = " github.com/couchbase/sync_gateway"
13
13
GH_ACCESS_TOKEN_CREDENTIAL = " github_cb-robot-sg_access_token"
14
- GO111MODULE = " on"
15
- GOCACHE = " ${ WORKSPACE} /.gocache"
16
14
}
17
15
18
16
tools {
@@ -42,7 +40,7 @@ pipeline {
42
40
sh " which go"
43
41
sh " go version"
44
42
sh " go env"
45
- sshagent(credentials : [' CB SG Robot Github SSH Key ' ]) {
43
+ sshagent(credentials : [' CB_SG_Robot_Github_SSH_Key ' ]) {
46
44
sh '''
47
45
[ -d ~/.ssh ] || mkdir ~/.ssh && chmod 0700 ~/.ssh
48
46
ssh-keyscan -t rsa,dsa github.com >> ~/.ssh/known_hosts
@@ -66,12 +64,6 @@ pipeline {
66
64
67
65
stage(' Builds' ) {
68
66
parallel {
69
- stage(' Test compile' ) {
70
- steps {
71
- // run no tests but force them to be compiled
72
- sh " go test -run=- -count=1 ./..."
73
- }
74
- }
75
67
stage(' CE Linux' ) {
76
68
steps {
77
69
sh " GOOS=linux go build -o sync_gateway_ce-linux -v ${ SGW_REPO} "
@@ -82,38 +74,6 @@ pipeline {
82
74
sh " GOOS=linux go build -o sync_gateway_ee-linux -tags ${ EE_BUILD_TAG} -v ${ SGW_REPO} "
83
75
}
84
76
}
85
- stage(' CE macOS' ) {
86
- // TODO: Remove skip
87
- when { expression { return false } }
88
- steps {
89
- withEnv([" PATH+GO=${ GOPATH} /bin" ]) {
90
- echo ' TODO: figure out why build issues are caused by gosigar'
91
- sh " GOOS=darwin go build -o sync_gateway_ce-darwin -v ${ SGW_REPO} "
92
- }
93
- }
94
- }
95
- stage(' EE macOS' ) {
96
- // TODO: Remove skip
97
- when { expression { return false } }
98
- steps {
99
- withEnv([" PATH+GO=${ GOPATH} /bin" ]) {
100
- echo ' TODO: figure out why build issues are caused by gosigar'
101
- sh " GOOS=darwin go build -o sync_gateway_ee-darwin -tags ${ EE_BUILD_TAG} -v ${ SGW_REPO} "
102
- }
103
- }
104
- }
105
- /* can't build windows with cgo
106
- stage('CE Windows') {
107
- steps {
108
- sh "GOOS=windows go build -o sync_gateway_ce-windows -v ${SGW_REPO}"
109
- }
110
- }
111
- stage('EE Windows') {
112
- steps {
113
- sh "GOOS=windows go build -o sync_gateway_ee-windows -tags ${EE_BUILD_TAG} -v ${SGW_REPO}"
114
- }
115
- }
116
- */
117
77
stage(' Windows Service' ) {
118
78
steps {
119
79
sh " GOOS=windows go build -o sync_gateway_ce-windows-service -v ${ SGW_REPO} /service/sg-windows/sg-service"
@@ -122,68 +82,6 @@ pipeline {
122
82
}
123
83
}
124
84
125
- stage(' Checks' ) {
126
- parallel {
127
- stage(' gofmt' ) {
128
- steps {
129
- script {
130
- try {
131
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-gofmt' , description : ' Running' , status : ' PENDING' )
132
- sh " which gofmt" // check if gofmt is installed
133
- sh " gofmt -d -e . | tee gofmt.out"
134
- sh " test -z \"\$ (cat gofmt.out)\" "
135
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-gofmt' , description : ' OK' , status : ' SUCCESS' )
136
- } catch (Exception e) {
137
- sh " wc -l < gofmt.out | awk '{printf \$ 1}' > gofmt.count"
138
- script {
139
- env. GOFMT_COUNT = readFile ' gofmt.count'
140
- }
141
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-gofmt' , description : " found " + env. GOFMT_COUNT + " problems" , status : ' FAILURE' )
142
- unstable(" gofmt failed" )
143
- }
144
- }
145
- }
146
- }
147
- stage(' go vet' ) {
148
- steps {
149
- warnError(message : " go vet failed" ) {
150
- sh " go vet -tags ${ EE_BUILD_TAG} ./..."
151
- }
152
- }
153
- }
154
- stage(' go fix' ) {
155
- steps {
156
- warnError(message : " go fix failed" ) {
157
- sh " go tool fix -diff . | tee gofix.out"
158
- sh " test -z \"\$ (cat gofix.out)\" "
159
- }
160
- }
161
- }
162
- stage(' errcheck' ) {
163
- steps {
164
- script {
165
- try {
166
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-errcheck' , description : ' Running' , status : ' PENDING' )
167
- withEnv([" PATH+GO=${ env.GOTOOLS} /bin" ]) {
168
- sh " which errcheck" // check if errcheck is installed
169
- sh " errcheck ./... | tee errcheck.out"
170
- }
171
- sh " test -z \"\$ (cat errcheck.out)\" "
172
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-errcheck' , description : ' OK' , status : ' SUCCESS' )
173
- } catch (Exception e) {
174
- sh " wc -l < errcheck.out | awk '{printf \$ 1}' > errcheck.count"
175
- script {
176
- env. ERRCHECK_COUNT = readFile ' errcheck.count'
177
- }
178
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-errcheck' , description : " found " + env. ERRCHECK_COUNT + " unhandled errors" , status : ' FAILURE' )
179
- unstable(" errcheck failed" )
180
- }
181
- }
182
- }
183
- }
184
- }
185
- }
186
-
187
85
stage(' Tests' ) {
188
86
parallel {
189
87
stage(' Unit' ) {
@@ -285,41 +183,6 @@ pipeline {
285
183
}
286
184
}
287
185
}
288
-
289
- stage(' LiteCore' ) {
290
- stages {
291
- stage(' against CE' ) {
292
- // TODO: Remove skip
293
- when { expression { return false } }
294
- steps {
295
- echo ' Example of where we could run an alternate version of lite-core unit tests, or against a running SG CE'
296
- }
297
- }
298
- stage(' against EE' ) {
299
- // CBG-2237 skipping stage due to regular litecore test segfaults
300
- when { expression { return false } }
301
- steps {
302
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-litecore-ee' , description : ' Running LiteCore Tests' , status : ' PENDING' )
303
- sh ' touch verbose_litecore.out'
304
- sh ' touch verbose_litecore-sg_trace.out'
305
- script {
306
- withCredentials([sshUserPrivateKey(credentialsId : ' CB SG Robot Github SSH Key' , keyFileVariable : ' KEY' )]) {
307
- try {
308
- sh ' docker run --rm -v $KEY:/root/.ssh/id_rsa -v `pwd`/sync_gateway_ee-linux:/sync_gateway -v `pwd`/verbose_litecore.out:/output.out -v `pwd`/verbose_litecore-sg_trace.out:/tmp/sglog/sg_trace.log couchbase/sg-test-litecore:latest -legacy-config'
309
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-litecore-ee' , description : ' EE with LiteCore Test Passed' , status : ' SUCCESS' )
310
- } catch (Exception e) {
311
- githubNotify(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , context : ' sgw-pipeline-litecore-ee' , description : ' EE with LiteCore Test Failed' , status : ' FAILURE' )
312
- // archive verbose test logs in the event of a test failure
313
- archiveArtifacts artifacts : ' verbose_litecore*.out' , fingerprint : false
314
- unstable(" EE LIteCore Test Failed" )
315
- }
316
- }
317
- }
318
- }
319
- }
320
- }
321
- }
322
-
323
186
stage(' Integration' ) {
324
187
stages {
325
188
stage(' main' ) {
@@ -328,23 +191,7 @@ pipeline {
328
191
echo ' Queueing Integration test for branch "main" ...'
329
192
// Queues up an async integration test run using default build params (main branch),
330
193
// but waits up to an hour for batches of PR merges before actually running (via quietPeriod)
331
- build job : ' MasterIntegration' , quietPeriod : 3600 , wait : false
332
- }
333
- }
334
-
335
- stage(' PR' ) {
336
- // TODO: Remove skip
337
- when { expression { return false } }
338
- steps {
339
- // TODO: Read labels on PR for 'integration-test'
340
- // if present, run stage as separate GH status
341
- echo ' Example of where we can run integration tests for this commit'
342
- gitStatusWrapper(credentialsId : " ${ GH_ACCESS_TOKEN_CREDENTIAL} " , description : ' Running EE Integration Test' , failureDescription : ' EE Integration Test Failed' , gitHubContext : ' sgw-pipeline-integration-ee' , successDescription : ' EE Integration Test Passed' ) {
343
- echo " Waiting for integration test to finish..."
344
- // TODO: add commit parameter
345
- // Block the pipeline, but don't propagate a failure up to the top-level job - rely on gitStatusWrapper letting us know it failed
346
- build job : ' sync-gateway-integration-master' , wait : true , propagate : false
347
- }
194
+ build job : ' MainIntegration' , quietPeriod : 3600 , wait : false
348
195
}
349
196
}
350
197
}
@@ -397,7 +244,6 @@ pipeline {
397
244
}
398
245
cleanup {
399
246
cleanWs(disableDeferredWipeout : true )
400
- sh " go clean -cache"
401
- }
247
+ }
402
248
}
403
249
}
0 commit comments