Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket Runner Autoscaler fails to create a Workspace-level Runner

Bohdan Astapov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 28, 2023

Hi, we've deployed runner-autoscaler to our Kubernetes cluster to scale runners for us.

It works for repository-level runner creation, however, for workspace level it crashes with this error:

```

INFO: [k8s-runner-amd64-test] Runner #1 for namespace: bitbucket setup...
INFO: [k8s-runner-amd64-test] Starting to setup runner on Bitbucket workspace: REDACTED ...
Traceback (most recent call last):
File "/home/bitbucket/autoscaler/clients/base.py", line 36, in make_http_request
response.raise_for_status()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.bitbucket.org/internal/workspaces/<REDACTED WORKSPACE UUID>/pipelines-config/runners

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/bitbucket/autoscaler/start.py", line 91, in <module>
main()
File "/home/bitbucket/autoscaler/start.py", line 87, in main
poller.start()
File "/home/bitbucket/autoscaler/start.py", line 47, in start
fut.result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/bitbucket/autoscaler/strategy/pct_runners_idle.py", line 78, in process
self.run()
File "/home/bitbucket/autoscaler/strategy/pct_runners_idle.py", line 228, in run
self.create_runner(i)
File "/home/bitbucket/autoscaler/strategy/pct_runners_idle.py", line 105, in create_runner
bitbucket_data = self.runner_service.create_bitbucket_runner(
File "/home/bitbucket/autoscaler/services/bitbucket.py", line 52, in create_bitbucket_runner
data = workspace_runner_api.create_runner(workspace.uuid, name, tuple(labels))
File "/home/bitbucket/autoscaler/clients/bitbucket/base.py", line 128, in create_runner
runner, _ = self.make_http_request(url, method='post', json=data, headers={'Content-Type': 'application/json'})
File "/home/bitbucket/autoscaler/clients/base.py", line 40, in make_http_request
raise AutoscalerHTTPError(response.text, status_code=response.status_code)
autoscaler.core.exceptions.AutoscalerHTTPError: Status code: 404. {"type": "error", "error": {"message": "Resource not found"}}

```

1 answer

1 accepted

2 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 29, 2023

Hello @Bohdan Astapov,

thank you for reaching out to the Community!

Based on the error message being received (HTTP error 404 not found), this is usually returned when the credentials you are using to authenticate the request do not have access to that particular content.

In this case, could you please let us know how you configured the autoscale authentication? Are you using Username and App Password or OAuth Client ID and Client secret?

Also, were the credentials you are using created with at least the repository:read, account:read, runner:write scopes? 

For testing purposes, could you try creating a new App password or Oauth consumer (based on which you are currently using) with full scopes selected and check if the same error occurs?

It's important to note that when using an app password, the account under which the app password was created needs to be a Workspace Admin in order to be able to create a Workspace-level runner.

Thank you, @Bohdan Astapov !

Patrik S

Bohdan Astapov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 2, 2024

Hello @Patrik S ,

 

Thank you for the answer. Our technical user indeed weren't a Workspace Admin. After we changed the permissions - it started to work.

 

Thank you!

Bohdan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events