Make pipeline job options consistent

Set a consistent set of options on Jenkins pipeline jobs. This includes timestamps,
reasonable timeouts, saving only the last 10 builds (to avoid filling up the disk
of the Jenkins master), disabling concurrent builds (to avoid hitting quota limits),
and skipping the default checkout (all jobs that need the source call checkout()
explicitly).
This commit is contained in:
Mike Bonnet
2019-05-16 12:22:47 -07:00
parent a8eaac7c0a
commit d80316ebf2
6 changed files with 17 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ pipeline {
timestamps()
timeout(time: 120, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
skipDefaultCheckout()
}
environment {

View File

@@ -1,6 +1,10 @@
// Use scripted syntax because CIBuildTrigger currently doesn't support the declarative syntax
properties([
timestamps(),
timeout(time: 30, unit: 'MINUTES'),
buildDiscarder(logRotator(numToKeepStr: '10')),
disableConcurrentBuilds(),
skipDefaultCheckout(),
pipelineTriggers([
// example: https://github.com/jenkinsci/jms-messaging-plugin/blob/9b9387c3a52f037ba0d019c2ebcf2a2796fc6397/src/test/java/com/redhat/jenkins/plugins/ci/integration/AmqMessagingPluginIntegrationTest.java
[$class: 'CIBuildTrigger',

View File

@@ -38,6 +38,9 @@ pipeline {
options {
timestamps()
timeout(time: 30, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
skipDefaultCheckout()
}
environment {
PIPELINE_NAMESPACE = readFile(file: '/run/secrets/kubernetes.io/serviceaccount/namespace').trim()

View File

@@ -41,6 +41,7 @@ pipeline {
timestamps()
timeout(time: 60, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
skipDefaultCheckout()
}
environment {

View File

@@ -123,6 +123,10 @@ objects:
}
options {
timestamps()
timeout(time: 60, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
skipDefaultCheckout()
}
environment {
PIPELINE_NAMESPACE = readFile('/run/secrets/kubernetes.io/serviceaccount/namespace').trim()

View File

@@ -1,6 +1,10 @@
// Use scripted syntax because CIBuildTrigger currently doesn't support the declarative syntax
properties([
timestamps(),
timeout(time: 30, unit: 'MINUTES'),
buildDiscarder(logRotator(numToKeepStr: '10')),
disableConcurrentBuilds(),
skipDefaultCheckout(),
pipelineTriggers([
// example: https://github.com/jenkinsci/jms-messaging-plugin/blob/9b9387c3a52f037ba0d019c2ebcf2a2796fc6397/src/test/java/com/redhat/jenkins/plugins/ci/integration/AmqMessagingPluginIntegrationTest.java
[$class: 'CIBuildTrigger',