Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64659

Email extension templates not expanding environment variables

    • token-macro 2.14

      I have verified that this occurs when I upgrade Jenkins from 2.273 to 2.274. Up until that version, this works perfectly:

       

      From: jenkins_server06@pridedallas.com jenkins_server06@pridedallas.com
      Sent: Monday, January 18, 2021 6:59 PM
      To: # IT
      Subject: PHP-Master - Build # 202 - Successful!

       

      PHP-Master - Build # 202 - Successful: Check console output at http://jenkins.pridedallas.com:9999/job/PHP-Master/202/ to view the results.


      Now, I get this:

      From: jenkins_server06@pridedallas.com jenkins_server06@pridedallas.com
      Sent: Monday, January 18, 2021 7:21 PM
      To: # IT
      Subject: $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!

       

      $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.

       


      Windows Server 2019

       

          [JENKINS-64659] Email extension templates not expanding environment variables

          Keith Davis created issue -
          Keith Davis made changes -
          Description Original: I have verified that this occurs when I upgrade Jenkins from 2.73 to 2.74. Up until that version, this works perfectly:

          !image-2021-01-18-19-34-19-144.png|width=452,height=241!

           

          *From:* jenkins_server06@pridedallas.com [mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 6:59 PM
           *To:* # IT
           *Subject:* PHP-Master - Build # 202 - Successful!

           

          PHP-Master - Build # 202 - Successful: Check console output at http://jenkins.pridedallas.com:9999/job/PHP-Master/202/ to view the results.
          ----
          Now, I get this:

          *From:* jenkins_server06@pridedallas.com [mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 7:21 PM
           *To:* # IT
           *Subject:* $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!

           

          $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.

           
          ----
          Windows Server 2008 R2

           
          New: I have verified that this occurs when I upgrade Jenkins from 2.73 to 2.74. Up until that version, this works perfectly:

          !image-2021-01-18-19-34-19-144.png|width=452,height=241!

           

          *From:* jenkins_server06@pridedallas.com [jenkins_server06@pridedallas.com|mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 6:59 PM
           *To:* # IT
           *Subject:* PHP-Master - Build # 202 - Successful!

           

          PHP-Master - Build # 202 - Successful: Check console output at [http://jenkins.pridedallas.com:9999/job/PHP-Master/202/] to view the results.
          ----
          Now, I get this:

          *From:* jenkins_server06@pridedallas.com [jenkins_server06@pridedallas.com|mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 7:21 PM
           *To:* # IT
           *Subject:* $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!

           

          $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.

           
          ----
          Windows Server 2019

           

          Keith Davis added a comment -

          I just verified that it is broken in 2.275 as well.

          Keith Davis added a comment - I just verified that it is broken in 2.275 as well.

          Mark Waite added a comment -

          laurin1 can you clarify if you were really upgrading from 2.73 to 2.74 (200 weekly releases ago) or if you were upgrading from 2.273 to 2.274?

          Mark Waite added a comment - laurin1 can you clarify if you were really upgrading from 2.73 to 2.74 (200 weekly releases ago) or if you were upgrading from 2.273 to 2.274?

          Mark Waite added a comment -

          I am unable to duplicate the problem as described, laurin1. Can you provide more details on your configuration?

          Steps that I took:

          1. Enable extended email notification from my Jenkins 2.275 installation running in a Docker container on Linux
          2. Configure extended email notification with my gmail user name, a gmail app password, and SSL authentication (see the ExtendedEmailPublisher.xml file later in this reply)
          3. Confirm that a test email works from the system configuration page
          4. Create a Freestyle job that runs Ant with a target that does not exist
          5. Configure the extended email in the Freestyle job to notify the Build User in addition to the other users that are notified
          6. Confirm that the Freestyle job fails as expected and that email is set to me as the Build User
          7. Confirm that the email expanded all the variables that had been inserted into the default template
          8. Modify the email definition in the job with additional environment variables to expand
          9. Confirm that the Freestyle job fails as expected and that email set to me contains the modified content

          My hudson.plugins.emailext.ExtendedEmailPublisher.xml is (minus the password):

          <?xml version='1.1' encoding='UTF-8'?>
          <hudson.plugins.emailext.ExtendedEmailPublisherDescriptor plugin="email-ext@2.81">
            <defaultSuffix>@gmail.com</defaultSuffix>
            <mailAccount>
              <smtpHost>smtp.gmail.com</smtpHost>
              <smtpPort>465</smtpPort>
              <smtpUsername>mark.earl.waite@gmail.com</smtpUsername>
              <smtpPassword>intentionally-elided-password</smtpPassword>
              <useSsl>true</useSsl>
              <advProperties></advProperties>
              <defaultAccount>true</defaultAccount>
            </mailAccount>
            <addAccounts/>
            <charset>UTF-8</charset>
            <defaultContentType>text/html</defaultContentType>
            <defaultSubject>$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!</defaultSubject>
            <defaultBody>$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
          
          Check console output at $BUILD_URL to view the results.</defaultBody>
            <defaultPresendScript></defaultPresendScript>
            <defaultPostsendScript></defaultPostsendScript>
            <defaultClasspath/>
            <defaultTriggerIds>
              <string>hudson.plugins.emailext.plugins.trigger.FailureTrigger</string>
            </defaultTriggerIds>
            <emergencyReroute></emergencyReroute>
            <maxAttachmentSize>-1</maxAttachmentSize>
            <recipientList></recipientList>
            <defaultReplyTo></defaultReplyTo>
            <allowedDomains></allowedDomains>
            <excludedCommitters></excludedCommitters>
            <listId></listId>
            <precedenceBulk>false</precedenceBulk>
            <debugMode>false</debugMode>
            <requireAdminForTemplateTesting>false</requireAdminForTemplateTesting>
            <enableWatching>false</enableWatching>
            <enableAllowUnregistered>false</enableAllowUnregistered>
          </hudson.plugins.emailext.ExtendedEmailPublisherDescriptor>
          

          Mark Waite added a comment - I am unable to duplicate the problem as described, laurin1 . Can you provide more details on your configuration? Steps that I took: Enable extended email notification from my Jenkins 2.275 installation running in a Docker container on Linux Configure extended email notification with my gmail user name, a gmail app password, and SSL authentication (see the ExtendedEmailPublisher.xml file later in this reply) Confirm that a test email works from the system configuration page Create a Freestyle job that runs Ant with a target that does not exist Configure the extended email in the Freestyle job to notify the Build User in addition to the other users that are notified Confirm that the Freestyle job fails as expected and that email is set to me as the Build User Confirm that the email expanded all the variables that had been inserted into the default template Modify the email definition in the job with additional environment variables to expand Confirm that the Freestyle job fails as expected and that email set to me contains the modified content My hudson.plugins.emailext.ExtendedEmailPublisher.xml is (minus the password): <?xml version='1.1' encoding='UTF-8'?> <hudson.plugins.emailext.ExtendedEmailPublisherDescriptor plugin="email-ext@2.81"> <defaultSuffix>@gmail.com</defaultSuffix> <mailAccount> <smtpHost>smtp.gmail.com</smtpHost> <smtpPort>465</smtpPort> <smtpUsername>mark.earl.waite@gmail.com</smtpUsername> <smtpPassword>intentionally-elided-password</smtpPassword> <useSsl>true</useSsl> <advProperties></advProperties> <defaultAccount>true</defaultAccount> </mailAccount> <addAccounts/> <charset>UTF-8</charset> <defaultContentType>text/html</defaultContentType> <defaultSubject>$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!</defaultSubject> <defaultBody>$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.</defaultBody> <defaultPresendScript></defaultPresendScript> <defaultPostsendScript></defaultPostsendScript> <defaultClasspath/> <defaultTriggerIds> <string>hudson.plugins.emailext.plugins.trigger.FailureTrigger</string> </defaultTriggerIds> <emergencyReroute></emergencyReroute> <maxAttachmentSize>-1</maxAttachmentSize> <recipientList></recipientList> <defaultReplyTo></defaultReplyTo> <allowedDomains></allowedDomains> <excludedCommitters></excludedCommitters> <listId></listId> <precedenceBulk>false</precedenceBulk> <debugMode>false</debugMode> <requireAdminForTemplateTesting>false</requireAdminForTemplateTesting> <enableWatching>false</enableWatching> <enableAllowUnregistered>false</enableAllowUnregistered> </hudson.plugins.emailext.ExtendedEmailPublisherDescriptor>
          Keith Davis made changes -
          Description Original: I have verified that this occurs when I upgrade Jenkins from 2.73 to 2.74. Up until that version, this works perfectly:

          !image-2021-01-18-19-34-19-144.png|width=452,height=241!

           

          *From:* jenkins_server06@pridedallas.com [jenkins_server06@pridedallas.com|mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 6:59 PM
           *To:* # IT
           *Subject:* PHP-Master - Build # 202 - Successful!

           

          PHP-Master - Build # 202 - Successful: Check console output at [http://jenkins.pridedallas.com:9999/job/PHP-Master/202/] to view the results.
          ----
          Now, I get this:

          *From:* jenkins_server06@pridedallas.com [jenkins_server06@pridedallas.com|mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 7:21 PM
           *To:* # IT
           *Subject:* $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!

           

          $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.

           
          ----
          Windows Server 2019

           
          New: I have verified that this occurs when I upgrade Jenkins from 2.273 to 2.274. Up until that version, this works perfectly:

          !image-2021-01-18-19-34-19-144.png|width=452,height=241!

           

          *From:* jenkins_server06@pridedallas.com [jenkins_server06@pridedallas.com|mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 6:59 PM
           *To:* # IT
           *Subject:* PHP-Master - Build # 202 - Successful!

           

          PHP-Master - Build # 202 - Successful: Check console output at [http://jenkins.pridedallas.com:9999/job/PHP-Master/202/] to view the results.
          ----
          Now, I get this:

          *From:* jenkins_server06@pridedallas.com [jenkins_server06@pridedallas.com|mailto:jenkins_server06@pridedallas.com]
           *Sent:* Monday, January 18, 2021 7:21 PM
           *To:* # IT
           *Subject:* $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!

           

          $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.

           
          ----
          Windows Server 2019

           
          Labels Original: 2.74 New: 2.274

          Keith Davis added a comment -

          Oof! Yes, you are correct, it's 2.273 to 2.274 (my brain drops characters sometimes). I've fixed the description and the label. I was mistaken about one other thing as well, that it does appear to work with the email extension, where it's failing is the Email Extension Template plugin that seems to have this problem, not the Email Extension, as it's only when I'm using the templates.

          Keith Davis added a comment - Oof! Yes, you are correct, it's 2.273 to 2.274 (my brain drops characters sometimes). I've fixed the description and the label. I was mistaken about one other thing as well, that it does appear to work with the email extension, where it's failing is the Email Extension Template plugin that seems to have this problem, not the Email Extension, as it's only when I'm using the templates.
          Keith Davis made changes -
          Component/s New: emailext-template-plugin [ 18764 ]
          Component/s Original: email-ext-plugin [ 15538 ]
          Mark Waite made changes -
          Summary Original: Email Extension not expanding environment variables New: Email extension templates not expanding environment variables

          Keith Davis added a comment -

          So until this is fixed, we are stuck on 2.273. Anything that I can do to help the process?

          Keith Davis added a comment - So until this is fixed, we are stuck on 2.273. Anything that I can do to help the process?

            Unassigned Unassigned
            laurin1 Keith Davis
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: