Skip to content

Commit

Permalink
add Jenkins options to avoid runaways and weird errors due to clobber… (
Browse files Browse the repository at this point in the history
#182)

* Add Jenkins options to avoid runaways and multiple jobs

Signed-off-by: Jeff Ng <[email protected]>
  • Loading branch information
jeffng-or authored Oct 28, 2024
1 parent d502c9f commit 227f253
Showing 1 changed file with 39 additions and 36 deletions.
75 changes: 39 additions & 36 deletions jenkins/public_build.Jenkinsfile
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");
}
}
}

0 comments on commit 227f253

Please sign in to comment.