ci(jenkins): avoid using the any agent to skip running in the master-worker
#!/usr/bin/env groovy
-
@Library('apm@current') _
+import groovy.transform.Field
+
+/**
+This is the git commit sha which it's required to be used in different stages.
+It does store the env GIT_SHA
+*/
+@Field def gitCommit
+
pipeline {
- agent any
+ agent none
environment {
REPO = 'apm-agent-java'
BASE_DIR = "src/github.com/elastic/${env.REPO}"
@@ -55,6 +62,9 @@ pipeline {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true)
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
+ script {
+ gitCommit = env.GIT_SHA
+ }
}
}
/**
@@ -276,10 +286,10 @@ pipeline {
log(level: 'INFO', text: 'Launching Async ITs')
build(job: env.ITS_PIPELINE, propagate: false, wait: false,
parameters: [string(name: 'AGENT_INTEGRATION_TEST', value: 'Java'),
- string(name: 'BUILD_OPTS', value: "--java-agent-version ${env.GIT_BASE_COMMIT}"),
+ string(name: 'BUILD_OPTS', value: "--java-agent-version ${gitCommit}"),
string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_ITS_NAME),
string(name: 'GITHUB_CHECK_REPO', value: env.REPO),
- string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT)])
+ string(name: 'GITHUB_CHECK_SHA1', value: gitCommit)])
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('/','+')}")
}
}
