[Asterisk-code-review] CI: Get job timeouts from environment (asterisk[13])

George Joseph asteriskteam at digium.com
Mon Nov 19 12:02:26 CST 2018


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/10692


Change subject: CI: Get job timeouts from environment
......................................................................

CI: Get job timeouts from environment

The job timeouts were hard coded in the jenkinsfiles which
means changes had to go through gerrit.  Now they are taken
from the following environment variables (and their defaults) that
can be set in Jenkins configuration...

TIMEOUT_GATES =      "60 MINUTES"
TIMEOUT_DAILIES =    "3 HOURS"
TIMEOUT_REF_DEBUG =  "24 HOURS"
TIMEOUT_UNITTESTS =  "30 MINUTES"

Change-Id: I673a551c1780bf665a3bc160b245da574aa4bbab
---
M tests/CI/gates.jenkinsfile
M tests/CI/periodics-daily.jenkinsfile
M tests/CI/ref_debug.jenkinsfile
M tests/CI/unittests.jenkinsfile
4 files changed, 36 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/92/10692/1

diff --git a/tests/CI/gates.jenkinsfile b/tests/CI/gates.jenkinsfile
index 1839a8b..ede3353 100644
--- a/tests/CI/gates.jenkinsfile
+++ b/tests/CI/gates.jenkinsfile
@@ -10,10 +10,18 @@
  * 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 {
 		timestamps()
-		timeout(time: 60, unit: 'MINUTES')
+		timeout(time: timeoutTime, unit: timeoutUnits)
 	}
 	triggers {
 		/*
diff --git a/tests/CI/periodics-daily.jenkinsfile b/tests/CI/periodics-daily.jenkinsfile
index ba56665..26c9db9 100644
--- a/tests/CI/periodics-daily.jenkinsfile
+++ b/tests/CI/periodics-daily.jenkinsfile
@@ -10,10 +10,18 @@
  * 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 = 3
+def timeoutUnits = 'HOURS'
+if (env.TIMEOUT_DAILIES) {
+	def _timeout = env.TIMEOUT_DAILIES.split()
+	timeoutTime = _timeout[0].toInteger()
+	timeoutUnits = _timeout[1]
+}
+
 pipeline {
 	options {
 		timestamps()
-		timeout(time: 3, unit: 'HOURS')
+		timeout(time: timeoutTime, unit: timeoutUnits)
 	}
 	triggers {
 		cron 'H H(0-4) * * *'
diff --git a/tests/CI/ref_debug.jenkinsfile b/tests/CI/ref_debug.jenkinsfile
index 2c6daf0..f991349 100644
--- a/tests/CI/ref_debug.jenkinsfile
+++ b/tests/CI/ref_debug.jenkinsfile
@@ -10,10 +10,18 @@
  * 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 = 24
+def timeoutUnits = 'HOURS'
+if (env.TIMEOUT_REF_DEBUG) {
+	def _timeout = env.TIMEOUT_REF_DEBUG.split()
+	timeoutTime = _timeout[0].toInteger()
+	timeoutUnits = _timeout[1]
+}
+
 pipeline {
 	options {
 		timestamps()
-		timeout(time: 1, unit: 'DAYS')
+		timeout(time: timeoutTime, unit: timeoutUnits)
 	}
 	triggers {
 		cron 'H H(0-4) * * 0'
diff --git a/tests/CI/unittests.jenkinsfile b/tests/CI/unittests.jenkinsfile
index 61dac70..2916cb4 100644
--- a/tests/CI/unittests.jenkinsfile
+++ b/tests/CI/unittests.jenkinsfile
@@ -10,10 +10,18 @@
  * 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 {
 		timestamps()
-		timeout(time: 30, unit: 'MINUTES')
+		timeout(time: timeoutTime, unit: timeoutUnits)
 	}
 	triggers {
 		/*

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

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


More information about the asterisk-code-review mailing list