[Asterisk-code-review] CI: Add "throttle" label and "skip_gate" capability (...testsuite[13])

George Joseph asteriskteam at digium.com
Thu Aug 8 07:23:36 CDT 2019


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/12708


Change subject: CI:  Add "throttle" label and "skip_gate" capability
......................................................................

CI:  Add "throttle" label and "skip_gate" capability

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.

Change-Id: Icd3158c66acf4d72c8bcd5948e8b3fca398aac4a
---
M CI/gates.jenkinsfile
M CI/unittests.jenkinsfile
2 files changed, 32 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/08/12708/1

diff --git a/CI/gates.jenkinsfile b/CI/gates.jenkinsfile
index 26e30de..7d593a4 100644
--- a/CI/gates.jenkinsfile
+++ b/CI/gates.jenkinsfile
@@ -10,7 +10,22 @@
  * we need to dynamically determine which docker image we're going to use and
  * you can't do that in a delcarative pipeline.
  */
+def timeoutTime = 60
+def timeoutUnits = 'MINUTES'
+if (env.TIMEOUT_GATES) {
+	def _timeout = env.TIMEOUT_GATES.split()
+	timeoutTime = _timeout[0].toInteger()
+	timeoutUnits = _timeout[1]
+}
+
 pipeline {
+    options {
+        ansiColor('gnome-terminal')
+        throttle(['testsuite-gate'])
+        timestamps()
+        timeout(time: timeoutTime, unit: timeoutUnits)
+    }
+
 	triggers {
 		/*
 		 * This trigger will match either the "asterisk" or "Security-asterisk"
@@ -56,7 +71,8 @@
 			 */
 			when {
 				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 {
 				script {
diff --git a/CI/unittests.jenkinsfile b/CI/unittests.jenkinsfile
index 943c1d0..595abeb 100644
--- a/CI/unittests.jenkinsfile
+++ b/CI/unittests.jenkinsfile
@@ -10,7 +10,22 @@
  * we need to dynamically determine which docker image we're going to use and
  * you can't do that in a delcarative pipeline.
  */
+def timeoutTime = 30
+def timeoutUnits = 'MINUTES'
+if (env.TIMEOUT_UNITTESTS) {
+	def _timeout = env.TIMEOUT_UNITTESTS.split()
+	timeoutTime = _timeout[0].toInteger()
+	timeoutUnits = _timeout[1]
+}
+
 pipeline {
+    options {
+        ansiColor('gnome-terminal')
+        throttle(['testsuite-check'])
+        timestamps()
+        timeout(time: timeoutTime, unit: timeoutUnits)
+    }
+
 	triggers {
 		/*
 		 * This trigger will match either the "asterisk" or "Security-asterisk"

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/12708
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-Change-Id: Icd3158c66acf4d72c8bcd5948e8b3fca398aac4a
Gerrit-Change-Number: 12708
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190808/e9d03c08/attachment-0001.html>


More information about the asterisk-code-review mailing list