summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-07-12 14:35:33 +0000
committerGerrit Code Review <review@openstack.org>2018-07-12 14:35:33 +0000
commit746a089d4a699857ebd0dff5b5a0a6e51a7949f1 (patch)
tree4ff8bffe2bc4c905145854f7e4f96d89592cae61
parentf9b5016ab7fd3e0b86185a8457dff91c7a4e8361 (diff)
parent30855c22e8499b33729ca1c592e2a0b97a565fff (diff)
Merge "Stable identifier for branch sources in multibranch job"
-rw-r--r--jenkins_jobs/modules/project_multibranch.py11
-rw-r--r--tests/multibranch/fixtures/multi_scm_full.xml6
-rw-r--r--tests/multibranch/fixtures/multibranch_defaults.xml2
-rw-r--r--tests/multibranch/fixtures/scm_bitbucket_full.xml2
-rw-r--r--tests/multibranch/fixtures/scm_bitbucket_minimal.xml2
-rw-r--r--tests/multibranch/fixtures/scm_gerrit_full.xml2
-rw-r--r--tests/multibranch/fixtures/scm_gerrit_minimal.xml2
-rw-r--r--tests/multibranch/fixtures/scm_git_full.xml2
-rw-r--r--tests/multibranch/fixtures/scm_git_minimal.xml2
-rw-r--r--tests/multibranch/fixtures/scm_github_full.xml2
-rw-r--r--tests/multibranch/fixtures/scm_github_minimal.xml2
-rw-r--r--tests/multibranch/fixtures/scm_github_no_fork_pr_discovery.xml2
12 files changed, 19 insertions, 18 deletions
diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py
index eaf19d4..5e2594f 100644
--- a/jenkins_jobs/modules/project_multibranch.py
+++ b/jenkins_jobs/modules/project_multibranch.py
@@ -70,7 +70,6 @@ import logging
70import xml.etree.ElementTree as XML 70import xml.etree.ElementTree as XML
71import jenkins_jobs.modules.base 71import jenkins_jobs.modules.base
72import jenkins_jobs.modules.helpers as helpers 72import jenkins_jobs.modules.helpers as helpers
73import uuid
74import six 73import six
75 74
76from jenkins_jobs.errors import InvalidAttributeError 75from jenkins_jobs.errors import InvalidAttributeError
@@ -328,7 +327,8 @@ def bitbucket_scm(xml_parent, data):
328 'plugin': 'cloudbees-bitbucket-branch-source', 327 'plugin': 'cloudbees-bitbucket-branch-source',
329 }) 328 })
330 source_mapping = [ 329 source_mapping = [
331 ('', 'id', str(uuid.uuid4())), 330 ('', 'id', '-'.join(['bb', data.get('repo-owner', ''),
331 data.get('repo', '')])),
332 ('repo-owner', 'repoOwner', None), 332 ('repo-owner', 'repoOwner', None),
333 ('repo', 'repository', None), 333 ('repo', 'repository', None),
334 ] 334 ]
@@ -414,7 +414,7 @@ def gerrit_scm(xml_parent, data):
414 'plugin': 'gerrit', 414 'plugin': 'gerrit',
415 }) 415 })
416 source_mapping = [ 416 source_mapping = [
417 ('', 'id', str(uuid.uuid4())), 417 ('', 'id', '-'.join(['gr', data.get('url', '')])),
418 ('url', 'remote', None), 418 ('url', 'remote', None),
419 ('credentials-id', 'credentialsId', ''), 419 ('credentials-id', 'credentialsId', ''),
420 ('includes', 'includes', '*'), 420 ('includes', 'includes', '*'),
@@ -485,7 +485,7 @@ def git_scm(xml_parent, data):
485 'plugin': 'git', 485 'plugin': 'git',
486 }) 486 })
487 source_mapping = [ 487 source_mapping = [
488 ('', 'id', str(uuid.uuid4())), 488 ('', 'id', '-'.join(['gt', data.get('url', '')])),
489 ('url', 'remote', None), 489 ('url', 'remote', None),
490 ('credentials-id', 'credentialsId', ''), 490 ('credentials-id', 'credentialsId', ''),
491 ] 491 ]
@@ -556,7 +556,8 @@ def github_scm(xml_parent, data):
556 'plugin': 'github-branch-source', 556 'plugin': 'github-branch-source',
557 }) 557 })
558 mapping = [ 558 mapping = [
559 ('', 'id', str(uuid.uuid4())), 559 ('', 'id', '-'.join(['gh', data.get('repo-owner', ''),
560 data.get('repo', '')])),
560 ('repo-owner', 'repoOwner', None), 561 ('repo-owner', 'repoOwner', None),
561 ('repo', 'repository', None), 562 ('repo', 'repository', None),
562 ] 563 ]
diff --git a/tests/multibranch/fixtures/multi_scm_full.xml b/tests/multibranch/fixtures/multi_scm_full.xml
index a2dfb18..e0af6f3 100644
--- a/tests/multibranch/fixtures/multi_scm_full.xml
+++ b/tests/multibranch/fixtures/multi_scm_full.xml
@@ -37,7 +37,7 @@
37 <data> 37 <data>
38 <jenkins.branch.BranchSource> 38 <jenkins.branch.BranchSource>
39 <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source"> 39 <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source">
40 <id>1-1-1-1-1</id> 40 <id>bb-SANDBOX-test</id>
41 <repoOwner>SANDBOX</repoOwner> 41 <repoOwner>SANDBOX</repoOwner>
42 <repository>test</repository> 42 <repository>test</repository>
43 <credentialsId>secret</credentialsId> 43 <credentialsId>secret</credentialsId>
@@ -46,7 +46,7 @@
46 </jenkins.branch.BranchSource> 46 </jenkins.branch.BranchSource>
47 <jenkins.branch.BranchSource> 47 <jenkins.branch.BranchSource>
48 <source class="jenkins.plugins.git.GitSCMSource" plugin="git"> 48 <source class="jenkins.plugins.git.GitSCMSource" plugin="git">
49 <id>1-1-1-1-1</id> 49 <id>gt-https://example.com/jonhndoe/keep-frontend.git</id>
50 <remote>https://example.com/jonhndoe/keep-frontend.git</remote> 50 <remote>https://example.com/jonhndoe/keep-frontend.git</remote>
51 <credentialsId>secret</credentialsId> 51 <credentialsId>secret</credentialsId>
52 <traits> 52 <traits>
@@ -56,7 +56,7 @@
56 </jenkins.branch.BranchSource> 56 </jenkins.branch.BranchSource>
57 <jenkins.branch.BranchSource> 57 <jenkins.branch.BranchSource>
58 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> 58 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
59 <id>1-1-1-1-1</id> 59 <id>gh-johndoe-foo</id>
60 <repoOwner>johndoe</repoOwner> 60 <repoOwner>johndoe</repoOwner>
61 <repository>foo</repository> 61 <repository>foo</repository>
62 <credentialsId>secret</credentialsId> 62 <credentialsId>secret</credentialsId>
diff --git a/tests/multibranch/fixtures/multibranch_defaults.xml b/tests/multibranch/fixtures/multibranch_defaults.xml
index b192ae8..061f182 100644
--- a/tests/multibranch/fixtures/multibranch_defaults.xml
+++ b/tests/multibranch/fixtures/multibranch_defaults.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> 34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
35 <id>1-1-1-1-1</id> 35 <id>gh-johndoe-foo</id>
36 <repoOwner>johndoe</repoOwner> 36 <repoOwner>johndoe</repoOwner>
37 <repository>foo</repository> 37 <repository>foo</repository>
38 <credentialsId>secret</credentialsId> 38 <credentialsId>secret</credentialsId>
diff --git a/tests/multibranch/fixtures/scm_bitbucket_full.xml b/tests/multibranch/fixtures/scm_bitbucket_full.xml
index b59e64a..5fbcc54 100644
--- a/tests/multibranch/fixtures/scm_bitbucket_full.xml
+++ b/tests/multibranch/fixtures/scm_bitbucket_full.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source"> 34 <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source">
35 <id>1-1-1-1-1</id> 35 <id>bb-SANDBOX-test</id>
36 <repoOwner>SANDBOX</repoOwner> 36 <repoOwner>SANDBOX</repoOwner>
37 <repository>test</repository> 37 <repository>test</repository>
38 <credentialsId>secret</credentialsId> 38 <credentialsId>secret</credentialsId>
diff --git a/tests/multibranch/fixtures/scm_bitbucket_minimal.xml b/tests/multibranch/fixtures/scm_bitbucket_minimal.xml
index b2a7d6b..24ade1f 100644
--- a/tests/multibranch/fixtures/scm_bitbucket_minimal.xml
+++ b/tests/multibranch/fixtures/scm_bitbucket_minimal.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source"> 34 <source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source">
35 <id>1-1-1-1-1</id> 35 <id>bb-SANDBOX-test</id>
36 <repoOwner>SANDBOX</repoOwner> 36 <repoOwner>SANDBOX</repoOwner>
37 <repository>test</repository> 37 <repository>test</repository>
38 <traits/> 38 <traits/>
diff --git a/tests/multibranch/fixtures/scm_gerrit_full.xml b/tests/multibranch/fixtures/scm_gerrit_full.xml
index 92124e3..d7db285 100644
--- a/tests/multibranch/fixtures/scm_gerrit_full.xml
+++ b/tests/multibranch/fixtures/scm_gerrit_full.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit"> 34 <source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit">
35 <id>1-1-1-1-1</id> 35 <id>gr-https://review.gerrithub.io/johndoe/foo</id>
36 <remote>https://review.gerrithub.io/johndoe/foo</remote> 36 <remote>https://review.gerrithub.io/johndoe/foo</remote>
37 <credentialsId>secret</credentialsId> 37 <credentialsId>secret</credentialsId>
38 <includes>*</includes> 38 <includes>*</includes>
diff --git a/tests/multibranch/fixtures/scm_gerrit_minimal.xml b/tests/multibranch/fixtures/scm_gerrit_minimal.xml
index 03ad96c..6095955 100644
--- a/tests/multibranch/fixtures/scm_gerrit_minimal.xml
+++ b/tests/multibranch/fixtures/scm_gerrit_minimal.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit"> 34 <source class="jenkins.plugins.gerrit.GerritSCMSource" plugin="gerrit">
35 <id>1-1-1-1-1</id> 35 <id>gr-https://review.gerrithub.io/johndoe/foo</id>
36 <remote>https://review.gerrithub.io/johndoe/foo</remote> 36 <remote>https://review.gerrithub.io/johndoe/foo</remote>
37 <credentialsId/> 37 <credentialsId/>
38 <includes>*</includes> 38 <includes>*</includes>
diff --git a/tests/multibranch/fixtures/scm_git_full.xml b/tests/multibranch/fixtures/scm_git_full.xml
index d709679..7f8805c 100644
--- a/tests/multibranch/fixtures/scm_git_full.xml
+++ b/tests/multibranch/fixtures/scm_git_full.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="jenkins.plugins.git.GitSCMSource" plugin="git"> 34 <source class="jenkins.plugins.git.GitSCMSource" plugin="git">
35 <id>1-1-1-1-1</id> 35 <id>gt-https://example.com/jonhndoe/keep-frontend.git</id>
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>
diff --git a/tests/multibranch/fixtures/scm_git_minimal.xml b/tests/multibranch/fixtures/scm_git_minimal.xml
index d7a5fba..0eff005 100644
--- a/tests/multibranch/fixtures/scm_git_minimal.xml
+++ b/tests/multibranch/fixtures/scm_git_minimal.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="jenkins.plugins.git.GitSCMSource" plugin="git"> 34 <source class="jenkins.plugins.git.GitSCMSource" plugin="git">
35 <id>1-1-1-1-1</id> 35 <id>gt-https://example.com/jonhndoe/keep-frontend.git</id>
36 <remote>https://example.com/jonhndoe/keep-frontend.git</remote> 36 <remote>https://example.com/jonhndoe/keep-frontend.git</remote>
37 <credentialsId/> 37 <credentialsId/>
38 <traits> 38 <traits>
diff --git a/tests/multibranch/fixtures/scm_github_full.xml b/tests/multibranch/fixtures/scm_github_full.xml
index 389c1b5..7ac5359 100644
--- a/tests/multibranch/fixtures/scm_github_full.xml
+++ b/tests/multibranch/fixtures/scm_github_full.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> 34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
35 <id>1-1-1-1-1</id> 35 <id>gh-example-owner-example-repo</id>
36 <repoOwner>example-owner</repoOwner> 36 <repoOwner>example-owner</repoOwner>
37 <repository>example-repo</repository> 37 <repository>example-repo</repository>
38 <apiUri>http://example.org/github</apiUri> 38 <apiUri>http://example.org/github</apiUri>
diff --git a/tests/multibranch/fixtures/scm_github_minimal.xml b/tests/multibranch/fixtures/scm_github_minimal.xml
index 4b75b30..81c27b9 100644
--- a/tests/multibranch/fixtures/scm_github_minimal.xml
+++ b/tests/multibranch/fixtures/scm_github_minimal.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> 34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
35 <id>1-1-1-1-1</id> 35 <id>gh-johndoe-foo</id>
36 <repoOwner>johndoe</repoOwner> 36 <repoOwner>johndoe</repoOwner>
37 <repository>foo</repository> 37 <repository>foo</repository>
38 <traits> 38 <traits>
diff --git a/tests/multibranch/fixtures/scm_github_no_fork_pr_discovery.xml b/tests/multibranch/fixtures/scm_github_no_fork_pr_discovery.xml
index a62ce9d..e856c01 100644
--- a/tests/multibranch/fixtures/scm_github_no_fork_pr_discovery.xml
+++ b/tests/multibranch/fixtures/scm_github_no_fork_pr_discovery.xml
@@ -32,7 +32,7 @@
32 <data> 32 <data>
33 <jenkins.branch.BranchSource> 33 <jenkins.branch.BranchSource>
34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source"> 34 <source class="org.jenkinsci.plugins.github_branch_source.GitHubSCMSource" plugin="github-branch-source">
35 <id>1-1-1-1-1</id> 35 <id>gh-johndoe-foo</id>
36 <repoOwner>johndoe</repoOwner> 36 <repoOwner>johndoe</repoOwner>
37 <repository>foo</repository> 37 <repository>foo</repository>
38 <traits> 38 <traits>