• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • email-ext-plugin, pipeline
    • None
    • Jenkins 2.106, email-ext 2.61, Pipeline 2.5

      I have a function that defines the emailex configuration like this:

      def sendNotification(buildChanged) {
          // Some extra logic removed for presentation purposes.
          emailext (
                  subject: "[CI] ${env.JOB_NAME} ${env.BUILD_NUMBER} still unstable",
                  body: "Build still unstable: ${env.BUILD_URL}",
                  recipientProviders: [[
                      $class: "DevelopersRecipientProvider",
                      $class: "RequesterRecipientProvider"
                  ]]
              )
      }

         then I do this for notifications:

                  post {
                      always {
                          junit "reports/**/test*.xml"
                      }
                      changed {
                          sendNotification buildChanged: true
                      }
                      failure {
                          sendNotification buildChanged: false
                      }
                      unstable {
                          sendNotification buildChanged: false
                      }
                  }

      Unfortunately what happens after a commit is this:

      An attempt to send an e-mail to empty list of recipients, ignored.

      The developer list is definitely not empty. So the expected result is not empty.

      Am I missing something? Also, somewhat related to this, is there a plan for a nicer syntax for the pipelines, especially for the declarative one? Configuring notifications right now, especially more complex ones, is tedious and error prone.

          [JENKINS-49583] Adding multiple recipientProviders

          I can't comment on pipeline syntax I am not involved in that at all.

          This all looks fine to me and should work the function is not annotated @NonCPS or something is it? the way you have posted it this should be the same as if you called emailext at each location directly

          David van Laatum added a comment - I can't comment on pipeline syntax I am not involved in that at all. This all looks fine to me and should work the function is not annotated @NonCPS or something is it? the way you have posted it this should be the same as if you called emailext at each location directly

          Andrew Bayer added a comment -

          Syntax for the emailext step can be improved by adding @Symbol annotations to the various provider classes's Descriptor classes, fyi.

          Andrew Bayer added a comment - Syntax for the emailext step can be improved by adding @Symbol annotations to the various provider classes's Descriptor classes, fyi.

          Costin Caraivan added a comment - - edited

          For other poor souls that want to configure this, the correct syntax is:

                  recipientProviders: [
                      [ $class: "DevelopersRecipientProvider" ],
                      [ $class: "RequesterRecipientProvider" ],
                      [ $class: "CulpritsRecipientProvider"]
                  ]
          

          So it's actually nested arrays. The documentation does say it, so my bad here, I'll close this issue.

          I will create a separate issue about the emailext UX when using the pipelines.

           

           

          Costin Caraivan added a comment - - edited For other poor souls that want to configure this, the correct syntax is:         recipientProviders: [             [ $class: "DevelopersRecipientProvider" ],             [ $class: "RequesterRecipientProvider" ],             [ $class: "CulpritsRecipientProvider" ]         ] So it's actually nested arrays . The documentation does say it, so my bad here, I'll close this issue. I will create a separate issue about the emailext UX when using the pipelines.    

          Had the wrong syntax for the configuration.

          Costin Caraivan added a comment - Had the wrong syntax for the configuration.

            davidvanlaatum David van Laatum
            ccaraivan Costin Caraivan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: