Bitbucket build history contains the wrong hyperlink to Bamboo instance
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
Summary
If the base URL gets updated mid-process during a Bamboo upgrade (for example, for testing purposes), the Bitbucket build history can have an incorrect hyperlink to Bamboo for builds that were executed during the time the base URL was different.
Environment
The solution has been validated in Bamboo 9.2 and Bitbucket 8.19 but may be applicable to other versions.
Diagnosis
When viewing the build history in Bitbucket (Bitbucket repository > Builds), the hyperlinks in the related build information contain the wrong URL to Bamboo, failing to redirect to the Bamboo Interface.
Cause
This is caused by a misconfiguration in the Bamboo Base URL for a period of time in which Bamboo builds were executed and had their information stored in Bitbucket with the old, wrong URL.
Solution
- Create a Bitbucket database backup before proceeding.
Run the following SQL command against the Bitbucket database:
UPDATE bb_build_status SET url = REPLACE(url, 'https://WRONG-bamboo-url', 'https://CORRECT-bamboo-url') WHERE url LIKE 'https://wrong-bamboo-url%';
- Replace
https://WRONG-bamboo-url
with the wrong Bamboo URL, andhttps://CORRECT-bamboo-url
with the correct Bamboo base URL. - The SQL command will replace every wrong URL you have in the build status in Bitbucket side. The changes will take effect immediately after running the SQL command.
- Replace