jenkinsci / jenkinsci/git-plugin

[JENKINS-70331] Improve user matching

Open
#3,777 1 comment 0 reactions 0 assignees Claimed by @reddwarf69 View on GitHub
component:git-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

Independently of https://issues.jenkins.io/browse/JENKINS-39250, it would be nice to improve the way the git plugin matches the users in the change set.

The current logic doesn't make a lot of sense

The author/commit is usually of the format "My Name ". By default:



  • It tries to match the user from "My Name"

  • If it fails, it tries to match if from "my.email"

  • If it can't, it creates a user with id "my.email"

If "Create new accounts based on author/committer’s email" is enabled



  • It tries to match the user from "my.email@​gmail.com"

  • If "Use existing account with same email if found" is not enabled, it creates a user with id "my.email@​gmail.com".

  • If "Use existing account with same email if found" is enabled, and https://plugins.jenkins.io/mailer/ is installed (so users have an actual email assigned to them, independently of their ID), it looks through all the users until it find one with email "my.email@​gmail.com". If it find one, it uses it.

  • If it can't find it, it creates an user with ID "my.email@​gmail.com".

Plus, there is a, per-project, option to use the author or committer.

"Use existing account with same email if found" is not documented in https://plugins.jenkins.io/git/#plugin-content-global-configuration. And the behaviour is so strange that I would not even know how to document it. Why is it only used when "Create new accounts based on author/committer’s email" is enabled, for example? No matter if the plugin creates users using as ID:



  • The email

  • ...also the email, but only the part before the @

It can always try to "Use existing account with same email if found".

But the whole behaviour maybe could be an extension point. Because, for example, GitHub gives the option to users of hiding their emails (https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address). It uses[ "ID+USERNAME@​users.noreply.github.com" as replacement instead. This:


 

---
Originally reported by reddwarf94, imported from: Improve user matching


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02

Raw content of original issue

Independently of https://issues.jenkins.io/browse/JENKINS-39250, it would be nice to improve the way the git plugin matches the users in the change set.

The current logic doesn't make a lot of sense

The author/commit is usually of the format "My Name <my.email@gmail.com>". By default:



  • It tries to match the user from "My Name"

  • If it fails, it tries to match if from "my.email"

  • If it can't, it creates a user with id "my.email"

If "Create new accounts based on author/committer’s email" is enabled



  • It tries to match the user from "my.email@gmail.com"

  • If "Use existing account with same email if found" is not enabled, it creates a user with id "my.email@gmail.com".

  • If "Use existing account with same email if found" is enabled, and https://plugins.jenkins.io/mailer/ is installed (so users have an actual email assigned to them, independently of their ID), it looks through all the users until it find one with email "my.email@gmail.com". If it find one, it uses it.

  • If it can't find it, it creates an user with ID "my.email@gmail.com".

Plus, there is a, per-project, option to use the author or committer.

"Use existing account with same email if found" is not documented in https://plugins.jenkins.io/git/#plugin-content-global-configuration. And the behaviour is so strange that I would not even know how to document it. Why is it only used when "Create new accounts based on author/committer’s email" is enabled, for example? No matter if the plugin creates users using as ID:



  • The email

  • ...also the email, but only the part before the @

It can always try to "Use existing account with same email if found".

But the whole behaviour maybe could be an extension point. Because, for example, GitHub gives the option to users of hiding their emails (https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address). It uses[ "ID+USERNAME@users.noreply.github.com" as replacement instead. This:



  • Complicates the matching

  • It actually makes the matching very easy if people are using https://plugins.jenkins.io/github-oauth/ since "USERNAME" is a direct match.

  • Notice that the "If it fails, it tries to match if from "my.email"" step could in the past have matched the "USERNAME@users.noreply.github.com" emails, but it would now fail with the new "ID+USERNAME@users.noreply.github.com".

 

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.