-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jenkins pipeline with parallel cigroups #45285
Merged
spalger
merged 49 commits into
elastic:master
from
brianseeders:jenkins-pipeline-cigroups-parallel
Sep 11, 2019
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
148b8c0
Revert "Revert "Revert "[ci] compress jobs for CI stability" (#44584)""
brianseeders 8dcfb29
Pipeline
brianseeders eee98f5
WIP some work for parallelization with ciGroups
brianseeders a4e0c50
Fix xpack kibana install dir, and add some debugging
brianseeders 742d70d
Attempt to quick fix a few tests
brianseeders 1ade439
Recombine test groups, and try runbld again
brianseeders 73af6da
Mostly cleanup, and fix failed_tests reporting to hopefully work for …
brianseeders fd89471
Fix typo in shell script
brianseeders 3c21164
Remove some debug code
brianseeders 6bf5a3b
Add support for changing es transport.port during testing via TEST_ES…
brianseeders 4cd06c1
Fix test that uses hard-coded es transport port and add it back in to…
brianseeders b65de1a
Disable checks reporter again for now
brianseeders 11b41c4
Set env var for TEST_ES_TRANSPORT_PORT in pipeline
brianseeders dbe0d39
Update Jenkinsfile for shorter testrunner labels
brianseeders 4c1503a
Fix another hard-coded transport port
brianseeders a7a8e58
Fix a new test with hard-coded URLs
brianseeders 0253cc6
Jenkinsfile cleanup and fix one of the groups
brianseeders c2902df
Fix double slash
brianseeders e8afca9
Testing vault credentials on jenkins server
brianseeders 6f0792d
Add a non-existent credential
brianseeders 12ce5df
Revert "Add a non-existent credential"
brianseeders bfc36f2
Try github-checks-reporter again
brianseeders 6e99023
github-checks-reporter should only run for elastic/kibana, forks won'…
brianseeders c921b81
Clean up some debug code
brianseeders 061c778
Changing names around to try to make BlueOcean UI a little better
brianseeders ab13cea
Add more stages
brianseeders a848186
Make some changes to stage structure to mirror a nested example from …
brianseeders 2c003a9
Handle TODOs, and some cleanup in Jenkinsfile
brianseeders d0bee6b
Pass GIT_BRANCH when started without GHPRB, fix branch check
brianseeders 740bebe
Fix mailer problem and add code that ensures all tests are in cigroup…
brianseeders 14db0f4
Test adding worker/job name to junit report paths
brianseeders d58b7b9
Remove some duplication from ci_setup scripts
brianseeders 63f80c6
Fix unit test that uses junit path
brianseeders 9c10400
Don't reinstall node every time setup_env is run
brianseeders 6a0dc7a
Fix yarn install logic
brianseeders 763ea65
Fix another unit test that uses junit output dir
brianseeders 60717cf
Download latest ES snapshot after kibana builds
brianseeders b653fdc
Make sure junit reports are always processed
brianseeders 26e55aa
Add two failing tests for testing purposes
brianseeders d4e2cf3
Add support to Jenkinsfile for kibana build e-mails
brianseeders a4cf81c
Remove some debug code for email sending
brianseeders 8979151
Change JOB env handling in junit paths and move it to a sub-directory
brianseeders f7c02e3
Revert "Add two failing tests for testing purposes"
brianseeders 0a6acc8
Fix junit report path in test
brianseeders 2a6a838
Don't send kibana emails on build abort
brianseeders e0944a7
Address PR feedback, formatting and use built-in url formatting library
brianseeders 3523893
Fix path formatting for functional test
brianseeders 496ba75
Add email sending back in to Jenkinsfile
brianseeders 3253cee
Fix another unit test with path problem
brianseeders File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
JOB: | ||
- intake | ||
- firefoxSmoke | ||
- kibana-intake | ||
- x-pack-intake | ||
- kibana-firefoxSmoke | ||
- kibana-ciGroup1 | ||
- kibana-ciGroup2 | ||
- kibana-ciGroup3 | ||
- kibana-ciGroup4 | ||
- kibana-ciGroup5 | ||
- kibana-ciGroup6 | ||
# - kibana-visualRegression | ||
- kibana-ciGroup7 | ||
- kibana-ciGroup8 | ||
- kibana-ciGroup9 | ||
- kibana-ciGroup10 | ||
- kibana-ciGroup11 | ||
- kibana-ciGroup12 | ||
- kibana-visualRegression | ||
|
||
# make sure all x-pack-ciGroups are listed in test/scripts/jenkins_xpack_ci_group.sh | ||
- x-pack-firefoxSmoke | ||
- x-pack-ciGroup1 | ||
- x-pack-ciGroup2 | ||
- x-pack-ciGroup3 | ||
- x-pack-ciGroup4 | ||
- x-pack-ciGroup5 | ||
# - x-pack-visualRegression | ||
- x-pack-ciGroup6 | ||
- x-pack-ciGroup7 | ||
- x-pack-ciGroup8 | ||
- x-pack-ciGroup9 | ||
- x-pack-ciGroup10 | ||
- x-pack-visualRegression | ||
|
||
# `~` is yaml for `null` | ||
exclude: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
#!/bin/groovy | ||
|
||
properties([ | ||
durabilityHint('PERFORMANCE_OPTIMIZED'), | ||
]) | ||
|
||
stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a little bit | ||
timeout(time: 180, unit: 'MINUTES') { | ||
timestamps { | ||
ansiColor('xterm') { | ||
catchError { | ||
parallel([ | ||
'kibana-intake-agent': legacyJobRunner('kibana-intake'), | ||
'x-pack-intake-agent': legacyJobRunner('x-pack-intake'), | ||
'kibana-oss-agent': withWorkers('kibana-oss-tests', { buildOss() }, [ | ||
'oss-ciGroup1': getOssCiGroupWorker(1), | ||
'oss-ciGroup2': getOssCiGroupWorker(2), | ||
'oss-ciGroup3': getOssCiGroupWorker(3), | ||
'oss-ciGroup4': getOssCiGroupWorker(4), | ||
'oss-ciGroup5': getOssCiGroupWorker(5), | ||
'oss-ciGroup6': getOssCiGroupWorker(6), | ||
'oss-ciGroup7': getOssCiGroupWorker(7), | ||
'oss-ciGroup8': getOssCiGroupWorker(8), | ||
'oss-ciGroup9': getOssCiGroupWorker(9), | ||
'oss-ciGroup10': getOssCiGroupWorker(10), | ||
'oss-ciGroup11': getOssCiGroupWorker(11), | ||
'oss-ciGroup12': getOssCiGroupWorker(12), | ||
'oss-visualRegression': getPostBuildWorker('visualRegression', { runbld './test/scripts/jenkins_visual_regression.sh' }), | ||
'oss-firefoxSmoke': getPostBuildWorker('firefoxSmoke', { runbld './test/scripts/jenkins_firefox_smoke.sh' }), | ||
]), | ||
'kibana-xpack-agent': withWorkers('kibana-xpack-tests', { buildXpack() }, [ | ||
'xpack-ciGroup1': getXpackCiGroupWorker(1), | ||
'xpack-ciGroup2': getXpackCiGroupWorker(2), | ||
'xpack-ciGroup3': getXpackCiGroupWorker(3), | ||
'xpack-ciGroup4': getXpackCiGroupWorker(4), | ||
'xpack-ciGroup5': getXpackCiGroupWorker(5), | ||
'xpack-ciGroup6': getXpackCiGroupWorker(6), | ||
'xpack-ciGroup7': getXpackCiGroupWorker(7), | ||
'xpack-ciGroup8': getXpackCiGroupWorker(8), | ||
'xpack-ciGroup9': getXpackCiGroupWorker(9), | ||
'xpack-ciGroup10': getXpackCiGroupWorker(10), | ||
'xpack-firefoxSmoke': getPostBuildWorker('xpack-firefoxSmoke', { runbld './test/scripts/jenkins_xpack_firefox_smoke.sh' }), | ||
'xpack-visualRegression': getPostBuildWorker('xpack-visualRegression', { runbld './test/scripts/jenkins_xpack_visual_regression.sh' }), | ||
]), | ||
]) | ||
} | ||
node('flyweight') { | ||
sendMail() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def withWorkers(name, preWorkerClosure = {}, workerClosures = [:]) { | ||
return { | ||
jobRunner('tests-xl') { | ||
try { | ||
doSetup() | ||
preWorkerClosure() | ||
|
||
def nextWorker = 1 | ||
def worker = { workerClosure -> | ||
def workerNumber = nextWorker | ||
nextWorker++ | ||
|
||
return { | ||
workerClosure(workerNumber) | ||
} | ||
} | ||
|
||
def workers = [:] | ||
workerClosures.each { workerName, workerClosure -> | ||
workers[workerName] = worker(workerClosure) | ||
} | ||
|
||
parallel(workers) | ||
} finally { | ||
catchError { | ||
uploadAllGcsArtifacts(name) | ||
} | ||
|
||
catchError { | ||
publishJunit() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def getPostBuildWorker(name, closure) { | ||
return { workerNumber -> | ||
def kibanaPort = "61${workerNumber}1" | ||
def esPort = "61${workerNumber}2" | ||
def esTransportPort = "61${workerNumber}3" | ||
|
||
withEnv([ | ||
"CI_WORKER_NUMBER=${workerNumber}", | ||
"TEST_KIBANA_HOST=localhost", | ||
"TEST_KIBANA_PORT=${kibanaPort}", | ||
"TEST_KIBANA_URL=http://elastic:changeme@localhost:${kibanaPort}", | ||
"TEST_ES_URL=http://elastic:changeme@localhost:${esPort}", | ||
"TEST_ES_TRANSPORT_PORT=${esTransportPort}", | ||
"IS_PIPELINE_JOB=1", | ||
]) { | ||
closure() | ||
} | ||
} | ||
} | ||
|
||
def getOssCiGroupWorker(ciGroup) { | ||
return getPostBuildWorker("ciGroup" + ciGroup, { | ||
withEnv([ | ||
"CI_GROUP=${ciGroup}", | ||
"JOB=kibana-ciGroup${ciGroup}", | ||
]) { | ||
runbld "./test/scripts/jenkins_ci_group.sh" | ||
} | ||
}) | ||
} | ||
|
||
def getXpackCiGroupWorker(ciGroup) { | ||
return getPostBuildWorker("xpack-ciGroup" + ciGroup, { | ||
withEnv([ | ||
"CI_GROUP=${ciGroup}", | ||
"JOB=xpack-kibana-ciGroup${ciGroup}", | ||
]) { | ||
runbld "./test/scripts/jenkins_xpack_ci_group.sh" | ||
} | ||
}) | ||
} | ||
|
||
def legacyJobRunner(name) { | ||
return { | ||
parallel([ | ||
"${name}": { | ||
withEnv([ | ||
"JOB=${name}", | ||
]) { | ||
jobRunner('linux && immutable') { | ||
try { | ||
runbld '.ci/run.sh' | ||
} finally { | ||
catchError { | ||
uploadAllGcsArtifacts(name) | ||
} | ||
catchError { | ||
publishJunit() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
]) | ||
} | ||
} | ||
|
||
def jobRunner(label, closure) { | ||
node(label) { | ||
def scmVars = checkout scm | ||
|
||
withEnv([ | ||
"CI=true", | ||
"HOME=${env.JENKINS_HOME}", | ||
"PR_SOURCE_BRANCH=${env.ghprbSourceBranch}", | ||
"PR_TARGET_BRANCH=${env.ghprbTargetBranch}", | ||
"PR_AUTHOR=${env.ghprbPullAuthorLogin}", | ||
"TEST_BROWSER_HEADLESS=1", | ||
"GIT_BRANCH=${scmVars.GIT_BRANCH}", | ||
]) { | ||
withCredentials([ | ||
string(credentialsId: 'vault-addr', variable: 'VAULT_ADDR'), | ||
string(credentialsId: 'vault-role-id', variable: 'VAULT_ROLE_ID'), | ||
string(credentialsId: 'vault-secret-id', variable: 'VAULT_SECRET_ID'), | ||
]) { | ||
// scm is configured to check out to the ./kibana directory | ||
dir('kibana') { | ||
closure() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// TODO what should happen if GCS, Junit, or email publishing fails? Unstable build? Failed build? | ||
|
||
def uploadGcsArtifact(workerName, pattern) { | ||
def storageLocation = "gs://kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/${workerName}" // TODO | ||
// def storageLocation = "gs://kibana-pipeline-testing/jobs/pipeline-test/${BUILD_NUMBER}/${workerName}" | ||
|
||
googleStorageUpload( | ||
credentialsId: 'kibana-ci-gcs-plugin', | ||
bucket: storageLocation, | ||
pattern: pattern, | ||
sharedPublicly: true, | ||
showInline: true, | ||
) | ||
} | ||
|
||
def uploadAllGcsArtifacts(workerName) { | ||
def ARTIFACT_PATTERNS = [ | ||
'target/kibana-*', | ||
'target/junit/**/*', | ||
'test/**/screenshots/**/*.png', | ||
'test/functional/failure_debug/html/*.html', | ||
'x-pack/test/**/screenshots/**/*.png', | ||
'x-pack/test/functional/failure_debug/html/*.html', | ||
'x-pack/test/functional/apps/reporting/reports/session/*.pdf', | ||
] | ||
|
||
ARTIFACT_PATTERNS.each { pattern -> | ||
uploadGcsArtifact(workerName, pattern) | ||
} | ||
} | ||
|
||
def publishJunit() { | ||
junit(testResults: 'target/junit/**/*.xml', allowEmptyResults: true, keepLongStdio: true) | ||
} | ||
|
||
def sendMail() { | ||
sendInfraMail() | ||
sendKibanaMail() | ||
} | ||
|
||
def sendInfraMail() { | ||
catchError { | ||
step([ | ||
$class: 'Mailer', | ||
notifyEveryUnstableBuild: true, | ||
recipients: '[email protected]', | ||
sendToIndividuals: false | ||
]) | ||
} | ||
} | ||
|
||
def sendKibanaMail() { | ||
catchError { | ||
if(params.NOTIFY_ON_FAILURE && currentBuild.result != 'SUCCESS' && currentBuild.result != 'ABORTED') { | ||
emailext( | ||
// to: '[email protected]', | ||
to: '[email protected]', // TODO switch this out after testing | ||
subject: "${env.PROJECT_NAME} - Build # ${env.BUILD_NUMBER} - ${currentBuild.result}", | ||
body: '${SCRIPT,template="groovy-html.template"}', | ||
mimeType: 'text/html', | ||
) | ||
} | ||
} | ||
} | ||
|
||
def runbld(script) { | ||
sh '#!/usr/local/bin/runbld\n' + script | ||
} | ||
|
||
def bash(script) { | ||
sh "#!/bin/bash -x\n${script}" | ||
} | ||
|
||
def doSetup() { | ||
runbld "./test/scripts/jenkins_setup.sh" | ||
} | ||
|
||
def buildOss() { | ||
runbld "./test/scripts/jenkins_build_kibana.sh" | ||
} | ||
|
||
def buildXpack() { | ||
runbld "./test/scripts/jenkins_xpack_build_kibana.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if infra still wants these emails.