Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70331

Improve user matching

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None

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

       

            Unassigned Unassigned
            reddwarf94 Cristian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: