diff options
Diffstat (limited to 'jenkins_jobs/modules/publishers.py')
-rwxr-xr-x | jenkins_jobs/modules/publishers.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 68b93e73..48bb420c 100755 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -608,20 +608,12 @@ def trigger(registry, xml_parent, data): 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") supported_thresholds = ["SUCCESS", "UNSTABLE", "FAILURE"] - if threshold not in supported_thresholds: - raise JenkinsJobsException( - "threshold must be one of %s" % ", ".join(supported_thresholds) - ) - tname = XML.SubElement(tthreshold, "name") - tname.text = hudson_model.THRESHOLDS[threshold]["name"] - tordinal = XML.SubElement(tthreshold, "ordinal") - tordinal.text = hudson_model.THRESHOLDS[threshold]["ordinal"] - tcolor = XML.SubElement(tthreshold, "color") - tcolor.text = hudson_model.THRESHOLDS[threshold]["color"] + helpers.trigger_threshold( + tconfig, "threshold", threshold, supported_thresholds=supported_thresholds + ) def clone_workspace(registry, xml_parent, data): @@ -3501,11 +3493,13 @@ def join_trigger(registry, xml_parent, data): Trigger a job after all the immediate downstream jobs have completed. Requires the Jenkins :jenkins-plugins:`Join Plugin <join>`. - :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 + :arg str threshold: result threshold to trigger jobs (optional). + Valid values are "success", "unstable", "failure", and "aborted". + :arg bool even-if-unstable: if true jobs will trigger even if some + downstream jobs are marked as unstable (default false) (DEPRECATED) Example: @@ -3523,8 +3517,13 @@ def join_trigger(registry, xml_parent, data): for edited_node in create_publishers(registry, pub): publishers.append(edited_node) - unstable = str(data.get("even-if-unstable", "false")).lower() - XML.SubElement(jointrigger, "evenIfDownstreamUnstable").text = unstable + unstable = str(data.get("even-if-unstable", "")).lower() + if unstable: + XML.SubElement(jointrigger, "evenIfDownstreamUnstable").text = unstable + + threshold = data.get("threshold", "") + if threshold: + helpers.trigger_threshold(jointrigger, "resultThreshold", threshold) def jabber(registry, xml_parent, data): |