multijob: added kill-phase-on option
this option allows terminate job phase on specific status of job Change-Id: I5984fb2494120afc97140c1ae38635301e8f1376 Signed-off-by: Lukas Bednar <lbednar@redhat.com>
This commit is contained in:
parent
fe693157cc
commit
fa8ae1c60f
|
@ -803,10 +803,13 @@ def multijob(parser, xml_parent, data):
|
|||
to the other job (optional)
|
||||
* **predefined-parameters** (`str`) -- Pass predefined
|
||||
parameters to the other job (optional)
|
||||
* **kill-phase-on** (`str`) -- Stop the phase execution
|
||||
on specific job status. Can be 'FAILURE', 'UNSTABLE',
|
||||
'NEVER'. (optional)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: ../../tests/builders/fixtures/multibuild.yaml
|
||||
.. literalinclude:: /../../tests/builders/fixtures/multibuild.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
builder = XML.SubElement(xml_parent, 'com.tikal.jenkins.plugins.multijob.'
|
||||
|
@ -818,6 +821,8 @@ def multijob(parser, xml_parent, data):
|
|||
|
||||
phaseJobs = XML.SubElement(builder, 'phaseJobs')
|
||||
|
||||
kill_status_list = ('FAILURE', 'UNSTABLE', 'NEVER')
|
||||
|
||||
for project in data.get('projects', []):
|
||||
phaseJob = XML.SubElement(phaseJobs, 'com.tikal.jenkins.plugins.'
|
||||
'multijob.PhaseJobsConfig')
|
||||
|
@ -870,6 +875,19 @@ def multijob(parser, xml_parent, data):
|
|||
properties = XML.SubElement(param, 'properties')
|
||||
properties.text = predefined_parameters
|
||||
|
||||
# Kill phase on job status
|
||||
kill_status = project.get('kill-phase-on')
|
||||
if kill_status is not None:
|
||||
kill_status = kill_status.upper()
|
||||
if kill_status not in kill_status_list:
|
||||
raise JenkinsJobsException(
|
||||
'multijob kill-phase-on must be one of: %s'
|
||||
+ ','.join(kill_status_list))
|
||||
XML.SubElement(
|
||||
phaseJob,
|
||||
'killPhaseOnJobResultCondition'
|
||||
).text = kill_status
|
||||
|
||||
|
||||
def grails(parser, xml_parent, data):
|
||||
"""yaml: grails
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
<jobName>PhaseTwoJobB</jobName>
|
||||
<currParams>false</currParams>
|
||||
<configs/>
|
||||
<killPhaseOnJobResultCondition>UNSTABLE</killPhaseOnJobResultCondition>
|
||||
</com.tikal.jenkins.plugins.multijob.PhaseJobsConfig>
|
||||
</phaseJobs>
|
||||
</com.tikal.jenkins.plugins.multijob.MultiJobBuilder>
|
||||
|
|
|
@ -20,3 +20,4 @@ builders:
|
|||
predefined-parameters: foo=bar
|
||||
- name: PhaseTwoJobB
|
||||
current-parameters: false
|
||||
kill-phase-on: UNSTABLE
|
||||
|
|
Loading…
Reference in New Issue