Add discover-tags to multibranch pipeline project
Add the option to specify discover-tags on bitbucket, git and github SCMs in multibranch pipeline. Change-Id: I28a4bc3a4bb5d50b8d7717b19ef063a23a68ed8c Task: 20061 Story: 2002187
This commit is contained in:
parent
8626df2322
commit
af6b031d09
|
@ -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([
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -5,3 +5,4 @@ scm:
|
|||
credentials-id: 'secret'
|
||||
repo-owner: 'SANDBOX'
|
||||
repo: 'test'
|
||||
discover-tags: true
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -6,3 +6,4 @@ scm:
|
|||
credentials-id: secret
|
||||
discover-branches: false
|
||||
ignore-on-push-notifications: true
|
||||
discover-tags: true
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -10,3 +10,4 @@ scm:
|
|||
discover-pr-forks-strategy: both
|
||||
discover-pr-forks-trust: everyone
|
||||
discover-pr-origin: both
|
||||
discover-tags: true
|
||||
|
|
Loading…
Reference in New Issue