Unable to publish Specs in Bamboo: current user is not authorised with 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
Summary
Publishing Java Specs in Bamboo fails with the following error message:
1
Repository not imported: current user is not authorised with Bitbucket Server. You can configure OAuth token in your Bamboo user profile
Although the user publishing the Specs code is an administrator in Bamboo and its credentials are valid, and that builds run and successfully checkout code from Bitbucket, the Specs import fails.
Environment
Using Java Specs to manage plans in Bamboo.
Diagnosis
The following error is present in the <bamboo-home>/logs/atlassian-bamboo.log file:
Error when publishing Specs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2023-09-28 15:16:41,841 ERROR [http-nio-8085-exec-12 url: /rest/api/latest/import/plan; user: USER] [BambooPlanConfigImportResource] Unexpected exception while importing plan:
java.lang.IllegalArgumentException: com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: Repository not imported: current user is not authorised with Bitbucket Server. You can configure OAuth token in your Bamboo user profile
at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$validateAndCreateRepositoryObjects$21(PlanConfigImportServiceImpl.java:1271)
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:129)
at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.validateAndCreateRepositoryObjects(PlanConfigImportServiceImpl.java:1245)
at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$modifyTopLevelPlanFunction$2(PlanConfigImportServiceImpl.java:552)
at com.atlassian.bamboo.core.ScopedExclusionServiceImpl.tryWithLock(ScopedExclusionServiceImpl.java:74)
at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.modifyExistingTopLevelPlan(PlanConfigImportServiceImpl.java:454)
at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$importPlan$0(PlanConfigImportServiceImpl.java:419)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
[...]
Caused by: com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: Repository not imported: current user is not authorised with Bitbucket Server. You can configure OAuth token in your Bamboo user profile
at com.atlassian.bamboo.plugins.stash.v2.exporter.BitbucketServerExporter.importLocationData(BitbucketServerExporter.java:283)
at com.atlassian.bamboo.plugins.stash.v2.exporter.BitbucketServerExporter.importLocationData(BitbucketServerExporter.java:84)
at com.atlassian.bamboo.configuration.external.exporters.RepositoryExporterImpl.lambda$importRepository$4(RepositoryExporterImpl.java:315)
at com.atlassian.bamboo.utils.BambooCallables.callUnchecked(BambooCallables.java:33)
at com.atlassian.bamboo.plugin.BambooPluginUtils.callChangedApi(BambooPluginUtils.java:240)
at com.atlassian.bamboo.configuration.external.exporters.RepositoryExporterImpl.importRepository(RepositoryExporterImpl.java:315)
at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$validateAndCreateRepositoryObjects$21(PlanConfigImportServiceImpl.java:1252)
... 260 more
Cause
The user account publishing the Specs code does not have access to the Bitbucket Server repository and is therefore unable to create/import the repository included in the configuration. If it previously had access, it might have had its OAuth token lost/expired.
Solution
First of all, double-check which user account is set in the .credentials file in your Specs project.
Once you have the Specs user, please log into Bamboo with that account & credentials.
Go to any plan and try to add a new Linked Repository from Bitbucket. You should see a message like this one:
Bitbucket - approval required
Bamboo requires your approval before it can display repositories and branches, and automatically set up authentication.
Login & approve
Click onLogin & approveand Bamboo will create an OAuth token for you.
After that, the Specs import should succeed.
Was this helpful?