3

I have the latest version of Jenkins set up, along with the email extension plugin. Email is scheduled to be sent whenever a build fails to all the relevant patch authors.

The issue I am seeing is that the email being sent out is to email addresses that are out of date. I had my team update their local git config settings to make sure that new check ins are being registered with the current user email address, but this doesn't seem to correct the problem.

Where does Jenkins get the e-mail addresses from in Git, and how do you update them when they aren't current?

UPDATE:

Peter's answer is good info, but it only a start. I have not completely solved this problem, but I have noticed something. While there are permissions that git itself uses for check ins, GitHub can have multiple alternate email addresses, and there are a variety of other 3rd party tools that wrap or interact with Git. (Visual Studio for example).

It seems that some of these tools can insert credentials into check ins. If you are trying to solve this problem check the credentials of all the tools being used.

Also, check the users page in Jenkins. Jenkins automatically ingests in users it encounters while building branches, and if there are perms that were incorrectly entered (say, with a personal email address instead of a business address), they will show up there. This is a great way to find git users with bad git configurations.

Roger Hill
  • 3,677
  • 1
  • 34
  • 38
  • Additionally, it seems that if you start off with a username and email in git, Jenkins will create a Jenkins user based on that information. Then if you later change your git config, Jenkins will still have your old email saved. So you need to go into the Jenkins dashboard > People > select a person > Configure and change the email that is saved there. – nullromo Sep 09 '20 at 20:28

2 Answers2

2

Jenkins reads the commit data from the author associated with the commit, you can view these with

git log

This will show for each commit

Author: Author Name <you@example.com>

You can amend the author of an existing commit

git commit --amend --author="Author Name <you@example.com>"

To set the default author email for your machine

git config --global user.email "you@example.com"

and you can set it locally to the repository you're in currrently

git config user.email "you@example.com"
Peter Reid
  • 5,139
  • 2
  • 37
  • 33
  • So this is the same tactic I tried when I first looked at the problem. I checked the user.config, and changed it to reflect the current email address. But after doing this, I am still seeing Jenkins reporting sending e-mail to the old address. – Roger Hill Feb 20 '17 at 21:36
  • 1
    Is the mail being sent as a result of a failed build? Because if jenkins believes 'is to blame for a failing build', if the build has not passed since the last failing build it might still be blaming commits with the old address(es). – Peter Reid Feb 20 '17 at 21:44
  • What 'recipients' option do you have selected for email-ext? – Peter Reid Feb 20 '17 at 21:45
  • I updated my email address a week or two back, and dozens of successful builds have been run since then. Also, the Jenkins server has been rebooted, so there is little chance of something being cached there. – Roger Hill Feb 21 '17 at 00:10
  • The mail-ext settings are set to send e-mail for each unstable build and send separate e-mail to each recipient. I also checked the global settings to see if there was anything odd, but it has a pretty vanilla smtp mail forwarding setup. – Roger Hill Feb 21 '17 at 00:13
  • This might be applicable https://issues.jenkins-ci.org/browse/JENKINS-26808 – Peter Reid Feb 21 '17 at 08:40
  • Thanks for all the suggestions. I am making sure that the old email messages that I am seeing aren't coming off check-ins that occurred prior to the email updates. – Roger Hill Feb 22 '17 at 17:28
1

Email Extension plugin

Developers

Add this recipient provider to send the email to anyone who checked in code for the last build. This plugin will generate an email address based on the committer’s ID and an appended Default user e-mail suffix from the Extended E-mail Notification section of the Configure System page. For example, if a change was committed by someone with an ID of first.last, and the default user e-mail suffix is @example.com, then an email will be sent to first.last@example.com.