summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-06-15 03:45:15 +0000
committerGerrit Code Review <review@openstack.org>2018-06-15 03:45:15 +0000
commit19e3c86074ecb87c00866c47998776129fcf279b (patch)
tree93572d847383f33d49cb3aee3b959d54e82c7b55
parenta0564c85de59455477ce059aa0f51caf5a4ca649 (diff)
parent4167cc5dbd1ee46b09077ccc46f5b91060dc98a7 (diff)
Merge "Add depth option to git shallow-clone"
-rw-r--r--jenkins_jobs/modules/scm.py7
-rw-r--r--tests/macros/fixtures/scm/obj-in-scm-macro001.xml1
-rw-r--r--tests/scm/fixtures/git-cloneoptions01.xml1
-rw-r--r--tests/scm/fixtures/git-shallow-clone01.xml1
-rw-r--r--tests/scm/fixtures/git-shallow-clone02.xml1
-rw-r--r--tests/scm/fixtures/git001.xml1
-rw-r--r--tests/scm/fixtures/git002.xml3
-rw-r--r--tests/scm/fixtures/git002.yaml2
8 files changed, 14 insertions, 3 deletions
diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py
index 4fe7672..189331d 100644
--- a/jenkins_jobs/modules/scm.py
+++ b/jenkins_jobs/modules/scm.py
@@ -169,6 +169,7 @@ def git(registry, xml_parent, data):
169 * **scm-name** (`string`) - The unique scm name for this Git SCM 169 * **scm-name** (`string`) - The unique scm name for this Git SCM
170 (optional) 170 (optional)
171 * **shallow-clone** (`bool`) - Perform shallow clone (default false) 171 * **shallow-clone** (`bool`) - Perform shallow clone (default false)
172 * **depth** (`int`) - Set shallow clone depth (default 1)
172 * **do-not-fetch-tags** (`bool`) - Perform a clone without tags 173 * **do-not-fetch-tags** (`bool`) - Perform a clone without tags
173 (default false) 174 (default false)
174 * **sparse-checkout** (`dict`) 175 * **sparse-checkout** (`dict`)
@@ -381,8 +382,10 @@ def git(registry, xml_parent, data):
381 ) 382 )
382 if any(key in data for key in clone_options): 383 if any(key in data for key in clone_options):
383 clo = XML.SubElement(exts_node, impl_prefix + 'CloneOption') 384 clo = XML.SubElement(exts_node, impl_prefix + 'CloneOption')
384 XML.SubElement(clo, 'shallow').text = str( 385 clone_mapping = [
385 data.get('shallow-clone', False)).lower() 386 ('shallow-clone', 'shallow', False),
387 ('depth', 'depth', 1)]
388 convert_mapping_to_xml(clo, data, clone_mapping, fail_required=True)
386 if 'do-not-fetch-tags' in data: 389 if 'do-not-fetch-tags' in data:
387 XML.SubElement(clo, 'noTags').text = str( 390 XML.SubElement(clo, 'noTags').text = str(
388 data.get('do-not-fetch-tags', False)).lower() 391 data.get('do-not-fetch-tags', False)).lower()
diff --git a/tests/macros/fixtures/scm/obj-in-scm-macro001.xml b/tests/macros/fixtures/scm/obj-in-scm-macro001.xml
index e382ff6..9918f25 100644
--- a/tests/macros/fixtures/scm/obj-in-scm-macro001.xml
+++ b/tests/macros/fixtures/scm/obj-in-scm-macro001.xml
@@ -37,6 +37,7 @@
37 <hudson.plugins.git.extensions.impl.CleanBeforeCheckout/> 37 <hudson.plugins.git.extensions.impl.CleanBeforeCheckout/>
38 <hudson.plugins.git.extensions.impl.CloneOption> 38 <hudson.plugins.git.extensions.impl.CloneOption>
39 <shallow>true</shallow> 39 <shallow>true</shallow>
40 <depth>1</depth>
40 </hudson.plugins.git.extensions.impl.CloneOption> 41 </hudson.plugins.git.extensions.impl.CloneOption>
41 <hudson.plugins.git.extensions.impl.SubmoduleOption> 42 <hudson.plugins.git.extensions.impl.SubmoduleOption>
42 <disableSubmodules>false</disableSubmodules> 43 <disableSubmodules>false</disableSubmodules>
diff --git a/tests/scm/fixtures/git-cloneoptions01.xml b/tests/scm/fixtures/git-cloneoptions01.xml
index 0de9fcc..722f773 100644
--- a/tests/scm/fixtures/git-cloneoptions01.xml
+++ b/tests/scm/fixtures/git-cloneoptions01.xml
@@ -26,6 +26,7 @@
26 <extensions> 26 <extensions>
27 <hudson.plugins.git.extensions.impl.CloneOption> 27 <hudson.plugins.git.extensions.impl.CloneOption>
28 <shallow>false</shallow> 28 <shallow>false</shallow>
29 <depth>1</depth>
29 <noTags>true</noTags> 30 <noTags>true</noTags>
30 </hudson.plugins.git.extensions.impl.CloneOption> 31 </hudson.plugins.git.extensions.impl.CloneOption>
31 <hudson.plugins.git.extensions.impl.WipeWorkspace/> 32 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
diff --git a/tests/scm/fixtures/git-shallow-clone01.xml b/tests/scm/fixtures/git-shallow-clone01.xml
index f2ffe1c..a5532f9 100644
--- a/tests/scm/fixtures/git-shallow-clone01.xml
+++ b/tests/scm/fixtures/git-shallow-clone01.xml
@@ -28,6 +28,7 @@
28 <hudson.plugins.git.extensions.impl.CleanCheckout/> 28 <hudson.plugins.git.extensions.impl.CleanCheckout/>
29 <hudson.plugins.git.extensions.impl.CloneOption> 29 <hudson.plugins.git.extensions.impl.CloneOption>
30 <shallow>true</shallow> 30 <shallow>true</shallow>
31 <depth>1</depth>
31 </hudson.plugins.git.extensions.impl.CloneOption> 32 </hudson.plugins.git.extensions.impl.CloneOption>
32 <hudson.plugins.git.extensions.impl.WipeWorkspace/> 33 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
33 </extensions> 34 </extensions>
diff --git a/tests/scm/fixtures/git-shallow-clone02.xml b/tests/scm/fixtures/git-shallow-clone02.xml
index 416929e..641863d 100644
--- a/tests/scm/fixtures/git-shallow-clone02.xml
+++ b/tests/scm/fixtures/git-shallow-clone02.xml
@@ -27,6 +27,7 @@
27 <hudson.plugins.git.extensions.impl.CleanCheckout/> 27 <hudson.plugins.git.extensions.impl.CleanCheckout/>
28 <hudson.plugins.git.extensions.impl.CloneOption> 28 <hudson.plugins.git.extensions.impl.CloneOption>
29 <shallow>false</shallow> 29 <shallow>false</shallow>
30 <depth>1</depth>
30 </hudson.plugins.git.extensions.impl.CloneOption> 31 </hudson.plugins.git.extensions.impl.CloneOption>
31 <hudson.plugins.git.extensions.impl.WipeWorkspace/> 32 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
32 </extensions> 33 </extensions>
diff --git a/tests/scm/fixtures/git001.xml b/tests/scm/fixtures/git001.xml
index c0f3746..e0ef687 100644
--- a/tests/scm/fixtures/git001.xml
+++ b/tests/scm/fixtures/git001.xml
@@ -29,6 +29,7 @@
29 <extensions> 29 <extensions>
30 <hudson.plugins.git.extensions.impl.CloneOption> 30 <hudson.plugins.git.extensions.impl.CloneOption>
31 <shallow>false</shallow> 31 <shallow>false</shallow>
32 <depth>1</depth>
32 <timeout>20</timeout> 33 <timeout>20</timeout>
33 </hudson.plugins.git.extensions.impl.CloneOption> 34 </hudson.plugins.git.extensions.impl.CloneOption>
34 <hudson.plugins.git.extensions.impl.CheckoutOption> 35 <hudson.plugins.git.extensions.impl.CheckoutOption>
diff --git a/tests/scm/fixtures/git002.xml b/tests/scm/fixtures/git002.xml
index 3f48755..a036c05 100644
--- a/tests/scm/fixtures/git002.xml
+++ b/tests/scm/fixtures/git002.xml
@@ -34,7 +34,8 @@
34 </options> 34 </options>
35 </hudson.plugins.git.extensions.impl.ChangelogToBranch> 35 </hudson.plugins.git.extensions.impl.ChangelogToBranch>
36 <hudson.plugins.git.extensions.impl.CloneOption> 36 <hudson.plugins.git.extensions.impl.CloneOption>
37 <shallow>false</shallow> 37 <shallow>true</shallow>
38 <depth>3</depth>
38 <noTags>false</noTags> 39 <noTags>false</noTags>
39 <timeout>20</timeout> 40 <timeout>20</timeout>
40 </hudson.plugins.git.extensions.impl.CloneOption> 41 </hudson.plugins.git.extensions.impl.CloneOption>
diff --git a/tests/scm/fixtures/git002.yaml b/tests/scm/fixtures/git002.yaml
index c1d37a0..e77d424 100644
--- a/tests/scm/fixtures/git002.yaml
+++ b/tests/scm/fixtures/git002.yaml
@@ -6,6 +6,8 @@ scm:
6 - stable 6 - stable
7 browser: githubweb 7 browser: githubweb
8 browser-url: http://github.com/foo/example.git 8 browser-url: http://github.com/foo/example.git
9 shallow-clone: true
10 depth: 3
9 timeout: 20 11 timeout: 20
10 do-not-fetch-tags: false 12 do-not-fetch-tags: false
11 changelog-against: 13 changelog-against: