Bamboo
  1. Bamboo
  2. BAM-8879

git author should be (should be?) pulled from author email address, not the real name

    Details

    • Type: Story Story
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3
    • Component/s: Repository (Git)
    • Labels:
      None
    • Last commented by user?:
      true
    • Comments:
      6
    • Internal Priority:
      4. Low

      Description

      from: http://forums.atlassian.com/thread.jspa?threadID=54113&tstart=0


      We're just transitioning to git from svn.

      Currently we're integrated with crowd & AD. When builds are triggered from the git repository, the author id pulled from the commits in that build are being pulled from the name of the user, not the user's email address. This then does not get correlated with the actual user in the system and they do not get build notifications.

      For example, if the author of a commit is: Sandra Coder <scoder@example.com>, I would expect that commit to show up on http://my-bamboo/browse/author/scoder. Instead we see it showing up at http://my-bamboo/browse/author/Sandra%20Coder.

      This is pretty unfortunate, especially since I can only configure gerrit to authenticate the email address, not the user's name. Is there any way to configure it differently?

      This is bamboo 3.0.2, Atlassian Bamboo Git Repository Plugin - 1.3

      Thanks for any help you can provide.


      Update: this looks intentional, see
      https://github.com/atlassian/bamboo-git-plugin/blob/9797ac45f5914ac84d197591c649e7ae4309a197/src/main/java/com/atlassian/bamboo/plugins/git/GitOperationHelper.java#L411

      1. atlassian-bamboo-plugin-git-1.3-BAM-8879.jar
        1.24 MB
        Piotr Stefan Stefaniak [Atlassian]

        Issue Links

          Activity

          Hide
          Piotr Stefan Stefaniak [Atlassian] added a comment -

          On the latter point //how this should be configurable//, my personal bias is not to require restarting the server (i.e. like setting a system property would require). I do generally feel like this is an environmental setting, not a per-project setting.

          I'm not an expert on the bamboo admin ui, so I'll happily endorse any solution that seems reasonable and allows me to configure this behavior.

          On the former point //what is current practice in username mapping// – I'm not sure which environment is more prevalent. It definitely feels like something that should "just work" in the presence of user names and email addresses and crowd and AD, but I also feel like email address is the stronger identifier here.

          I guess what's disappointing is that even though I have a checkin with a clearly identifiable email address, build notifications don't work because the checkin is not correlated with a real user.

          Show
          Piotr Stefan Stefaniak [Atlassian] added a comment - On the latter point // how this should be configurable //, my personal bias is not to require restarting the server (i.e. like setting a system property would require). I do generally feel like this is an environmental setting, not a per-project setting. I'm not an expert on the bamboo admin ui, so I'll happily endorse any solution that seems reasonable and allows me to configure this behavior. On the former point // what is current practice in username mapping // – I'm not sure which environment is more prevalent. It definitely feels like something that should "just work" in the presence of user names and email addresses and crowd and AD, but I also feel like email address is the stronger identifier here. I guess what's disappointing is that even though I have a checkin with a clearly identifiable email address, build notifications don't work because the checkin is not correlated with a real user.
          Hide
          Piotr Stefan Stefaniak [Atlassian] added a comment -

          I'm adding a jar file with changes to the GitOperationHelper:

          //                curr.setAuthor(new AuthorImpl(commit.getAuthorIdent().getName()));
                          String email = commit.getAuthorIdent().getEmailAddress();
                          String username = email != null && email.contains("@") ? email.substring(0, email.indexOf("@")) : Author.UNKNOWN_AUTHOR;
                          curr.setAuthor(new AuthorImpl(username));
          
          
          Show
          Piotr Stefan Stefaniak [Atlassian] added a comment - I'm adding a jar file with changes to the GitOperationHelper: // curr.setAuthor( new AuthorImpl(commit.getAuthorIdent().getName())); String email = commit.getAuthorIdent().getEmailAddress(); String username = email != null && email.contains( "@" ) ? email.substring(0, email.indexOf( "@" )) : Author.UNKNOWN_AUTHOR; curr.setAuthor( new AuthorImpl(username));
          Hide
          Matt Ryall [Atlassian] added a comment -

          I have a fork of the plugin which attempts to do this by looking up the user based on their email address. I haven't yet tested this in Bamboo, but you can see the changes here:

          Show
          Matt Ryall [Atlassian] added a comment - I have a fork of the plugin which attempts to do this by looking up the user based on their email address. I haven't yet tested this in Bamboo, but you can see the changes here: https://github.com/mattryall/bamboo-git-plugin/commit/202abc604a1450530ececaa0aad39bb0100564bd
          Hide
          Piotr Stefan Stefaniak [Atlassian] added a comment -

          pull request: https://github.com/atlassian/bamboo-git-plugin/pull/5

          @Mark - can we (Bamboons) discuss this issue on Tuesday's planning session?

          Show
          Piotr Stefan Stefaniak [Atlassian] added a comment - pull request: https://github.com/atlassian/bamboo-git-plugin/pull/5 @Mark - can we (Bamboons) discuss this issue on Tuesday's planning session?
          Hide
          Matt Ryall [Atlassian] added a comment -

          I had a chat to Mark about this today. You guys should definitely discuss this further, because I think we actually went with the wrong approach here.

          Ideally, the persisted commit author should be the complete author details from Git ("User Full Name <user@example.com>"), then Bamboo can do the author->user conversion properly once BAM-1099 is implemented.

          Please ignore my pull request and fork.

          Show
          Matt Ryall [Atlassian] added a comment - I had a chat to Mark about this today. You guys should definitely discuss this further, because I think we actually went with the wrong approach here. Ideally, the persisted commit author should be the complete author details from Git ("User Full Name <user@example.com>"), then Bamboo can do the author->user conversion properly once BAM-1099 is implemented. Please ignore my pull request and fork.
          Hide
          Matt Ryall [Atlassian] added a comment -

          Piotr, I've had another go at implementing this more simply. Pull request is here: https://github.com/atlassian/bamboo-git-plugin/pull/8

          Show
          Matt Ryall [Atlassian] added a comment - Piotr, I've had another go at implementing this more simply. Pull request is here: https://github.com/atlassian/bamboo-git-plugin/pull/8

            People

            • Votes:
              4 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last commented:
                2 years, 29 weeks, 2 days ago