summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Rockman <kyle.rockman@mac.com>2015-04-29 14:30:14 -0500
committerDawid Malinowski <dawidmalina@gmail.com>2015-07-26 01:00:00 +0200
commite043e742678708a6956a2fe53fe7470a3c94d413 (patch)
treecf2c1e841c90a084b8a7708562098fa21d42fe0a
parente1cc03e606cb5334ab689f10a731051b11e8054b (diff)
Adding publisher support to join-trigger plugin
the join-trigger plugin supports publishers to be triggered on a join. Only certain publishers work, but this should enable support for it. Change-Id: I04afc2aedd0c57e9e64c46dbdc7f694d47186bbb Signed-off-by: Kyle Rockman <kyle.rockman@mac.com>
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Khai Do <zaro0508@gmail.com> Code-Review+2: Joshua Hesketh <joshua.hesketh@rackspace.com> Workflow+1: Joshua Hesketh <joshua.hesketh@rackspace.com> Code-Review+1: Dawid Malinowski <dawidmalina@gmail.com> Submitted-by: Jenkins Submitted-at: Mon, 27 Jul 2015 02:05:14 +0000 Reviewed-on: https://review.openstack.org/178836 Project: openstack-infra/jenkins-job-builder Branch: refs/heads/master
-rw-r--r--jenkins_jobs/modules/publishers.py13
-rw-r--r--tests/publishers/fixtures/join-trigger001.xml23
-rw-r--r--tests/publishers/fixtures/join-trigger001.yaml7
3 files changed, 42 insertions, 1 deletions
diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py
index d6c91ff..4ec633b 100644
--- a/jenkins_jobs/modules/publishers.py
+++ b/jenkins_jobs/modules/publishers.py
@@ -1966,7 +1966,11 @@ def join_trigger(parser, xml_parent, data):
1966 """yaml: join-trigger 1966 """yaml: join-trigger
1967 Trigger a job after all the immediate downstream jobs have completed 1967 Trigger a job after all the immediate downstream jobs have completed
1968 1968
1969 :arg bool even-if-unstable: if true jobs will trigger even if some
1970 downstream jobs are marked as unstable (default false)
1969 :arg list projects: list of projects to trigger 1971 :arg list projects: list of projects to trigger
1972 :arg list publishers: list of triggers from publishers module that
1973 defines projects that need to be triggered
1970 1974
1971 Example: 1975 Example:
1972 1976
@@ -1975,10 +1979,17 @@ def join_trigger(parser, xml_parent, data):
1975 """ 1979 """
1976 jointrigger = XML.SubElement(xml_parent, 'join.JoinTrigger') 1980 jointrigger = XML.SubElement(xml_parent, 'join.JoinTrigger')
1977 1981
1978 # Simple Project List
1979 joinProjectsText = ','.join(data.get('projects', [''])) 1982 joinProjectsText = ','.join(data.get('projects', ['']))
1980 XML.SubElement(jointrigger, 'joinProjects').text = joinProjectsText 1983 XML.SubElement(jointrigger, 'joinProjects').text = joinProjectsText
1981 1984
1985 publishers = XML.SubElement(jointrigger, 'joinPublishers')
1986 for pub in data.get('publishers', []):
1987 for edited_node in create_publishers(parser, pub):
1988 publishers.append(edited_node)
1989
1990 unstable = str(data.get('even-if-unstable', 'false')).lower()
1991 XML.SubElement(jointrigger, 'evenIfDownstreamUnstable').text = unstable
1992
1982 1993
1983def jabber(parser, xml_parent, data): 1994def jabber(parser, xml_parent, data):
1984 """yaml: jabber 1995 """yaml: jabber
diff --git a/tests/publishers/fixtures/join-trigger001.xml b/tests/publishers/fixtures/join-trigger001.xml
index 2fdde20..1d81df4 100644
--- a/tests/publishers/fixtures/join-trigger001.xml
+++ b/tests/publishers/fixtures/join-trigger001.xml
@@ -3,6 +3,29 @@
3 <publishers> 3 <publishers>
4 <join.JoinTrigger> 4 <join.JoinTrigger>
5 <joinProjects>project-one,project-two</joinProjects> 5 <joinProjects>project-one,project-two</joinProjects>
6 <joinPublishers>
7 <hudson.plugins.parameterizedtrigger.BuildTrigger>
8 <configs>
9 <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
10 <configs>
11 <hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
12 </configs>
13 <projects>archive</projects>
14 <condition>ALWAYS</condition>
15 <triggerWithNoParameters>false</triggerWithNoParameters>
16 </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
17 <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
18 <configs>
19 <hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
20 </configs>
21 <projects>cleanup</projects>
22 <condition>ALWAYS</condition>
23 <triggerWithNoParameters>false</triggerWithNoParameters>
24 </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
25 </configs>
26 </hudson.plugins.parameterizedtrigger.BuildTrigger>
27 </joinPublishers>
28 <evenIfDownstreamUnstable>true</evenIfDownstreamUnstable>
6 </join.JoinTrigger> 29 </join.JoinTrigger>
7 </publishers> 30 </publishers>
8</project> 31</project>
diff --git a/tests/publishers/fixtures/join-trigger001.yaml b/tests/publishers/fixtures/join-trigger001.yaml
index 6caf196..a0bba30 100644
--- a/tests/publishers/fixtures/join-trigger001.yaml
+++ b/tests/publishers/fixtures/join-trigger001.yaml
@@ -3,3 +3,10 @@ publishers:
3 projects: 3 projects:
4 - project-one 4 - project-one
5 - project-two 5 - project-two
6 even-if-unstable: true
7 publishers:
8 - trigger-parameterized-builds:
9 - project: archive
10 current-parameters: true
11 - project: cleanup
12 current-parameters: true