Skip to content

[JENKINS-70331] Improve user matching #3777

@jenkins-infra-bot

Description

@jenkins-infra-bot

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 <[email protected]>". 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 "[email protected]"
  • If "Use existing account with same email if found" is not enabled, it creates a user with id "[email protected]".
  • 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 "[email protected]". If it find one, it uses it.
  • If it can't find it, it creates an user with ID "[email protected]".

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[ "[email protected]" as replacement instead. This:

 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions