From 017a2da73e17457c630c71bf19b0f7f00e3bc055 Mon Sep 17 00:00:00 2001 From: Jeff Ng Date: Mon, 28 Oct 2024 11:36:27 -0700 Subject: [PATCH 1/3] add Jenkins options to avoid runaways and weird errors due to clobbered jobs Signed-off-by: Jeff Ng --- jenkins/public_build.Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jenkins/public_build.Jenkinsfile b/jenkins/public_build.Jenkinsfile index 513dba3..2e399ec 100644 --- a/jenkins/public_build.Jenkinsfile +++ b/jenkins/public_build.Jenkinsfile @@ -1,5 +1,12 @@ @Library('utils@orfs-v2.2.2') _ + +// Prevent builds stomping on each other and set a timeout to avoid runaways +options { + disableConcurrentBuilds(abortPrevious: true), + timeout(time: 72, unit: 'HOURS') +} + // kick off worker using megaboom cloud definition node('gce-megaboom-central1') { properties([copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME)]); From 96e95b37184005af4a27ceb3ad34907be86b62a4 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Mon, 28 Oct 2024 16:31:22 -0300 Subject: [PATCH 2/3] ci: fix syntax Signed-off-by: Vitor Bandeira --- jenkins/public_build.Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins/public_build.Jenkinsfile b/jenkins/public_build.Jenkinsfile index 2e399ec..256fd14 100644 --- a/jenkins/public_build.Jenkinsfile +++ b/jenkins/public_build.Jenkinsfile @@ -3,8 +3,8 @@ // Prevent builds stomping on each other and set a timeout to avoid runaways options { - disableConcurrentBuilds(abortPrevious: true), - timeout(time: 72, unit: 'HOURS') + disableConcurrentBuilds(abortPrevious: true); + timeout(time: 72, unit: 'HOURS'); } // kick off worker using megaboom cloud definition From 8abda9c8cf784b23ce12106ae6be092eb7b5d506 Mon Sep 17 00:00:00 2001 From: Jeff Ng Date: Mon, 28 Oct 2024 13:42:40 -0700 Subject: [PATCH 3/3] moved options to timeout stmt and property Signed-off-by: Jeff Ng --- jenkins/public_build.Jenkinsfile | 82 +++++++++++++++----------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/jenkins/public_build.Jenkinsfile b/jenkins/public_build.Jenkinsfile index 256fd14..929428a 100644 --- a/jenkins/public_build.Jenkinsfile +++ b/jenkins/public_build.Jenkinsfile @@ -1,50 +1,46 @@ @Library('utils@orfs-v2.2.2') _ - -// Prevent builds stomping on each other and set a timeout to avoid runaways -options { - disableConcurrentBuilds(abortPrevious: true); - timeout(time: 72, unit: 'HOURS'); -} - // 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"); + } } } -