diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py
index daf0f6675..559657ee7 100644
--- a/jenkins_jobs/modules/scm.py
+++ b/jenkins_jobs/modules/scm.py
@@ -96,6 +96,7 @@ remoteName/\*')
(default 'default')
:arg str git-config-name: Configure name for Git clone (optional)
:arg str git-config-email: Configure email for Git clone (optional)
+ :arg str timeout: Timeout for git commands in minutes (optional)
:browser values:
:auto:
@@ -222,6 +223,13 @@ remoteName/\*')
if 'local-branch' in data:
XML.SubElement(scm, 'localBranch').text = data['local-branch']
+ if 'timeout' in data:
+ ext = XML.SubElement(scm, 'extensions')
+ co = XML.SubElement(ext,
+ 'hudson.plugins.git.extensions.impl.'
+ 'CheckoutOption')
+ XML.SubElement(co, 'timeout').text = str(data['timeout'])
+
browser = data.get('browser', 'auto')
browserdict = {'auto': 'auto',
'bitbucketweb': 'BitbucketWeb',
diff --git a/tests/scm/fixtures/git001.xml b/tests/scm/fixtures/git001.xml
index d86c15aa9..66a29fd99 100644
--- a/tests/scm/fixtures/git001.xml
+++ b/tests/scm/fixtures/git001.xml
@@ -37,6 +37,11 @@
false
false
+
+
+ 20
+
+
http://github.com/foo/example.git
diff --git a/tests/scm/fixtures/git001.yaml b/tests/scm/fixtures/git001.yaml
index fecddeb3f..a15b319e1 100644
--- a/tests/scm/fixtures/git001.yaml
+++ b/tests/scm/fixtures/git001.yaml
@@ -6,3 +6,4 @@ scm:
- stable
browser: githubweb
browser-url: http://github.com/foo/example.git
+ timeout: 20