User Configured pre-receive or post-receive Hooks Break After Upgrading Bitbucket Server
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
User configured pre or post receive hooks are not working after upgrading Bitbucket Server.
Cause
If you added a pre-receive or post-receive hook, upon upgrading to Bitbucket Server 2.0 or later, these will be moved to <BITBUCKET_HOME>/data/repositories/<NNN>/hooks/pre-receive.d/10_custom
or <BITBUCKET_HOME>/data/repositories/<NNN>/hooks/post-receive.d/10_custom
.
We replace the <BITBUCKET_HOME>/data/repositories/<NNN>/hooks/pre-receive
and <BITBUCKET_HOME>/data/repositories/<NNN>/hooks/post-receive
hook with our own that will call out to all the hooks in the .../hooks/pre-recieve.d
and .../hooks/post-recieve.d
directories in order.
NNN is the internal repository id.
If your custom hook references other scripts using relative path names (e.g. ./foo.sh
or ../dir/foo.sh
) these will break and the hook will stop working.
Resolution
Update your custom hooks accordingly to point to the correct location.
Was this helpful?