VERSION- Bitbucket 6.7.1 Server
The problem I'm trying to solve, though irrelevant to the question, is that we have a mass email domain migration and I want to fuzzy match committer (ie. verify last names match in emails, ignoring domain).
I'm dumbfounded here as I understand how the pre-recieve hook mostly works. I'm wrote a custom filesystem hook using <repo_dir>/hooks/pre-receive.d/25_myhook. The script basically does this:
- Get the Bitbucket user from env variable GIT_COMMITTER_NAME (apparently this is only for HTTP pushes), or GIT_COMMITTER_IDENT
- Query Bitbucket on localhost REST API to get email associated with username from prior step. (I don't think Bitbucket provides the email to the script.)
- Email is actually set to IP address (and actually that of reverse proxy)
- remote: GIT_COMMITTER_EMAIL=jsuarezx@http.172.X.X.X
- OR...
- remote: GIT_COMMITTER_IDENT=jsuarezx <jsuarezx@http.172.X.X.X> 1585962883 -0400
- Iterate through 'git rev-list' and check fuzzy match of lastname in committer email with that of user.
This seems to be workable for HTTP connections.
The problem however is that when I switch to SSH authentication, it appears to completely bypass the built in Verify Commiter hook, and for my script, there appears to be no easy way to check which Bitbucket account is doing the commit.
When using SSH, the following environment variables are not set: GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL.
GIT_COMMITTER_IDENT=xadmin <xadmin@server.com> 1585963121 -0400
It appears that when SSH is used, this variable is replaced by the local user that Bitbucket is run as.
Question is, for SSH connections, is the Verify Committer hook applicable?
Is this fixed in later versions? (We are installing Dataceter 7.1 soon, but I haven't ready any info on this situation being broken prior, so not optimistic that behavior would be different,)