Merge "Adding publisher support to join-trigger plugin"

changes/71/206071/1
Jenkins 7 years ago committed by Gerrit Code Review
commit f1c34249cc
  1. 13
      jenkins_jobs/modules/publishers.py
  2. 23
      tests/publishers/fixtures/join-trigger001.xml
  3. 7
      tests/publishers/fixtures/join-trigger001.yaml

@ -2170,7 +2170,11 @@ def join_trigger(parser, xml_parent, data):
"""yaml: join-trigger
Trigger a job after all the immediate downstream jobs have completed
:arg bool even-if-unstable: if true jobs will trigger even if some
downstream jobs are marked as unstable (default false)
:arg list projects: list of projects to trigger
:arg list publishers: list of triggers from publishers module that
defines projects that need to be triggered
Example:
@ -2179,10 +2183,17 @@ def join_trigger(parser, xml_parent, data):
"""
jointrigger = XML.SubElement(xml_parent, 'join.JoinTrigger')
# Simple Project List
joinProjectsText = ','.join(data.get('projects', ['']))
XML.SubElement(jointrigger, 'joinProjects').text = joinProjectsText
publishers = XML.SubElement(jointrigger, 'joinPublishers')
for pub in data.get('publishers', []):
for edited_node in create_publishers(parser, pub):
publishers.append(edited_node)
unstable = str(data.get('even-if-unstable', 'false')).lower()
XML.SubElement(jointrigger, 'evenIfDownstreamUnstable').text = unstable
def jabber(parser, xml_parent, data):
"""yaml: jabber

@ -3,6 +3,29 @@
<publishers>
<join.JoinTrigger>
<joinProjects>project-one,project-two</joinProjects>
<joinPublishers>
<hudson.plugins.parameterizedtrigger.BuildTrigger>
<configs>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<configs>
<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
</configs>
<projects>archive</projects>
<condition>ALWAYS</condition>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<configs>
<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
</configs>
<projects>cleanup</projects>
<condition>ALWAYS</condition>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
</hudson.plugins.parameterizedtrigger.BuildTrigger>
</joinPublishers>
<evenIfDownstreamUnstable>true</evenIfDownstreamUnstable>
</join.JoinTrigger>
</publishers>
</project>

@ -3,3 +3,10 @@ publishers:
projects:
- project-one
- project-two
even-if-unstable: true
publishers:
- trigger-parameterized-builds:
- project: archive
current-parameters: true
- project: cleanup
current-parameters: true

Loading…
Cancel
Save