gitjenkinsjenkins-email-ext

Where does jenkins get email addresses from in Git


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.


Solution

  • 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"