summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-06-11 01:31:38 +0000
committerGerrit Code Review <review@openstack.org>2018-06-11 01:31:39 +0000
commit9984712d4d8ba7aae028336677ea2062f07675ac (patch)
treea5ef2f5554de3ae8f763c9466554de361b3b171c
parent558220187c20531add4ba24d0c3e9d889cef4499 (diff)
parentaf6b031d0937c91ff24b425d75720f39090a2530 (diff)
Merge "Add discover-tags to multibranch pipeline project"
-rw-r--r--jenkins_jobs/modules/project_multibranch.py22
-rw-r--r--tests/multibranch/fixtures/scm_bitbucket_full.xml4
-rw-r--r--tests/multibranch/fixtures/scm_bitbucket_full.yaml1
-rw-r--r--tests/multibranch/fixtures/scm_git_full.xml1
-rw-r--r--tests/multibranch/fixtures/scm_git_full.yaml1
-rw-r--r--tests/multibranch/fixtures/scm_github_full.xml1
-rw-r--r--tests/multibranch/fixtures/scm_github_full.yaml1
7 files changed, 29 insertions, 2 deletions
diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py
index 292423b..d6447cb 100644
--- a/jenkins_jobs/modules/project_multibranch.py
+++ b/jenkins_jobs/modules/project_multibranch.py
@@ -296,6 +296,9 @@ def bitbucket_scm(xml_parent, data):
296 User Account. (required) 296 User Account. (required)
297 :arg str repo: The BitBucket repo. (required) 297 :arg str repo: The BitBucket repo. (required)
298 298
299 :arg bool discover-tags: Discovers tags on the repository.
300 (default false)
301
299 Minimal Example: 302 Minimal Example:
300 303
301 .. literalinclude:: 304 .. literalinclude::
@@ -324,7 +327,10 @@ def bitbucket_scm(xml_parent, data):
324 helpers.convert_mapping_to_xml( 327 helpers.convert_mapping_to_xml(
325 source, data, mapping_optional, fail_required=False) 328 source, data, mapping_optional, fail_required=False)
326 329
327 XML.SubElement(source, 'traits') 330 traits = XML.SubElement(source, 'traits')
331 if data.get('discover-tags', False):
332 XML.SubElement(traits,
333 'com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait')
328 334
329 335
330def gerrit_scm(xml_parent, data): 336def gerrit_scm(xml_parent, data):
@@ -413,6 +419,8 @@ def git_scm(xml_parent, data):
413 419
414 :arg bool discover-branches: Discovers branches on the repository. 420 :arg bool discover-branches: Discovers branches on the repository.
415 (default true) 421 (default true)
422 :arg bool discover-tags: Discovers tags on the repository.
423 (default false)
416 :arg bool ignore-on-push-notifications: If a job should not trigger upon 424 :arg bool ignore-on-push-notifications: If a job should not trigger upon
417 push notifications. (default false) 425 push notifications. (default false)
418 426
@@ -446,6 +454,9 @@ def git_scm(xml_parent, data):
446 if data.get('discover-branches', True): 454 if data.get('discover-branches', True):
447 XML.SubElement(traits, ''.join([traits_path, '.BranchDiscoveryTrait'])) 455 XML.SubElement(traits, ''.join([traits_path, '.BranchDiscoveryTrait']))
448 456
457 if data.get('discover-tags', False):
458 XML.SubElement(traits, ''.join([traits_path, '.TagDiscoveryTrait']))
459
449 if data.get('ignore-on-push-notifications', False): 460 if data.get('ignore-on-push-notifications', False):
450 XML.SubElement( 461 XML.SubElement(
451 traits, ''.join([traits_path, '.IgnoreOnPushNotificationTrait'])) 462 traits, ''.join([traits_path, '.IgnoreOnPushNotificationTrait']))
@@ -476,6 +487,8 @@ def github_scm(xml_parent, data):
476 :arg str discover-pr-origin: Discovers pull requests where the origin 487 :arg str discover-pr-origin: Discovers pull requests where the origin
477 repository is the same as the target repository. 488 repository is the same as the target repository.
478 Valid options: merge-current, current, both. (default 'merge-current') 489 Valid options: merge-current, current, both. (default 'merge-current')
490 :arg bool discover-tags: Discovers tags on the repository.
491 (default false)
479 492
480 Minimal Example: 493 Minimal Example:
481 494
@@ -526,6 +539,13 @@ def github_scm(xml_parent, data):
526 helpers.convert_mapping_to_xml( 539 helpers.convert_mapping_to_xml(
527 bd, data, bd_mapping, fail_required=True) 540 bd, data, bd_mapping, fail_required=True)
528 541
542 if data.get('discover-tags', False):
543 XML.SubElement(
544 traits, ''.join([
545 github_path_dscore, '.TagDiscoveryTrait'
546 ])
547 )
548
529 if data.get('discover-pr-forks-strategy', 'merged-current'): 549 if data.get('discover-pr-forks-strategy', 'merged-current'):
530 dprf = XML.SubElement( 550 dprf = XML.SubElement(
531 traits, ''.join([ 551 traits, ''.join([
diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.xml b/tests/multibranch/fixtures/scm_bitbucket_full.xml
index f1a7342..9a4b78a 100644
--- a/tests/multibranch/fixtures/scm_bitbucket_full.xml
+++ b/tests/multibranch/fixtures/scm_bitbucket_full.xml
@@ -36,7 +36,9 @@
36 <repoOwner>SANDBOX</repoOwner> 36 <repoOwner>SANDBOX</repoOwner>
37 <repository>test</repository> 37 <repository>test</repository>
38 <credentialsId>secret</credentialsId> 38 <credentialsId>secret</credentialsId>
39 <traits/> 39 <traits>
40 <com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait/>
41 </traits>
40 </source> 42 </source>
41 </jenkins.branch.BranchSource> 43 </jenkins.branch.BranchSource>
42 </data> 44 </data>
diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.yaml b/tests/multibranch/fixtures/scm_bitbucket_full.yaml
index b9d3ca1..5013825 100644
--- a/tests/multibranch/fixtures/scm_bitbucket_full.yaml
+++ b/tests/multibranch/fixtures/scm_bitbucket_full.yaml
@@ -5,3 +5,4 @@ scm:
5 credentials-id: 'secret' 5 credentials-id: 'secret'
6 repo-owner: 'SANDBOX' 6 repo-owner: 'SANDBOX'
7 repo: 'test' 7 repo: 'test'
8 discover-tags: true
diff --git a/tests/multibranch/fixtures/scm_git_full.xml b/tests/multibranch/fixtures/scm_git_full.xml
index 42aa899..0a125a1 100644
--- a/tests/multibranch/fixtures/scm_git_full.xml
+++ b/tests/multibranch/fixtures/scm_git_full.xml
@@ -36,6 +36,7 @@
36 <remote>https://example.com/jonhndoe/keep-frontend.git</remote> 36 <remote>https://example.com/jonhndoe/keep-frontend.git</remote>
37 <credentialsId>secret</credentialsId> 37 <credentialsId>secret</credentialsId>
38 <traits> 38 <traits>
39 <jenkins.plugins.git.traits.TagDiscoveryTrait/>
39 <jenkins.plugins.git.traits.IgnoreOnPushNotificationTrait/> 40 <jenkins.plugins.git.traits.IgnoreOnPushNotificationTrait/>
40 </traits> 41 </traits>
41 </source> 42 </source>
diff --git a/tests/multibranch/fixtures/scm_git_full.yaml b/tests/multibranch/fixtures/scm_git_full.yaml
index a8087cf..13735c9 100644
--- a/tests/multibranch/fixtures/scm_git_full.yaml
+++ b/tests/multibranch/fixtures/scm_git_full.yaml
@@ -6,3 +6,4 @@ scm:
6 credentials-id: secret 6 credentials-id: secret
7 discover-branches: false 7 discover-branches: false
8 ignore-on-push-notifications: true 8 ignore-on-push-notifications: true
9 discover-tags: true
diff --git a/tests/multibranch/fixtures/scm_github_full.xml b/tests/multibranch/fixtures/scm_github_full.xml
index b61d497..6729673 100644
--- a/tests/multibranch/fixtures/scm_github_full.xml
+++ b/tests/multibranch/fixtures/scm_github_full.xml
@@ -41,6 +41,7 @@
41 <org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait> 41 <org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
42 <strategyId>3</strategyId> 42 <strategyId>3</strategyId>
43 </org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait> 43 </org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
44 <org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>
44 <org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait> 45 <org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>
45 <strategyId>3</strategyId> 46 <strategyId>3</strategyId>
46 <trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustEveryone"/> 47 <trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustEveryone"/>
diff --git a/tests/multibranch/fixtures/scm_github_full.yaml b/tests/multibranch/fixtures/scm_github_full.yaml
index 157d429..c35ca97 100644
--- a/tests/multibranch/fixtures/scm_github_full.yaml
+++ b/tests/multibranch/fixtures/scm_github_full.yaml
@@ -10,3 +10,4 @@ scm:
10 discover-pr-forks-strategy: both 10 discover-pr-forks-strategy: both
11 discover-pr-forks-trust: everyone 11 discover-pr-forks-trust: everyone
12 discover-pr-origin: both 12 discover-pr-origin: both
13 discover-tags: true