diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py index 87429f8d9..6c68dc158 100644 --- a/jenkins_jobs/modules/scm.py +++ b/jenkins_jobs/modules/scm.py @@ -447,6 +447,7 @@ def git_extensions(xml_parent, data): "timeout", "do-not-fetch-tags", "honor-refspec", + "reference-repo", ) if any(key in data for key in clone_options): ext_name = impl_prefix + 'CloneOption' @@ -471,6 +472,8 @@ def git_extensions(xml_parent, data): if 'honor-refspec' in data: XML.SubElement(ext, 'honorRefspec').text = str( data.get('honor-refspec', False)).lower() + if 'reference-repo' in data: + XML.SubElement(ext, 'reference').text = str(data['reference-repo']) if not trait and 'sparse-checkout' in data: ext_name = impl_prefix + 'SparseCheckoutPaths' ext = XML.SubElement(xml_parent, ext_name) diff --git a/tests/scm/fixtures/git-extensions-reference-repo.xml b/tests/scm/fixtures/git-extensions-reference-repo.xml new file mode 100644 index 000000000..25e724dd3 --- /dev/null +++ b/tests/scm/fixtures/git-extensions-reference-repo.xml @@ -0,0 +1,35 @@ + + + + 2 + + + origin + +refs/heads/*:refs/remotes/origin/* + https://example.com/project.git + + + + + ** + + + false + false + false + false + Default + + /path/to/reference/repo.git + + + + + false + 1 + /path/to/reference/repo.git + + + + + diff --git a/tests/scm/fixtures/git-extensions-reference-repo.yaml b/tests/scm/fixtures/git-extensions-reference-repo.yaml new file mode 100644 index 000000000..24461d819 --- /dev/null +++ b/tests/scm/fixtures/git-extensions-reference-repo.yaml @@ -0,0 +1,4 @@ +scm: + - git: + url: https://example.com/project.git + reference-repo: /path/to/reference/repo.git