-
Bug
-
Resolution: Fixed
-
Low
-
8.2.5
-
None
-
1
-
Severity 3 - Minor
-
Issue Summary
Bamboo fails to store build status in Bitbucket Server or Data Center with 401 errors after the repository has been renamed or its project's key updated in Bitbucket. Bamboo is capable of checking out code from Bitbucket after the update so this shouldn't really affect build execution but it fails to store the status of builds in Bitbucket with oauth_problem=nonce_used and "Request to Bitbucket Server failed. Returned with 401" errors.
This is reproducible on Data Center:
Steps to Reproduce
- Rename an existing Bitbucket repository or update the key of the project that the repository belongs to inside Bitbucket.
- This has to be done for a repository that is currently linked to Bamboo (e.g. linked, project, or plan repository) and known to be working i.e. build status are reflected correctly inside Bitbucket.
- Trigger a build (manual or automatic – this shouldn't make any difference).
Expected Results
Bamboo is capable of checking out code from Bitbucket and reporting the status of the build to Bitbucket once it's finished.
Actual Results
Bamboo is capable of checking out code from Bitbucket however it fails to store the status of the build inside Bitbucket and the below exception is thrown in the <bamboo-home>/logs/atlassian-bamboo.log file:
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 duplicate requests can be found inside the <bitbucket-home>/log/atlassian-bitbucket-access.log file:
<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 the example above the repository was renamed from mmm to fff.
Workaround
- Access the repository configuration (linked, project, or plan) inside Bamboo for the repository that's been renamed or whose project's key has been updated.
- Find the project / repository in the Repository drop-down field.
- They will show up in the list with the new name and/or key.
- Save the repository configuration without changing anything else.
- Trigger another build – Bamboo should resume updating build statuses for that repository.
- mentioned in
-
Page Loading...