-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Jenkins options to avoid runaways and weird errors due to clobber… (
#182) * Add Jenkins options to avoid runaways and multiple jobs Signed-off-by: Jeff Ng <[email protected]>
- Loading branch information
Showing
1 changed file
with
39 additions
and
36 deletions.
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,43 +1,46 @@ | ||
@Library('[email protected]') _ | ||
|
||
// kick off worker using megaboom cloud definition | ||
node('gce-megaboom-central1') { | ||
properties([copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME)]); | ||
|
||
// checkout megaboom and apply PR | ||
stage('Checkout Megaboom') { | ||
checkout([ | ||
$class: 'GitSCM', | ||
branches: [[name: scm.branches[0].name]], | ||
extensions: [ | ||
[$class: 'CloneOption', noTags: false], | ||
], | ||
userRemoteConfigs: scm.userRemoteConfigs | ||
]); | ||
def description = sh(script: "git log -1 --pretty=%B", returnStdout: true).trim(); | ||
if (description.contains('ci') && description.contains('skip')) { | ||
currentBuild.result = 'SKIPPED'; // 'SUCCESS', 'SKIPPED' | ||
return; | ||
// Prevent builds stomping on each other and set a timeout to avoid runaways | ||
timeout(time: 72, unit: 'HOURS') { | ||
node('gce-megaboom-central1') { | ||
properties([copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME), | ||
disableConcurrentBuilds(abortPrevious: true)]); | ||
|
||
// checkout megaboom and apply PR | ||
stage('Checkout Megaboom') { | ||
checkout([ | ||
$class: 'GitSCM', | ||
branches: [[name: scm.branches[0].name]], | ||
extensions: [ | ||
[$class: 'CloneOption', noTags: false], | ||
], | ||
userRemoteConfigs: scm.userRemoteConfigs | ||
]); | ||
def description = sh(script: "git log -1 --pretty=%B", returnStdout: true).trim(); | ||
if (description.contains('ci') && description.contains('skip')) { | ||
currentBuild.result = 'SKIPPED'; // 'SUCCESS', 'SKIPPED' | ||
return; | ||
} | ||
} | ||
} | ||
|
||
def DOCKER_IMAGE; | ||
|
||
// Run docker build for machine image | ||
stage('Build and Push Docker Machine Image') { | ||
DOCKER_IMAGE = dockerPush('ubuntu22.04', 'megaboom'); | ||
echo "Docker image is $DOCKER_IMAGE"; | ||
} | ||
|
||
// execute bazel to build BoomTile through grt stage | ||
stage('Build Megaboom') { | ||
buildMegaboom(DOCKER_IMAGE); | ||
} | ||
|
||
// TODO Add some smoke tests | ||
|
||
stage ('Cleanup and Reporting') { | ||
finalReport(DOCKER_IMAGE, "megaboom"); | ||
def DOCKER_IMAGE; | ||
|
||
// Run docker build for machine image | ||
stage('Build and Push Docker Machine Image') { | ||
DOCKER_IMAGE = dockerPush('ubuntu22.04', 'megaboom'); | ||
echo "Docker image is $DOCKER_IMAGE"; | ||
} | ||
|
||
// execute bazel to build BoomTile through grt stage | ||
stage('Build Megaboom') { | ||
buildMegaboom(DOCKER_IMAGE); | ||
} | ||
|
||
// TODO Add some smoke tests | ||
|
||
stage ('Cleanup and Reporting') { | ||
finalReport(DOCKER_IMAGE, "megaboom"); | ||
} | ||
} | ||
} | ||
|