Merge "Stable identifier for branch sources in multibranch job"

This commit is contained in:
Zuul 2018-07-12 14:35:33 +00:00 committed by Gerrit Code Review
commit 746a089d4a
12 changed files with 19 additions and 18 deletions

View File

@ -70,7 +70,6 @@ import logging
import xml.etree.ElementTree as XML import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base import jenkins_jobs.modules.base
import jenkins_jobs.modules.helpers as helpers import jenkins_jobs.modules.helpers as helpers
import uuid
import six import six
from jenkins_jobs.errors import InvalidAttributeError from jenkins_jobs.errors import InvalidAttributeError
@ -328,7 +327,8 @@ def bitbucket_scm(xml_parent, data):
'plugin': 'cloudbees-bitbucket-branch-source', 'plugin': 'cloudbees-bitbucket-branch-source',
}) })
source_mapping = [ source_mapping = [
('', 'id', str(uuid.uuid4())), ('', 'id', '-'.join(['bb', data.get('repo-owner', ''),
data.get('repo', '')])),
('repo-owner', 'repoOwner', None), ('repo-owner', 'repoOwner', None),
('repo', 'repository', None), ('repo', 'repository', None),
] ]
@ -414,7 +414,7 @@ def gerrit_scm(xml_parent, data):
'plugin': 'gerrit', 'plugin': 'gerrit',
}) })
source_mapping = [ source_mapping = [
('', 'id', str(uuid.uuid4())), ('', 'id', '-'.join(['gr', data.get('url', '')])),
('url', 'remote', None), ('url', 'remote', None),
('credentials-id', 'credentialsId', ''), ('credentials-id', 'credentialsId', ''),
('includes', 'includes', '*'), ('includes', 'includes', '*'),
@ -485,7 +485,7 @@ def git_scm(xml_parent, data):
'plugin': 'git', 'plugin': 'git',
}) })
source_mapping = [ source_mapping = [
('', 'id', str(uuid.uuid4())), ('', 'id', '-'.join(['gt', data.get('url', '')])),
('url', 'remote', None), ('url', 'remote', None),
('credentials-id', 'credentialsId', ''), ('credentials-id', 'credentialsId', ''),
] ]
@ -556,7 +556,8 @@ def github_scm(xml_parent, data):
'plugin': 'github-branch-source', 'plugin': 'github-branch-source',
}) })
mapping = [ mapping = [
('', 'id', str(uuid.uuid4())), ('', 'id', '-'.join(['gh', data.get('repo-owner', ''),
data.get('repo', '')])),
('repo-owner', 'repoOwner', None), ('repo-owner', 'repoOwner', None),
('repo', 'repository', None), ('repo', 'repository', None),
] ]

View File

@ -37,7 +37,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source"> <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source">
<id>1-1-1-1-1</id> <id>bb-SANDBOX-test</id>
<repoOwner>SANDBOX</repoOwner> <repoOwner>SANDBOX</repoOwner>
<repository>test</repository> <repository>test</repository>
<credentialsId>secret</credentialsId> <credentialsId>secret</credentialsId>
@ -46,7 +46,7 @@
</jenkins.branch.BranchSource> </jenkins.branch.BranchSource>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="jenkins.plugins.git.GitSCMSource" plugin="git"> <source class="jenkins.plugins.git.GitSCMSource" plugin="git">
<id>1-1-1-1-1</id> <id>gt-https://example.com/jonhndoe/keep-frontend.git</id>
<remote>https://example.com/jonhndoe/keep-frontend.git</remote> <remote>https://example.com/jonhndoe/keep-frontend.git</remote>
<credentialsId>secret</credentialsId> <credentialsId>secret</credentialsId>
<traits> <traits>
@ -56,7 +56,7 @@
</jenkins.branch.BranchSource> </jenkins.branch.BranchSource>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
<id>1-1-1-1-1</id> <id>gh-johndoe-foo</id>
<repoOwner>johndoe</repoOwner> <repoOwner>johndoe</repoOwner>
<repository>foo</repository> <repository>foo</repository>
<credentialsId>secret</credentialsId> <credentialsId>secret</credentialsId>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
<id>1-1-1-1-1</id> <id>gh-johndoe-foo</id>
<repoOwner>johndoe</repoOwner> <repoOwner>johndoe</repoOwner>
<repository>foo</repository> <repository>foo</repository>
<credentialsId>secret</credentialsId> <credentialsId>secret</credentialsId>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source"> <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source">
<id>1-1-1-1-1</id> <id>bb-SANDBOX-test</id>
<repoOwner>SANDBOX</repoOwner> <repoOwner>SANDBOX</repoOwner>
<repository>test</repository> <repository>test</repository>
<credentialsId>secret</credentialsId> <credentialsId>secret</credentialsId>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source"> <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source">
<id>1-1-1-1-1</id> <id>bb-SANDBOX-test</id>
<repoOwner>SANDBOX</repoOwner> <repoOwner>SANDBOX</repoOwner>
<repository>test</repository> <repository>test</repository>
<traits/> <traits/>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit"> <source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit">
<id>1-1-1-1-1</id> <id>gr-https://review.gerrithub.io/johndoe/foo</id>
<remote>https://review.gerrithub.io/johndoe/foo</remote> <remote>https://review.gerrithub.io/johndoe/foo</remote>
<credentialsId>secret</credentialsId> <credentialsId>secret</credentialsId>
<includes>*</includes> <includes>*</includes>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit"> <source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit">
<id>1-1-1-1-1</id> <id>gr-https://review.gerrithub.io/johndoe/foo</id>
<remote>https://review.gerrithub.io/johndoe/foo</remote> <remote>https://review.gerrithub.io/johndoe/foo</remote>
<credentialsId/> <credentialsId/>
<includes>*</includes> <includes>*</includes>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="jenkins.plugins.git.GitSCMSource" plugin="git"> <source class="jenkins.plugins.git.GitSCMSource" plugin="git">
<id>1-1-1-1-1</id> <id>gt-https://example.com/jonhndoe/keep-frontend.git</id>
<remote>https://example.com/jonhndoe/keep-frontend.git</remote> <remote>https://example.com/jonhndoe/keep-frontend.git</remote>
<credentialsId>secret</credentialsId> <credentialsId>secret</credentialsId>
<traits> <traits>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="jenkins.plugins.git.GitSCMSource" plugin="git"> <source class="jenkins.plugins.git.GitSCMSource" plugin="git">
<id>1-1-1-1-1</id> <id>gt-https://example.com/jonhndoe/keep-frontend.git</id>
<remote>https://example.com/jonhndoe/keep-frontend.git</remote> <remote>https://example.com/jonhndoe/keep-frontend.git</remote>
<credentialsId/> <credentialsId/>
<traits> <traits>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
<id>1-1-1-1-1</id> <id>gh-example-owner-example-repo</id>
<repoOwner>example-owner</repoOwner> <repoOwner>example-owner</repoOwner>
<repository>example-repo</repository> <repository>example-repo</repository>
<apiUri>http://example.org/github</apiUri> <apiUri>http://example.org/github</apiUri>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
<id>1-1-1-1-1</id> <id>gh-johndoe-foo</id>
<repoOwner>johndoe</repoOwner> <repoOwner>johndoe</repoOwner>
<repository>foo</repository> <repository>foo</repository>
<traits> <traits>

View File

@ -32,7 +32,7 @@
<data> <data>
<jenkins.branch.BranchSource> <jenkins.branch.BranchSource>
<source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
<id>1-1-1-1-1</id> <id>gh-johndoe-foo</id>
<repoOwner>johndoe</repoOwner> <repoOwner>johndoe</repoOwner>
<repository>foo</repository> <repository>foo</repository>
<traits> <traits>