From c588b842e86b3d82738aa20c1f61ed64296e5c82 Mon Sep 17 00:00:00 2001 From: Liu Changcheng Date: Wed, 17 Aug 2016 13:48:32 +0800 Subject: [PATCH] add post-send script option We need post-send script option to configure presendScript in the generated configure xml. When setting post-send as below: postsend-script: $DEFAULT_POSTSEND_SCRIPT We could see below informaton in the generated configure xml. $DEFAULT_POSTSEND_SCRIPT Change-Id: Ic215b2f3a9b5e7361a2cc1772226382da341ecd1 Signed-off-by: Liu Changcheng Signed-off-by: Jerry Liu --- jenkins_jobs/modules/publishers.py | 4 ++++ tests/publishers/fixtures/email-ext001.xml | 1 + tests/publishers/fixtures/email-ext001.yaml | 1 + tests/publishers/fixtures/email-ext002.xml | 1 + .../fixtures/template_override_project_level_defaults.xml | 1 + 5 files changed, 8 insertions(+) diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index c80d57103..13d89f8c3 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -1913,6 +1913,8 @@ def email_ext(parser, xml_parent, data): :arg bool pre-build: Send an email before the build (default false) :arg str presend-script: A Groovy script executed prior sending the mail. (default '') + :arg str postsend-script: A Goovy script executed after sending the email. + (default '') :arg bool save-output: Save email content to workspace (default false) :arg str matrix-trigger: If using matrix projects, when to trigger @@ -1990,6 +1992,8 @@ def email_ext(parser, xml_parent, data): 'attachments', '') XML.SubElement(emailext, 'presendScript').text = data.get( 'presend-script', '') + XML.SubElement(emailext, 'postsendScript').text = data.get( + 'postsend-script', '') XML.SubElement(emailext, 'attachBuildLog').text = str(data.get( 'attach-build-log', False)).lower() XML.SubElement(emailext, 'compressBuildLog').text = str(data.get( diff --git a/tests/publishers/fixtures/email-ext001.xml b/tests/publishers/fixtures/email-ext001.xml index 2e62a61d4..c4b92c745 100644 --- a/tests/publishers/fixtures/email-ext001.xml +++ b/tests/publishers/fixtures/email-ext001.xml @@ -164,6 +164,7 @@ The build has finished */foo*.log cancel=true + cancel=true false false true diff --git a/tests/publishers/fixtures/email-ext001.yaml b/tests/publishers/fixtures/email-ext001.yaml index 8b6201af3..2fa27aad4 100644 --- a/tests/publishers/fixtures/email-ext001.yaml +++ b/tests/publishers/fixtures/email-ext001.yaml @@ -24,6 +24,7 @@ publishers: pre-build: true matrix-trigger: only-configurations presend-script: "cancel=true" + postsend-script: "cancel=true" save-output: true send-to: - developers diff --git a/tests/publishers/fixtures/email-ext002.xml b/tests/publishers/fixtures/email-ext002.xml index 835d883d7..991f7b954 100644 --- a/tests/publishers/fixtures/email-ext002.xml +++ b/tests/publishers/fixtures/email-ext002.xml @@ -21,6 +21,7 @@ The build has finished */foo*.log + true true false diff --git a/tests/yamlparser/fixtures/template_override_project_level_defaults.xml b/tests/yamlparser/fixtures/template_override_project_level_defaults.xml index cbc94049a..10807152e 100644 --- a/tests/yamlparser/fixtures/template_override_project_level_defaults.xml +++ b/tests/yamlparser/fixtures/template_override_project_level_defaults.xml @@ -32,6 +32,7 @@ $DEFAULT_CONTENT + false false false