From abaa7fde6c8c234d990a99e577ec64eb900ddf52 Mon Sep 17 00:00:00 2001 From: Randy Coulman Date: Mon, 10 Mar 2014 07:34:22 -0700 Subject: [PATCH] Support the new Always trigger type. Support for this trigger was added in email-ext v2.36. See https://issues.jenkins-ci.org/browse/JENKINS-20013 for more details. Change-Id: Ibfb3ec96218fc7133439e17853638593fed41a44 --- jenkins_jobs/modules/publishers.py | 3 +++ tests/publishers/fixtures/email-ext001.xml | 11 +++++++++++ tests/publishers/fixtures/email-ext001.yaml | 1 + 3 files changed, 15 insertions(+) diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index c16d1c919..ef8f3538e 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -1392,6 +1392,7 @@ def email_ext(parser, xml_parent, data): javascript to hook into the Jenkins API itself :arg bool attach-build-log: Include build log in the email (default false) :arg str attachments: pattern of files to include as attachment (optional) + :arg bool always: Send an email for every result (default false) :arg bool unstable: Send an email for an unstable result (default false) :arg bool first-failure: Send an email for just the first failure (default false) @@ -1426,6 +1427,8 @@ def email_ext(parser, xml_parent, data): else: XML.SubElement(emailext, 'recipientList').text = '$DEFAULT_RECIPIENTS' ctrigger = XML.SubElement(emailext, 'configuredTriggers') + if data.get('always', False): + base_email_ext(parser, ctrigger, data, 'AlwaysTrigger') if data.get('unstable', False): base_email_ext(parser, ctrigger, data, 'UnstableTrigger') if data.get('first-failure', False): diff --git a/tests/publishers/fixtures/email-ext001.xml b/tests/publishers/fixtures/email-ext001.xml index 33d42121c..5798d3033 100644 --- a/tests/publishers/fixtures/email-ext001.xml +++ b/tests/publishers/fixtures/email-ext001.xml @@ -4,6 +4,17 @@ foo@example.com, bar@example.com + + + + $PROJECT_DEFAULT_SUBJECT + $PROJECT_DEFAULT_CONTENT + false + false + false + true + + diff --git a/tests/publishers/fixtures/email-ext001.yaml b/tests/publishers/fixtures/email-ext001.yaml index 78ef49059..543d6cc8c 100644 --- a/tests/publishers/fixtures/email-ext001.yaml +++ b/tests/publishers/fixtures/email-ext001.yaml @@ -7,6 +7,7 @@ publishers: body: The build has finished attach-build-log: false attachments: "*/foo*.log" + always: true unstable: true first-failure: true not-built: true