Add BuildTrigger support
Change-Id: I85caf018a69a24e83a58b76d114c962f1516e104 Reviewed-on: https://review.openstack.org/14736 Reviewed-by: James E. Blair <corvus@inaugust.com> Approved: Clark Boylan <clark.boylan@gmail.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Tested-by: Jenkins
This commit is contained in:
parent
2208256583
commit
090eab01db
@ -1,4 +1,5 @@
|
||||
# Copyright 2012 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright 2012 Varnish Software AS
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -109,6 +110,52 @@ def trigger_parameterized_builds(parser, xml_parent, data):
|
||||
trigger_with_no_params.text = 'false'
|
||||
|
||||
|
||||
def trigger(parser, xml_parent, data):
|
||||
"""yaml: trigger
|
||||
Trigger non-parametrised builds of other jobs.
|
||||
|
||||
:arg str project: name of the job to trigger
|
||||
:arg str threshold: when to trigger the other job (default 'SUCCESS'),
|
||||
alternatives: SUCCESS, UNSTABLE, FAILURE
|
||||
|
||||
Example::
|
||||
|
||||
publishers:
|
||||
- trigger:
|
||||
project: other_job
|
||||
"""
|
||||
thresholds = {
|
||||
'SUCCESS': {
|
||||
'ordinal': '0',
|
||||
'color': 'BLUE'
|
||||
},
|
||||
'UNSTABLE': {
|
||||
'ordinal': '1',
|
||||
'color': 'YELLOW'
|
||||
},
|
||||
'FAILURE': {
|
||||
'ordinal': '2',
|
||||
'color': 'RED'
|
||||
}
|
||||
}
|
||||
|
||||
tconfig = XML.SubElement(xml_parent, 'hudson.tasks.BuildTrigger')
|
||||
childProjects = XML.SubElement(tconfig, 'childProjects')
|
||||
childProjects.text = data['project']
|
||||
tthreshold = XML.SubElement(tconfig, 'threshold')
|
||||
|
||||
threshold = data.get('threshold', 'SUCCESS')
|
||||
if threshold not in thresholds.keys():
|
||||
raise Exception("threshold must be one of " +
|
||||
", ".join(threshold.keys()))
|
||||
tname = XML.SubElement(tthreshold, 'name')
|
||||
tname.text = threshold
|
||||
tordinal = XML.SubElement(tthreshold, 'ordinal')
|
||||
tordinal.text = thresholds[threshold]['ordinal']
|
||||
tcolor = XML.SubElement(tthreshold, 'color')
|
||||
tcolor.text = thresholds[threshold]['color']
|
||||
|
||||
|
||||
def coverage(parser, xml_parent, data):
|
||||
"""yaml: coverage
|
||||
Generate a cobertura coverage report.
|
||||
|
1
setup.py
1
setup.py
@ -64,6 +64,7 @@ setup(name='jenkins_job_builder',
|
||||
'archive=jenkins_jobs.modules.publishers:archive',
|
||||
'trigger-parameterized-builds='
|
||||
'jenkins_jobs.modules.publishers:trigger_parameterized_builds',
|
||||
'trigger=jenkins_jobs.modules.publishers:trigger',
|
||||
'coverage=jenkins_jobs.modules.publishers:coverage',
|
||||
'ftp=jenkins_jobs.modules.publishers:ftp',
|
||||
'junit=jenkins_jobs.modules.publishers:junit',
|
||||
|
Loading…
x
Reference in New Issue
Block a user