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

Send mail to previous build recipients if current build has none

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • email-ext-plugin
    • None
    • 2.89

      I do have a configured job that executes different steps depending on the trigger:

      • A commit trigger (continuous build) - the build only executes the compilation and unit tests.
      • A timed trigger (nighty build) - the build executes compilation, unit tests, deployment and integration tests
      • A manual trigger - build executes all steps that are selected by the person triggering the build

      My Jenkinsfile looks this:

      post {
         // Send an email
         always {
             emailext( 
                 subject: '$DEFAULT_SUBJECT', 
                 to: '$DEFAULT_RECIPIENTS',
                 recipientProviders: [culprits(), developers(), requestor()], 
                 replyTo: '$DEFAULT_REPLYTO', 
                 body: '$DEFAULT_CONTENT')
          }
      }
      

      This does result in the following behavior:

      • A commit is pushed, build is triggered, result is send to the committer
      • A manual build is triggered, result is send to the requestor

      This however causes issues for the timed trigger:

      If a previous build (usually the commit triggered) is successful, but the timed trigger fails for some reason no mail is send since there is no requestor (obviously) but since there is no changeset (since there are no changes) no developer or culprit can be identified.

      Mails are only send for the timed trigger if the previous build failed as well.

      I feel that it would be a good idea that the determination of the developer / culprit is extended to find the previous changeset or the mail recipients of the previous build, in case the current changeset is empty. This could well be combined with a status change of the build as well.

      Maybe my configuration is too special to begin with - so any suggestions are highly welcome

            strangelookingnerd Daniel Krämer
            strangelookingnerd Daniel Krämer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: