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

EMail-Ext does not send email, because or empty recipients

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • git-plugin, scm-api-plugin
    • None
    • master node on Ubuntu x64
      slave node on Windows

      I send my mail via groovy script in a multibranch-pipeline (blue ocean)

      script 
                  {
                      def currResult = getResultAsString(currentBuild)
                      def prevResult = getResultAsString(currentBuild.getPreviousBuild())
                      if (currResult != "SUCCESS" || prevResult != "SUCCESS") 
                      {
                           echo 'send mail'
                           emailext body: '''${SCRIPT, template="my-html.template"}''',
                                  recipientProviders: [[$class: 'DevelopersRecipientProvider'],
                                                       [$class: 'CulpritsRecipientProvider'],
                                                       [$class: 'UpstreamComitterRecipientProvider'],
                                                      ],
                                  subject: '[Jenkins]: ${JOB_NAME} ${BUILD_DISPLAY_NAME} - ' + currResult,
                                  mimeType: 'text/html'
                      }
                      
                  }
      
      def getResultAsString(build)
      {
          def result = build?.result
          if (result == null) {
              result = "SUCCESS"
          }
          return result;
      }
      

      When creating a new branch and adding a commit which will fail this build,
      jenkins will not send a email, with following message:

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

      However, when adding another commit to the same branch, jenkins, will now surprisingly have a commiter email address and can send the email.
      So always the first build of a new branch, email-ext will not retrieve a correct email from the commit.

      Can you please fix it?

          [JENKINS-51218] EMail-Ext does not send email, because or empty recipients

          Zack Snyder created issue -

          This is not actually a fault with emailext its with the SCM api. First build has no build to compare it to so no way to determine what has happened since. emailext purely asks the SCM api for this info

          David van Laatum added a comment - This is not actually a fault with emailext its with the SCM api. First build has no build to compare it to so no way to determine what has happened since. emailext purely asks the SCM api for this info
          David van Laatum made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          Zack Snyder added a comment -

          But it has the info who has committed the changes.
          So how can it be fixed? How can I get the developer of the current commit which is been building?

          Zack Snyder added a comment - But it has the info who has committed the changes. So how can it be fixed? How can I get the developer of the current commit which is been building?

          Determining who is the developer of a build is done by jenkins and the SCM api not emailext. If you look at the build details and you see no changelog emailext has no hope

          David van Laatum added a comment - Determining who is the developer of a build is done by jenkins and the SCM api not emailext. If you look at the build details and you see no changelog emailext has no hope
          Zack Snyder made changes -
          Attachment New: jenkins_changes.jpg [ 42564 ]

          Zack Snyder added a comment - - edited


          You are right, the git change log looks like its missing the important details...strange.
          davidvanlaatum
          Can you please reopen and change the assignee?

          Zack Snyder added a comment - - edited You are right, the git change log looks like its missing the important details...strange. davidvanlaatum Can you please reopen and change the assignee?
          Zack Snyder made changes -
          Component/s New: git-plugin [ 15543 ]
          Component/s New: scm-api-plugin [ 18054 ]
          David van Laatum made changes -
          Component/s Original: email-ext-plugin [ 15538 ]
          David van Laatum made changes -
          Assignee Original: David van Laatum [ davidvanlaatum ] New: Mark Waite [ markewaite ]
          Resolution Original: Won't Fix [ 2 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]

            Unassigned Unassigned
            zack Zack Snyder
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: