0

So my goal is to have Jenkins send an email to developer who was involved with any code changes in the repo in Mercurial. I have set up my hooks on Mercurial and now whenever I do any sort of changes on the repo a build executes on Jenkins which builds without any issue. The problem now is its only sending it to the email that I have configured in Jenkins and not the email of the developer who made the changes. On Mercurial I made sure to make the user the email I primarily use. I was pretty sure the code below would be able to access the email of the developer who made the changes:

pipeline {
   agent any

   stages {
      stage('Hello') {
         steps {
            echo 'Hello World'
         }
      }
   }

   post {
    always {
    emailext body: 'A Test EMail', recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: 'Test'
    }
}
}

Given that it hasnt I am suspecting that Jenkins is not aware of the email of the developer who made the changes. How do I tell Jenkins about the email of the developer who made the changes? I also made sure to install all of the email plugins for Jenkins btw but still no luck.

2 Answers2

0

I think you are looking for the Email Extension plugin.

Lets you configure for "Default Recipients", "Developers", "Culprits", "Requester" and more.

There's also an Email Extension Template plugin available.

Ian W
  • 4,559
  • 2
  • 18
  • 37
  • I have installed those plugins and based on my pipeline code it appears that I have called the recipients but nothing happens. – BrogrammerDude May 25 '20 at 19:06
0
  1. Add Build Step and select execute windows batch command
  2. Get the log of recent commit and select username from the result "hg log --limit 1"

  3. Configure this email in Email Extension Plugin

FreeBird
  • 230
  • 2
  • 4