@@ -8,15 +8,13 @@ pipeline {
8
8
BASE_DIR = " src/github.com/elastic/${ env.REPO} "
9
9
PIPELINE_LOG_LEVEL = ' INFO'
10
10
JOB_GCS_BUCKET = credentials(' gcs-bucket' )
11
- GITHUB_CHECK_ITS_NAME = ' Integration Tests'
12
- ITS_PIPELINE = ' apm-integration-tests-selector-mbp/main'
13
11
GITHUB_CHECK = ' true'
14
12
RELEASE_URL_MESSAGE = " (<https://github.com/elastic/${ env.REPO} /releases/tag/${ env.TAG_NAME} |${ env.TAG_NAME} >)"
15
13
SLACK_CHANNEL = ' #apm-agent-node'
16
14
17
15
NPMRC_SECRET = ' secret/jenkins-ci/npmjs/elasticmachine'
18
16
TOTP_SECRET = ' totp/code/npmjs-elasticmachine'
19
- BUILD_NODE_VERSION = ' v16.15.0 '
17
+ BUILD_NODE_VERSION = ' v16.15.1 '
20
18
DOCKER_REGISTRY = ' docker.elastic.co'
21
19
DOCKER_SECRET = ' secret/apm-team/ci/docker-registry/prod'
22
20
}
@@ -92,7 +90,7 @@ pipeline {
92
90
def parallelTasks = [:]
93
91
node[' NODEJS_VERSION' ]. each{ version ->
94
92
parallelTasks[" Node.js-${ version} " ] = generateStep(version : version)
95
- parallelTasks[" Node.js-${ version} -async-hooks-false " ] = generateStep(version : version, disableAsyncHooks : true )
93
+ parallelTasks[" Node.js-${ version} -noasynchooks " ] = generateStep(version : version, disableAsyncHooks : true )
96
94
// TODO: to be enabled if required.
97
95
// parallelTasks["Windows-Node.js-${version}"] = generateStepForWindows(version: version)
98
96
}
@@ -193,18 +191,18 @@ pipeline {
193
191
}
194
192
}
195
193
}
196
- stage(' Nightly Test - No async hooks ' ) {
194
+ stage(' Nightly Test - noasynchooks ' ) {
197
195
agent { label ' linux && immutable' }
198
196
steps {
199
- withGithubNotify(context : ' Nightly No Async Hooks Test' , tab : ' tests' ) {
197
+ withGithubNotify(context : ' Nightly noasynchooks Test' , tab : ' tests' ) {
200
198
deleteDir()
201
199
unstash ' source'
202
200
dir(" ${ BASE_DIR} " ){
203
201
script {
204
202
def node = readYaml(file : ' .ci/.jenkins_nightly_nodejs.yml' )
205
203
def parallelTasks = [:]
206
204
node[' NODEJS_VERSION' ]. each { version ->
207
- parallelTasks[" Node.js-${ version} -nightly-no-async-hooks " ] = generateStep(version : version, buildType : ' nightly' , disableAsyncHooks : true )
205
+ parallelTasks[" Node.js-${ version} -nightly-noasynchooks " ] = generateStep(version : version, buildType : ' nightly' , disableAsyncHooks : true )
208
206
}
209
207
parallel(parallelTasks)
210
208
}
@@ -231,18 +229,18 @@ pipeline {
231
229
}
232
230
}
233
231
}
234
- stage(' RC Test - No async hooks ' ) {
232
+ stage(' RC Test - noasynchooks ' ) {
235
233
agent { label ' linux && immutable' }
236
234
steps {
237
- withGithubNotify(context : ' RC No Async Hooks Test' , tab : ' tests' ) {
235
+ withGithubNotify(context : ' RC noasynchooks Test' , tab : ' tests' ) {
238
236
deleteDir()
239
237
unstash ' source'
240
238
dir(" ${ BASE_DIR} " ){
241
239
script {
242
240
def node = readYaml(file : ' .ci/.jenkins_rc_nodejs.yml' )
243
241
def parallelTasks = [:]
244
242
node[' NODEJS_VERSION' ]. each { version ->
245
- parallelTasks[" Node.js-${ version} -rc-no-async-hooks " ] = generateStep(version : version, buildType : ' rc' , disableAsyncHooks : true )
243
+ parallelTasks[" Node.js-${ version} -rc-noasynchooks " ] = generateStep(version : version, buildType : ' rc' , disableAsyncHooks : true )
246
244
}
247
245
parallel(parallelTasks)
248
246
}
@@ -252,29 +250,39 @@ pipeline {
252
250
}
253
251
}
254
252
}
255
- stage( ' Integration Tests ' ) {
256
- agent none
257
- when {
258
- beforeAgent true
259
- allOf {
260
- not { tag pattern : ' v \\ d+ \\ . \\ d+ \\ . \\ d+ ' , comparator : ' REGEXP ' }
261
- expression { return env . ONLY_DOCS == " false " }
262
- anyOf {
263
- changeRequest()
264
- expression { return ! params.Run_As_Main_Branch }
265
- }
266
- }
253
+
254
+ /**
255
+ Publish a snapshot. A "snapshot" is a packaging of the latest *unreleased* APM agent,
256
+ published to a known GCS bucket for use in edge demo/test environments.
257
+ */
258
+ stage( ' Publish snapshot ' ) {
259
+ options { skipDefaultCheckout() }
260
+ environment {
261
+ BUCKET_NAME = ' oblt-artifacts '
262
+ DOCKER_REGISTRY = ' docker.elastic.co '
263
+ DOCKER_REGISTRY_SECRET = ' secret/observability-team/ci/docker-registry/prod '
264
+ GCS_ACCOUNT_SECRET = ' secret/observability-team/ci/snapshoty '
267
265
}
266
+ when { branch ' main' }
268
267
steps {
269
- build(job : env. ITS_PIPELINE , propagate : false , wait : false ,
270
- parameters : [string(name : ' INTEGRATION_TEST' , value : ' Node.js' ),
271
- string(name : ' BUILD_OPTS' , value : " --nodejs-agent-package ${ env.CHANGE_FORK?.trim() ?: 'elastic' } /${ env.REPO} #${ env.GIT_BASE_COMMIT} --opbeans-node-agent-branch ${ env.GIT_BASE_COMMIT} " ),
272
- string(name : ' GITHUB_CHECK_NAME' , value : env. GITHUB_CHECK_ITS_NAME ),
273
- string(name : ' GITHUB_CHECK_REPO' , value : env. REPO ),
274
- string(name : ' GITHUB_CHECK_SHA1' , value : env. GIT_BASE_COMMIT )])
275
- githubNotify(context : " ${ env.GITHUB_CHECK_ITS_NAME} " , description : " ${ env.GITHUB_CHECK_ITS_NAME} ..." , status : ' PENDING' , targetUrl : " ${ env.JENKINS_URL} search/?q=${ env.ITS_PIPELINE.replaceAll('/','+')} " )
268
+ withGithubNotify(context : ' Publish snapshot packages' ) {
269
+ deleteDir()
270
+ unstash name : ' source'
271
+ withNodeJSEnv(version : env. BUILD_NODE_VERSION ) {
272
+ dir(env. BASE_DIR ) {
273
+ sh(label : ' package snapshot' , script : ' npm run package:snapshot' )
274
+ snapshoty(
275
+ bucket : env. BUCKET_NAME ,
276
+ gcsAccountSecret : env. GCS_ACCOUNT_SECRET ,
277
+ dockerRegistry : env. DOCKER_REGISTRY ,
278
+ dockerSecret : env. DOCKER_REGISTRY_SECRET
279
+ )
280
+ }
281
+ }
282
+ }
276
283
}
277
284
}
285
+
278
286
stage(' Release' ) {
279
287
options { skipDefaultCheckout() }
280
288
when {
@@ -371,7 +379,7 @@ pipeline {
371
379
The result JSON files are also archive into Jenkins.
372
380
*/
373
381
stage(' Benchmarks' ) {
374
- agent { label ' metal ' }
382
+ agent { label ' microbenchmarks-pool ' }
375
383
options { skipDefaultCheckout() }
376
384
environment {
377
385
HOME = " ${ env.WORKSPACE} "
@@ -424,22 +432,23 @@ def generateStep(Map params = [:]){
424
432
def version = params?. version
425
433
def tav = params. containsKey(' tav' ) ? params. tav : ' '
426
434
def buildType = params. containsKey(' buildType' ) ? params. buildType : ' release'
427
- def ELASTIC_APM_ASYNC_HOOKS = String . valueOf( ! params. get(' disableAsyncHooks' , false ))
435
+ def contextManager = params. get(' disableAsyncHooks' , false ) ? ' patch ' : ' '
428
436
return {
429
437
withNode(labels : ' linux && immutable' , forceWorkspace : true , forceWorker : true ) {
430
- withEnv([" VERSION=${ version} " , " ELASTIC_APM_ASYNC_HOOKS =${ ELASTIC_APM_ASYNC_HOOKS } " ]) {
438
+ withEnv([" VERSION=${ version} " , " ELASTIC_APM_CONTEXT_MANAGER =${ contextManager } " ]) {
431
439
deleteDir()
432
440
unstash ' source'
433
- dir(" ${ BASE_DIR} " ){
434
- try {
435
- retryWithSleep(retries : 2 , seconds : 5 , backoff : true ) {
436
- sh(label : " Run Tests" , script : """ .ci/scripts/test.sh -b "${ buildType} " -t "${ tav} " "${ version} " """ )
441
+ // Grab the current docker context for helping to troubleshoot the docker containers using filebeat and metricbeat
442
+ dockerContext(filebeatOutput : " docker-${ version} -${ buildType} .log" , metricbeatOutput : " docker-${ version} -${ buildType} -metricbeat.log" , archiveOnlyOnFail : true ){
443
+ dir(" ${ BASE_DIR} " ){
444
+ try {
445
+ retryWithSleep(retries : 2 , seconds : 5 , backoff : true ) {
446
+ sh(label : " Run Tests" , script : """ .ci/scripts/test.sh -b "${ buildType} " -t "${ tav} " "${ version} " """ )
447
+ }
448
+ } finally {
449
+ junit(testResults : " test_output/*.junit.xml" , allowEmptyResults : true , keepLongStdio : true )
450
+ archiveArtifacts(artifacts : " test_output/*.tap" , allowEmptyArchive : true )
437
451
}
438
- } catch (e){
439
- error(e. toString())
440
- } finally {
441
- junit(testResults : " test_output/*.junit.xml" , allowEmptyResults : true , keepLongStdio : true )
442
- archiveArtifacts(artifacts : " test_output/*.tap" , allowEmptyArchive : true )
443
452
}
444
453
}
445
454
}
@@ -516,15 +525,15 @@ def getSmartTAVContext() {
516
525
517
526
def generateStepForWindows (Map params = [:]){
518
527
def version = params?. version
519
- def ELASTIC_APM_ASYNC_HOOKS = String . valueOf( ! params. get(' disableAsyncHooks' , false ))
528
+ def contextManager = params. get(' disableAsyncHooks' , false ) ? ' patch ' : ' '
520
529
return {
521
530
sh label : ' Prepare services' , script : " .ci/scripts/windows/prepare-test.sh ${ version} "
522
531
def linuxIp = grabWorkerIP()
523
532
withNode(labels : ' windows-2019-docker-immutable' , forceWorkspace : true , forceWorker : true ) {
524
533
// When installing with choco the PATH might not be updated within the already connected worker.
525
534
withEnv([" PATH=${ PATH} ;C:\\ Program Files\\ nodejs" ,
526
535
" VERSION=${ version} " ,
527
- " ELASTIC_APM_ASYNC_HOOKS =${ ELASTIC_APM_ASYNC_HOOKS } " ,
536
+ " ELASTIC_APM_CONTEXT_MANAGER =${ contextManager } " ,
528
537
" CASSANDRA_HOST=${ linuxIp} " ,
529
538
" ES_HOST=${ linuxIp} " ,
530
539
" LOCALSTACK_HOST=${ linuxIp} " ,
0 commit comments