diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 7f953131a..53c7be83e 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -2956,7 +2956,7 @@ def post_tasks(parser, xml_parent, data): matches_xml, 'hudson.plugins.postbuildtask.LogProperties') XML.SubElement(lt_xml, 'logText').text = str( - match.get('log-text', '')) + match.get('log-text', False) or '') XML.SubElement(lt_xml, 'operator').text = str( match.get('operator', 'AND')).upper() XML.SubElement(task_xml, 'EscalateStatus').text = str( diff --git a/tests/publishers/fixtures/post-tasks002.xml b/tests/publishers/fixtures/post-tasks002.xml new file mode 100644 index 000000000..33e03c4ef --- /dev/null +++ b/tests/publishers/fixtures/post-tasks002.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <publishers> + <hudson.plugins.postbuildtask.PostbuildTask> + <tasks> + <hudson.plugins.postbuildtask.TaskProperties> + <logTexts> + <hudson.plugins.postbuildtask.LogProperties> + <logText/> + <operator>AND</operator> + </hudson.plugins.postbuildtask.LogProperties> + </logTexts> + <EscalateStatus>true</EscalateStatus> + <RunIfJobSuccessful>true</RunIfJobSuccessful> + <script>echo "Here goes the task script" +</script> + </hudson.plugins.postbuildtask.TaskProperties> + </tasks> + </hudson.plugins.postbuildtask.PostbuildTask> + </publishers> +</project> diff --git a/tests/publishers/fixtures/post-tasks002.yaml b/tests/publishers/fixtures/post-tasks002.yaml new file mode 100644 index 000000000..2f7352402 --- /dev/null +++ b/tests/publishers/fixtures/post-tasks002.yaml @@ -0,0 +1,9 @@ +publishers: + - post-tasks: + - matches: + - log-text: null + operator: AND + escalate-status: true + run-if-job-successful: true + script: | + echo "Here goes the task script"