ci(jenkins): trigger async ITs and update github check for the pull requests
pipeline {
agent any
environment {
- BASE_DIR="src/github.com/elastic/apm-agent-java"
+ REPO = 'apm-agent-java'
+ BASE_DIR = "src/github.com/elastic/${env.REPO}"
NOTIFY_TO = credentials('notify-to')
JOB_GCS_BUCKET = credentials('gcs-bucket')
DOCKERHUB_SECRET = 'secret/apm-team/ci/elastic-observability-dockerhub'
CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-java-codecov'
+ GITHUB_CHECK_ITS_NAME = 'Integration Tests'
+ ITS_PIPELINE = 'apm-integration-tests-selector-mbp/master'
}
options {
timeout(time: 1, unit: 'HOURS')
@@ -279,6 +282,28 @@ pipeline {
}
}
}
+ stage('Integration Tests') {
+ agent none
+ when {
+ beforeAgent true
+ allOf {
+ anyOf {
+ environment name: 'GIT_BUILD_CAUSE', value: 'pr'
+ expression { return !params.Run_As_Master_Branch }
+ }
+ }
+ }
+ steps {
+ 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: '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)])
+ 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('/','+')}")
+ }
+ }
}
post {
success {
@@ -301,5 +326,5 @@ def reportTestResults(){
junit(allowEmptyResults: true,
keepLongStdio: true,
testResults: "${BASE_DIR}/**/junit-*.xml,${BASE_DIR}/**/TEST-*.xml")
- codecov(repo: 'apm-agent-java', basedir: "${BASE_DIR}", secret: "${CODECOV_SECRET}")
+ codecov(repo: env.REPO, basedir: "${BASE_DIR}", secret: "${CODECOV_SECRET}")
}
