Bamboo 9.1+ build status not updated in Bitbucket version older than 7.4 with warning Request to Bitbucket Server failed. Returned with 404
プラットフォームについて: Cloud、Server、および Data Center - この記事はすべてのプラットフォームに等しく適用されます。
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.
*Fisheye および Crucible は除く
要約
Bamboo will be automatically configured to respond to repository events published by Bitbucket Server and to notify Bitbucket Server about build results. But you may sometimes see a commit that could trigger a Build in Bamboo but the build result status was not updated in Bitbucket. The request to update the status fails with Request to Bitbucket Server failed. Returned with 404
環境
- Bamboo Server/Data Center >= 9.1
- Bitbucket Server/Data Center < 7.4
診断
- Bamboo build status not appearing in Bitbucket
- You may see the below error '[BitbucketServerBuildStatusUpdater] Failed to store build status against Stash instance Bitbucket' in atlassian-bamboo.log
2023-01-10 20:44:34,015 WARN [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-47] [BitbucketServerBuildStatusUpdater] Failed to store build status against Stash instance Bitbucket - 2, reason: com.atlassian.bamboo.plugins.stash.rest.entity.stash.StashRestResponse@6cdf66f9[body=<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: http://<BITBUCKET_URL>/rest/api/latest/projects/BB/repos/bb730_repo/commits/4e833027201b2d1b976b9f0e6a9aa7e26fc936f8/builds</message></status>,errors=StashErrors{errors=[StashError{context=null, message=Request to Bitbucket Server failed. Returned with 404. Response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: http://<BITBUCKET_URL>/rest/api/latest/projects/BB/repos/bb730_repo/commits/4e833027201b2d1b976b9f0e6a9aa7e26fc936f8/builds</message></status>, exceptionName=null}]},location=<null>,statusCode=404,statusMessage=]
2023-01-10 20:44:34,015 WARN [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-47] [BitbucketServerBuildStatusUpdater] No build status updates have been sent to Stash (build key: BB730-BB730-1, repository: BB73). Is your application link configured properly?
原因
Bamboo 9.1.0 release fixes a bug where restarting Bamboo while a build triggered from Bitbucket Data Center or Server was still running resulted in the build status in Bitbucket getting stuck in In progress indefinitely. However, the fix increases the minimum release of Bitbucket Data Center and Server supported by Bamboo. From now on, Bamboo can only integrate with Bitbucket Data Center and Server 7.5 or newer. If you’re running an older Bitbucket Data Center or Server release, consider upgrading your Bitbucket instance before upgrading to Bamboo 9.1.0. You can refer more details on Version-specific upgrade notes.
In Bitbucket version <= 7.3, the API endpoint http://<BITBUCKET_URL>/rest/build-status/latest/commits/<commit-id>
.
In Bitbucket version >= 7.4, a new extended API endpoint is added: http://<BITBUCKET_URL>/rest/api/latest/projects/<bitbucket-project>/repos/<bitbucket-repo>/commits/<commit-id>/builds
, the endpoint that supports receiving significantly more build information from a build server. Read more on Bitbucket API change log: https://developer.atlassian.com/server/bitbucket/reference/api-changelog/#bitbucket-server-7-4
And By default, in Bamboo 9.1+ version onwards, it uses the Bitbucket API Endpoint introduced in Bitbucket 7.4.
ソリューション
You can enable the flag -Dbamboo.stash.disable.extended.build.status.updates=true
in system properties in Bamboo to will allow the Bamboo 9.1 version to use the legacy API endpoint (/bitbucket/rest/build-status/latest/commits/<commit-id>) to update the status in Bitbucket <=7.3 instead of the extended new API endpoint.
- Linux: Edit
$BAMBOO_INSTALL/bin/setenv.sh
- For Windows, see Configuring your system properties
- Find the section JVM_SUPPORT_RECOMMENDED_ARGS=
- Add the below parameter
${JVM_SUPPORT_RECOMMENDED_ARGS:="-Dbamboo.stash.disable.extended.build.status.updates=true"}
- Restart the Bamboo application
Bitbucket EOL version
Please note that Bitbucket 7.3 version has reached Atlassian Support End of Life. We highly recommend running the supported version in your environment.
Read more on Atlassian Support End of Life Policy.