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

No E-Mail sent when build of new branch fails for first time

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • Email-ext 2.38.1, Jenkins 1.575

      Steps to reproduce my problem:

      1. Using GIT for SCM and Jenkins is set up to trigger build on SCM change
      2. Master branch is building fine and all tests are passing
      3. Create new branch from master
      4. Break something so build fails and push to the new branch
      5. Build is triggered in Jenkins by SCM change (but it says "No changes")

      Expected result is that email-ext plugin sends notification of build failure to the person who first pushed to the new branch. But actually no e-mail is sent and the log says:

      Email was triggered for: Failure - Any
      Sending email for trigger: Failure - Any
      An attempt to send an e-mail to empty list of recipients, ignored.
      Finished: FAILURE
      

      The "Failure - Any" trigger has Developers and Culprits set under "Send To". When a second commit is made to the new branch by the same person, the trigger works fine - it finds the e-mail address of the culprit and sends the e-mail.

          [JENKINS-24638] No E-Mail sent when build of new branch fails for first time

          Kaupo Kuresson created issue -

          Alex Earl added a comment -

          If Jenkins says "no changes" then email-ext will also see no changes and there won't be developers or culprits. This sounds like an issue in either core or git scm.

          Alex Earl added a comment - If Jenkins says "no changes" then email-ext will also see no changes and there won't be developers or culprits. This sounds like an issue in either core or git scm.
          Alex Earl made changes -
          Assignee Original: Alex Earl [ slide_o_mix ]

          Alex Earl added a comment -

          If the build doesn't see any changes, then email-ext won't see them either. This needs to be addressed in the SCM.

          Alex Earl added a comment - If the build doesn't see any changes, then email-ext won't see them either. This needs to be addressed in the SCM.
          Alex Earl made changes -
          Component/s New: git [ 15543 ]
          Component/s Original: email-ext [ 15538 ]
          Alex Earl made changes -
          Labels Original: email-ext

          Daniel Beck added a comment -

          The obvious workaround of course is to trigger the first build immediately after branch creation, so there's a reference point for the first failing build's changelog to compare to.

          Daniel Beck added a comment - The obvious workaround of course is to trigger the first build immediately after branch creation, so there's a reference point for the first failing build's changelog to compare to.
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 157665 ] New: JNJira + In-Review [ 179641 ]

          John McGehee added a comment - - edited

          I encountered this same issue with Jenkins 2.19.2, and email-ext 2.52. I did some further experiments, and my results contradict some of the previous comments.

          I am running email-ext as described in Sending Notifications in Pipeline. As part of my experiments, I used all the recipient providers I know:

               def recipients = [[$class: 'CulpritsRecipientProvider'],
                                [$class: 'UpstreamComitterRecipientProvider'],
                                [$class: 'RequesterRecipientProvider'],
                                [$class: 'DevelopersRecipientProvider'],
                                [$class: 'FailingTestSuspectsRecipientProvider'],
                                [$class: 'FirstFailingBuildSuspectsRecipientProvider']]

          I tried two scenarios.

          Push without modification

          I started with a branch into which I had purposely introduced a failure. When Jenkins builds this failing branch, it sends a notification email.

          I created a new branch, and pushed it without modification:

          git checkout -b notifybuild4
          git push --set-upstream origin notifybuild4

          Jenkins built this new branch and failed as expected, but no email was sent, because the providers yielded no recipients:

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

          Building branch notifybuild4 a second time resulted in an email being sent.

          I expected the recipient providers to yield the same email addresses in all these situations:

          • When the original branch was built (this works)
          • When branch notifybuild4 was first pushed (this does not work)
          • When branch notifybuild4 was re-built (this works)

          Push with modification

          Starting with branch notifybuild4 (which fails as described above), I created a new branch, made an immaterial change and and pushed it:

          git checkout -b notifybuild5
          atom Jenkinsfile    # Add an empty line
          git add Jenkinsfile 
          git commit
          git push --set-upstream origin notifybuild5

          Once again, Jenkins' build of this new branch failed as expected, but no email was sent, because the providers yielded no recipients according to the console output from email-ext:

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

          Building branch notifybuild5 a second time resulted in an email being sent.

          I expected the recipient providers to yield the same email addresses in all these situations:

          • When branch notifybuild4 was rebuilt (this works)
          • When branch notifybuild5 was first pushed (this does not work)
          • When branch notifybuild5 was re-built (this works)

          John McGehee added a comment - - edited I encountered this same issue with Jenkins 2.19.2, and email-ext 2.52. I did some further experiments, and my results contradict some of the previous comments. I am running email-ext as described in Sending Notifications in Pipeline . As part of my experiments, I used all the recipient providers I know: def recipients = [[$class: 'CulpritsRecipientProvider' ], [$class: 'UpstreamComitterRecipientProvider' ], [$class: 'RequesterRecipientProvider' ], [$class: 'DevelopersRecipientProvider' ], [$class: 'FailingTestSuspectsRecipientProvider' ], [$class: 'FirstFailingBuildSuspectsRecipientProvider' ]] I tried two scenarios. Push without modification I started with a branch into which I had purposely introduced a failure. When Jenkins builds this failing branch, it sends a notification email. I created a new branch, and pushed it without modification: git checkout -b notifybuild4 git push --set-upstream origin notifybuild4 Jenkins built this new branch and failed as expected, but no email was sent, because the providers yielded no recipients: An attempt to send an e-mail to empty list of recipients, ignored. Building branch notifybuild4 a second time resulted in an email being sent. I expected the recipient providers to yield the same email addresses in all these situations: When the original branch was built (this works) When branch notifybuild4 was first pushed (this does not work) When branch notifybuild4 was re-built (this works) Push with modification Starting with branch notifybuild4 (which fails as described above), I created a new branch, made an immaterial change and and pushed it: git checkout -b notifybuild5 atom Jenkinsfile # Add an empty line git add Jenkinsfile git commit git push --set-upstream origin notifybuild5 Once again, Jenkins' build of this new branch failed as expected, but no email was sent, because the providers yielded no recipients according to the console output from email-ext : An attempt to send an e-mail to empty list of recipients, ignored. Building branch notifybuild5 a second time resulted in an email being sent. I expected the recipient providers to yield the same email addresses in all these situations: When branch notifybuild4 was rebuilt (this works) When branch notifybuild5 was first pushed (this does not work) When branch notifybuild5 was re-built (this works)

          Daniel Beck added a comment -

          I started with a branch into which I had purposely introduced a failure. I created a new branch, and pushed it without modification

          The idea I mentioned was to create the branch from a master/trunk that builds successfully, so the first build of the branch is identical to master/trunk, and only then introduce changes that could break things.

          As there's no previous build for the branch, Jenkins has nothing to compare it to to determine who should be emailed. The developer of the last commit? May not be the culprit if there's several changes pushed. Everyone in the history of the branch? Too many false positives.

          It would be nice if there were metadata from e.g. comparing the branch to master/trunk, but that's SCM specific. Not sure whether SCM API could do that, and whether the email plugins could take that into account. stephenconnolly?

          Daniel Beck added a comment - I started with a branch into which I had purposely introduced a failure. I created a new branch, and pushed it without modification The idea I mentioned was to create the branch from a master/trunk that builds successfully, so the first build of the branch is identical to master/trunk, and only then introduce changes that could break things. As there's no previous build for the branch, Jenkins has nothing to compare it to to determine who should be emailed. The developer of the last commit? May not be the culprit if there's several changes pushed. Everyone in the history of the branch? Too many false positives. It would be nice if there were metadata from e.g. comparing the branch to master/trunk, but that's SCM specific. Not sure whether SCM API could do that, and whether the email plugins could take that into account. stephenconnolly ?

            Unassigned Unassigned
            kaupo Kaupo Kuresson
            Votes:
            11 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: