]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
CI: Add "throttle" label and "skip_gate" capability
authorGeorge Joseph <gjoseph@digium.com>
Thu, 8 Aug 2019 12:12:18 +0000 (06:12 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Thu, 8 Aug 2019 14:49:17 +0000 (09:49 -0500)
To make throttling by label fully active, the "throttle" option
has to be specified with a specific label.

You can now specify "skip_gate" in the Gerrit comments when you
do a +2 code review to tell Jenkins not to actually run the
gate.  You'd do this if you plan to manually merge the change.

Also updated the "printenv" debug output to better sort multi-line
comments.

Change-Id: I4c0b1085acec4805f2ca207eebac50aad81f27e2

tests/CI/gates.jenkinsfile
tests/CI/periodics-daily.jenkinsfile
tests/CI/ref_debug.jenkinsfile
tests/CI/unittests.jenkinsfile

index 359dbbe258856419dc8c761af6a43e4f0e6ff64d..219abb0cc6ffb53613253cfc6dcd8f4ff1234e64 100644 (file)
@@ -20,6 +20,8 @@ if (env.TIMEOUT_GATES) {
 
 pipeline {
        options {
+               ansiColor('gnome-terminal')
+               throttle(['asterisk-gate'])
                timestamps()
                timeout(time: timeoutTime, unit: timeoutUnits)
        }
@@ -62,14 +64,15 @@ pipeline {
 
        stages {
                stage ("->") {
-                       /*
-                        * Jenkins will try to automatically rebuild this job when
-                        * the jenkinsfile changes but since this job is dependent on
-                        * Gerrit, we really don't want to do anything in that case.
-                        */
                        when {
+                               /*
+                                * Jenkins will try to automatically rebuild this job when
+                                * the jenkinsfile changes but since this job is dependent on
+                                * Gerrit, we really don't want to do anything in that case.
+                                */
                                not { environment name: 'GERRIT_CHANGE_NUMBER', value: '' }
-                               not { environment name: 'GERRIT_EVENT_ACCOUNT_NAME', value: 'Jenkins2' }
+                               /* If "skip_gate" is in the comments, don't run the job */
+                               not { expression { env.GERRIT_EVENT_COMMENT_TEXT ==~ /.*skip_gate.*/ } }
                        }
                        steps {
                                /* Here's where we switch to scripted pipeline */
@@ -97,7 +100,7 @@ pipeline {
                                                withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}",
                                                        passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) {
 
-                                                       sh "printenv | sort"
+                                                       sh "printenv -0 | sort -z | tr '\0' '\n'"
 
                                                        checkout scm: [$class: 'GitSCM',
                                                                branches: [[name: env.GERRIT_BRANCH ]],
index c91c5e55c550c8ba262c8e34d427240dc1d68730..ce10209fb7177d8e8ab7e4c256fa8ab4ca1c8f24 100644 (file)
@@ -20,6 +20,8 @@ if (env.TIMEOUT_DAILIES) {
 
 pipeline {
        options {
+               ansiColor('gnome-terminal')
+               throttle(['asterisk-daily'])
                timestamps()
                timeout(time: timeoutTime, unit: timeoutUnits)
        }
@@ -41,7 +43,7 @@ pipeline {
 
                                        stage ("Checkout") {
                                                sh "sudo chown -R jenkins:users ."
-                                               sh "printenv | sort"
+                                               sh "printenv -0 | sort -z | tr '\0' '\n'"
                                                sh "sudo tests/CI/setupJenkinsEnvironment.sh"
                                        }
 
index 0d1e522f1a3c175a54aad7cec18f4886c8896ca3..5c4f4873fe8d63396b2fd5921aa6df13517a7966 100644 (file)
@@ -20,6 +20,8 @@ if (env.TIMEOUT_REF_DEBUG) {
 
 pipeline {
        options {
+               ansiColor('gnome-terminal')
+               throttle(['asterisk-ref-debug'])
                timestamps()
                timeout(time: timeoutTime, unit: timeoutUnits)
        }
@@ -41,7 +43,7 @@ pipeline {
 
                                        stage ("Checkout") {
                                                sh "sudo chown -R jenkins:users ."
-                                               sh "printenv | sort"
+                                               sh "printenv -0 | sort -z | tr '\0' '\n'"
                                                sh "sudo tests/CI/setupJenkinsEnvironment.sh"
                                        }
 
index 97d18a865a52fa713f055f0416062ef34e34fc58..7a5cd4ad6df0e5b966257bfedcf1551f36f8ed13 100644 (file)
@@ -20,6 +20,8 @@ if (env.TIMEOUT_UNITTESTS) {
 
 pipeline {
        options {
+               ansiColor('gnome-terminal')
+               throttle(['asterisk-check'])
                timestamps()
                timeout(time: timeoutTime, unit: timeoutUnits)
        }
@@ -98,7 +100,7 @@ pipeline {
                                                withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}",
                                                        passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) {
 
-                                                       sh "printenv | sort"
+                                                       sh "printenv -0 | sort -z | tr '\0' '\n'"
 
                                                        checkout scm: [$class: 'GitSCM',
                                                                branches: [[name: env.GERRIT_BRANCH ]],