Merge "Add discover-tags to multibranch pipeline project"

This commit is contained in:
Zuul 2018-06-11 01:31:38 +00:00 committed by Gerrit Code Review
commit 9984712d4d
7 changed files with 29 additions and 2 deletions

View File

@ -296,6 +296,9 @@ def bitbucket_scm(xml_parent, data):
User Account. (required)
:arg str repo: The BitBucket repo. (required)
:arg bool discover-tags: Discovers tags on the repository.
(default false)
Minimal Example:
.. literalinclude::
@ -324,7 +327,10 @@ def bitbucket_scm(xml_parent, data):
helpers.convert_mapping_to_xml(
source, data, mapping_optional, fail_required=False)
XML.SubElement(source, 'traits')
traits = XML.SubElement(source, 'traits')
if data.get('discover-tags', False):
XML.SubElement(traits,
'com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait')
def gerrit_scm(xml_parent, data):
@ -413,6 +419,8 @@ def git_scm(xml_parent, data):
:arg bool discover-branches: Discovers branches on the repository.
(default true)
:arg bool discover-tags: Discovers tags on the repository.
(default false)
:arg bool ignore-on-push-notifications: If a job should not trigger upon
push notifications. (default false)
@ -446,6 +454,9 @@ def git_scm(xml_parent, data):
if data.get('discover-branches', True):
XML.SubElement(traits, ''.join([traits_path, '.BranchDiscoveryTrait']))
if data.get('discover-tags', False):
XML.SubElement(traits, ''.join([traits_path, '.TagDiscoveryTrait']))
if data.get('ignore-on-push-notifications', False):
XML.SubElement(
traits, ''.join([traits_path, '.IgnoreOnPushNotificationTrait']))
@ -476,6 +487,8 @@ def github_scm(xml_parent, data):
:arg str discover-pr-origin: Discovers pull requests where the origin
repository is the same as the target repository.
Valid options: merge-current, current, both. (default 'merge-current')
:arg bool discover-tags: Discovers tags on the repository.
(default false)
Minimal Example:
@ -526,6 +539,13 @@ def github_scm(xml_parent, data):
helpers.convert_mapping_to_xml(
bd, data, bd_mapping, fail_required=True)
if data.get('discover-tags', False):
XML.SubElement(
traits, ''.join([
github_path_dscore, '.TagDiscoveryTrait'
])
)
if data.get('discover-pr-forks-strategy', 'merged-current'):
dprf = XML.SubElement(
traits, ''.join([

View File

@ -36,7 +36,9 @@
<repoOwner>SANDBOX</repoOwner>
<repository>test</repository>
<credentialsId>secret</credentialsId>
<traits/>
<traits>
<com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait/>
</traits>
</source>
</jenkins.branch.BranchSource>
</data>

View File

@ -5,3 +5,4 @@ scm:
credentials-id: 'secret'
repo-owner: 'SANDBOX'
repo: 'test'
discover-tags: true

View File

@ -36,6 +36,7 @@
<remote>https://example.com/jonhndoe/keep-frontend.git</remote>
<credentialsId>secret</credentialsId>
<traits>
<jenkins.plugins.git.traits.TagDiscoveryTrait/>
<jenkins.plugins.git.traits.IgnoreOnPushNotificationTrait/>
</traits>
</source>

View File

@ -6,3 +6,4 @@ scm:
credentials-id: secret
discover-branches: false
ignore-on-push-notifications: true
discover-tags: true

View File

@ -41,6 +41,7 @@
<org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
<strategyId>3</strategyId>
</org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait>
<org.jenkinsci.plugins.github__branch__source.TagDiscoveryTrait/>
<org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait>
<strategyId>3</strategyId>
<trust class="org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustEveryone"/>

View File

@ -10,3 +10,4 @@ scm:
discover-pr-forks-strategy: both
discover-pr-forks-trust: everyone
discover-pr-origin: both
discover-tags: true