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

smtpHost ignored when CasC attempts to set smtpUsername / smtpPassword

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: email-ext-plugin
    • Environment:
      Jenkins lts version 2.164.3
      email-ext 2.66
      configuration-as-code:1.15
      configuration-as-code-support:1.15
    • Similar Issues:

      Description

      Configuring the email-ext plugin using the CasC plugin, the smtpHost is ignored when also setting the smtpUsername / smtpPassword authentication fields.

      The Email Extension plugin can be set up 'hands on' in the UI, so using the necessary fields described in the CasC documentation, I set up something like this:

        extendedEmailPublisher: 
          smtpServer: smtp.server.com
          smtpUsername: alerts@company.com
          smtpPassword: ${SMTPpass}
          useSsl: true
          charset: UTF-8
          defaultContentType: text/plain
          defaultSubject: "Build $BUILD_NUMBER - $BUILD_STATUS"
          defaultBody: "Check console output at $BUILD_URL"
      

      But adding the smtpUsername / smtpPassword fields seems to cause the 'smtpServer' value to be ignored completely (it's not ignored when the smtpUsername / smtpPassword fields are not present). Instead, the 'smtpHost' value from the Mailer plugin configuration is used in its place

      In order to get SMTP authentication working for the Email Extension plugin, I used this setup:

        mailer: 
          smtpHost: smtp.server.com
          useSsl: true
          charset: UTF-8
        extendedEmailPublisher: 
          smtpUsername: alerts@company.com
          smtpPassword: ${SMTPpass}
          defaultContentType: text/plain
          defaultSubject: "Build $BUILD_NUMBER - $BUILD_STATUS"
          defaultBody: "Check console output at $BUILD_URL"
      

      It's not ideal that part of the configuration lives in each plugin though (the mailer plugin does not support SMTP auth fields - JENKINS-55109)

      See also: https://github.com/jenkinsci/configuration-as-code-plugin/issues/772

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              robin_smith Robin Smith
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: