Bamboo fails to send build notifications to Bitbucket Server or Data Center with 401 errors

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、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 は除く

    

要約

Commits in Bitbucket Server or Data Center have no builds associated to them even though they have been built by Bamboo. The following errors can be seen inside the <bamboo-home>/logs/atlassian-bamboo.log files for the builds that should be showing up inside Bitbucket Server or Data Center:

2022-11-15 16:08:32,192 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [BitbucketServerBuildStatusUpdater] Sending build notification to Stash (build key: PROJ-PLAN-11, repository: MMM)
2022-11-15 16:08:32,192 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [AuthenticatorAccessor] Looking for interface com.atlassian.applinks.api.auth.types.TwoLeggedOAuthAuthenticationProvider for application link Bitbucket
2022-11-15 16:08:32,194 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [RestCallHelper] Executing Bitbucket Server request. POST https://my-bitbucket.com/rest/api/latest/projects/BBB/repos/mmm/commits/4322999d911e35b147e54b9510ef9860cc13f473/builds
2022-11-15 16:08:32,194 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [ApplicationLinkProperties] Getting provider config; key: com.atlassian.applinks.api.auth.types.OAuthAuthenticationProvider
2022-11-15 16:08:32,209 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [ConsumerServiceImpl] Signed request OAuthMessage(POST, https://my-bitbucket.com/rest/api/latest/projects/BBB/repos/mmm/commits/4322999d911e35b147e54b9510ef9860cc13f473/builds, [oauth_token=, oauth_consumer_key=Bamboo%3A5637559759, oauth_signature_method=RSA-SHA1, oauth_timestamp=1668528512, oauth_nonce=63e48e5b-b372-4886-951e-a3d6df7473db_11848997688452, oauth_version=1.0, oauth_signature=hz33c2khorq2Par%2FX4wFW0ywk0D8SsHJCraCOeoraStkOlZU77%2By7GfdrU%2BoOfKhdma83OOAwaPG%2Frgp1sPcO%2FtjbvIMbdv%2B7r2%2BqFcRNWVOVbLlsu00%2F1VO2UQ1FYAWsACV6yoZTsa8l4%2FiC%2FdPHBJXbMTwZgdy4V23ZmMH1ToZUnmvdA8hUvDolzkFCEmrZ%2BuakkepocjG%2FbIbM68eIdbWtpOOOfvWkHAUHa1iyrhj%2F06A7gliPK0ZOoE%2Fth5YyaN3nOsh6oH%2B3v4tiLPAHFuaU3PiQTjoLp4sriKpm6OX%2BMR4kgz6pritjcIWkZ5DEbsmOIkOWbw8J%2FxH0hxyXw%3D%3D])
2022-11-15 16:08:32,237 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [OAuthRedirectingApplicationLinkResponseHandler] OAuth request rejected by peer.
Our OAuth request header: Authorization: [OAuth oauth_token="", oauth_consumer_key="Bamboo%3A5637559759", oauth_signature_method="RSA-SHA1", oauth_timestamp="1668528512", oauth_nonce="63e48e5b-b372-4886-951e-a3d6df7473db_11848997688452", oauth_version="1.0", oauth_signature="hz33c2khorq2Par%2FX4wFW0ywk0D8SsHJCraCOeoraStkOlZU77%2By7GfdrU%2BoOfKhdma83OOAwaPG%2Frgp1sPcO%2FtjbvIMbdv%2B7r2%2BqFcRNWVOVbLlsu00%2F1VO2UQ1FYAWsACV6yoZTsa8l4%2FiC%2FdPHBJXbMTwZgdy4V23ZmMH1ToZUnmvdA8hUvDolzkFCEmrZ%2BuakkepocjG%2FbIbM68eIdbWtpOOOfvWkHAUHa1iyrhj%2F06A7gliPK0ZOoE%2Fth5YyaN3nOsh6oH%2B3v4tiLPAHFuaU3PiQTjoLp4sriKpm6OX%2BMR4kgz6pritjcIWkZ5DEbsmOIkOWbw8J%2FxH0hxyXw%3D%3D"]
Full OAuth response header: WWW-Authenticate: OAuth realm="https%3A%2F%2Flinux-29300.prod.atl-cd.net%2Fbitbucket", oauth_problem="nonce_used"
2022-11-15 16:08:32,238 WARN [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [RestCallHelper] Failed to execute application link request. Server: https://my-bitbucket.com Method: POST Url: rest/api/latest/projects/BBB/repos/mmm/commits/4322999d911e35b147e54b9510ef9860cc13f473/builds
Response: 401 Unauthorized
Errors: Errors[errorMessages=[Request to Bitbucket Server failed. Returned with 401. Response: oauth_problem=nonce_used],errors={}]
2022-11-15 16:08:32,238 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [RestCallHelper] Response body: oauth_problem=nonce_used
2022-11-15 16:08:32,238 WARN [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [BitbucketServerBuildStatusUpdater] Failed to store build status against Stash instance Bitbucket, reason: com.atlassian.bamboo.jira.rest.JiraRestResponse@52f35f6d[body=oauth_problem=nonce_used,entity=<null>,errors=Errors[errorMessages=[Request to Bitbucket Server failed. Returned with 401. Response: oauth_problem=nonce_used],errors={}],statusCode=401,statusMessage=Unauthorized]
2022-11-15 16:08:32,242 WARN [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-55] [BitbucketServerBuildStatusUpdater] No build status updates have been sent to Stash (build key: PROJ-PLAN-10, repository: MMM). Is your application link configured properly?

The following classes must be added to the Bamboo administration > Overview > System > Log settings page to be able to see the DEBUG messages above:

  • com.atlassian.bamboo.plugins.stash
  • com.atlassian.applinks
  • com.atlassian.oauth.consumer

環境

The problem was observed in Bamboo 7 and 8 and is likely to happen to other versions as well.

診断

  • The error occurs despite the fact that applications links between Bamboo and Bitbucket Server or Data Center are green.
  • The repository was recently renamed or its project's key was recently updated in Bitbucket Server or Data Center.
  • Bitbucket's access logs (<bitbucket-home>/log/atlassian-bitbucket-access.log) show duplicate requests sent by Bamboo containing the old and new repository name and/or project key:

    <redacted>,<redacted> | https | i@1NMB7CGx968x760x0 | - | 2022-11-15 16:08:32,224 | "POST /rest/api/latest/projects/BBB/repos/mmm/commits/4322999d911e35b147e54b9510ef9860cc13f473/builds HTTP/1.1" | "" "Apache-HttpClient/4.5.13 (Java/11.0.16.1)" | - | - | - | - | - | - |
    <redacted>,<redacted> | https | o@1NMB7CGx968x760x0 | - | 2022-11-15 16:08:32,231 | "POST /rest/api/latest/projects/BBB/repos/mmm/commits/4322999d911e35b147e54b9510ef9860cc13f473/builds HTTP/1.1" | "" "Apache-HttpClient/4.5.13 (Java/11.0.16.1)" | 307 | 0 | 127 | - | 7 | - |
    <redacted>,<redacted> | https | i@1NMB7CGx968x761x0 | - | 2022-11-15 16:08:32,232 | "POST /rest/api/latest/projects/BBB/repos/fff/commits/4322999d911e35b147e54b9510ef9860cc13f473/builds HTTP/1.1" | "" "Apache-HttpClient/4.5.13 (Java/11.0.16.1)" | - | - | - | - | - | - |
    <redacted>,<redacted> | https | o@1NMB7CGx968x761x0 | - | 2022-11-15 16:08:32,234 | "POST /rest/api/latest/projects/BBB/repos/fff/commits/4322999d911e35b147e54b9510ef9860cc13f473/builds HTTP/1.1" | "" "Apache-HttpClient/4.5.13 (Java/11.0.16.1)" | 401 | 0 | 24 | - | 2 | - |

    In this example the repository has been renamed from mmm to fff. Requests for both repository names can be found inside the access logs.

原因

The error is caused by the fact that Bamboo is still using the old repository name and/or project key after they've been changed in Bitbucket Server and or Data Center.

BAM-22019 - Getting issue details... STATUS

ソリューション

ソリューション 1

Re-save the repository configuration inside Bamboo and ensure it's picking up the new repository name and/or project key from Bitbucket Server or Data Center.

ソリューション 2

You can also delete and re-create the repository configuration in Bamboo to solve the problem. You should consider the following though before moving forward:

  • If you're re-create a linked repository you will have to link it to your plan(s) and deployment project(s) again. Bamboo will not do so automatically.
  • Bamboo will delete the cache it stores locally for that repository once it's been removed. This means the first run of any build plans associated to that repository might take a while since Bamboo has to re-create the cache before placing the build on the queue.
最終更新日 2022 年 11 月 15 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.