From d076675ca144d7855dff6805b05d09c87d904178 Mon Sep 17 00:00:00 2001 From: Duncan Hutty Date: Wed, 12 Sep 2018 23:00:26 -0400 Subject: [PATCH] Support SSHCheckout trait Change-Id: Ie00ad2e68a8c9100d055df220ac68bfb8f0ba184 Closes-bug: 2003749 --- jenkins_jobs/modules/project_multibranch.py | 8 ++++++++ tests/multibranch/fixtures/scm_github_full.xml | 1 + tests/multibranch/fixtures/scm_github_full.yaml | 1 + 3 files changed, 10 insertions(+) diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py index 8137550f0..11a52863b 100644 --- a/jenkins_jobs/modules/project_multibranch.py +++ b/jenkins_jobs/modules/project_multibranch.py @@ -660,6 +660,7 @@ def github_scm(xml_parent, data): :arg str api-uri: The GitHub API uri for hosted / on-site GitHub. Must first be configured in Global Configuration. (default GitHub) + :arg bool ssh-checkout: Checkout over SSH. (default false) :arg str credentials-id: Credentials used to scan branches and pull requests, check out sources and mark commit statuses. (optional) :arg str repo-owner: Specify the name of the GitHub Organization or @@ -735,6 +736,13 @@ def github_scm(xml_parent, data): helpers.convert_mapping_to_xml( bd, data, bd_mapping, fail_required=True) + if data.get('ssh-checkout', False): + XML.SubElement( + traits, ''.join([ + github_path_dscore, '.SSHCheckoutTrait' + ]) + ) + if data.get('discover-tags', False): XML.SubElement( traits, ''.join([ diff --git a/tests/multibranch/fixtures/scm_github_full.xml b/tests/multibranch/fixtures/scm_github_full.xml index 7fac14663..9786847f3 100644 --- a/tests/multibranch/fixtures/scm_github_full.xml +++ b/tests/multibranch/fixtures/scm_github_full.xml @@ -41,6 +41,7 @@ 3 + 3 diff --git a/tests/multibranch/fixtures/scm_github_full.yaml b/tests/multibranch/fixtures/scm_github_full.yaml index 544fcdc00..6eb63c622 100644 --- a/tests/multibranch/fixtures/scm_github_full.yaml +++ b/tests/multibranch/fixtures/scm_github_full.yaml @@ -4,6 +4,7 @@ script-path: some.Jenkinsfile scm: - github: api-uri: http://example.org/github + ssh-checkout: true repo: example-repo repo-owner: example-owner credentials-id: example-credential