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

Programmatically Creating & Updating Workspace and Repository Runners

Gajesh Bhat June 12, 2024

Hello Atlassian Community,

I am looking to automate the management of workspace and repository runners in Bitbucket Cloud and Bitbucket Pipelines. Specifically, I want to create and update these runners programmatically, ideally using an API or a similar method. This would allow me to manage runner configurations dynamically as part of our CI/CD processes.

Could anyone provide guidance or examples on how to achieve the following using Bitbucket's API or any other method:

  1. Programmatically create a new runner for a workspace or a specific repository.
  2. How to know when a new Runner is released and obtain it's version so that I can setup a Cron job to automatically download and apply the updates. The Current Bitbucket Cloud API seems to not support this feature out of the box.
  3. Optionally, if there are best practices for managing runners in a dynamic and scalable way, I'd be keen to learn about those too.

I saw an open ticket and some discussions about workarounds. Does Atlassian have any recommended methods to set this up ?  BCLOUD-22032 : Runner Update Options 

 

Any help or pointers towards relevant documentation would be greatly appreciated!

Regards,

Gajesh

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 18, 2024

Hello @Gajesh Bhat ,

thank you for reaching out to the Community!

I would suggest taking a look at the runner's autoscaler tool release last year that can be deployed into a kubernetes environment and already contains the logic to scale the number of runners similar to what you described in your question :

Bitbucket Cloud currently doesn't have public API endpoints for managing runners, so the auto scaler tool makes use of internal API endpoints to make the requests to create/delete runners. Those are the same internal APIs used by the UI when making such actions in the Bitbucket portal.

Also, the good thing about the autoscaler tool is that its source code is published in a public repository, so if you have different requirements and cannot leverage the autoscaler for your use case, you can still dive into its code to have more details about the implementations and the APIs being used, and come up with your own solution : 

Lastly, for the runner's auto-update functionality, currently, the runners can only be updated manually or, as a workaround, through custom scripts as suggested by other users in the feature request BCLOUD-22032. There's not a native functionality for this porpoise yet, as this is being tracked and considered as a future implementation on that feature ticket.

If you would be interested in that, we encourage you to add your Vote to the feature to increase its visibility and also mark yourself as a watcher so you get notified about any future updates.

I hope that helps! Should you have any questions, let us know!

Thank you, @Gajesh Bhat !

Patrik S

Gajesh Bhat June 21, 2024

Thank you @Patrik S  I will use a workaround until the feature is officially supported. I also found a link where the Release notes for Bitbucket Pipeline Runners are posted. Is this page consistent ? Can I point my script to parse this page to look for the latest runner version ? Link to Changelog https://product-downloads.atlassian.com/software/bitbucket/pipelines/CHANGELOG.md

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 25, 2024

Hey @Gajesh Bhat ,

Yes, you can use that page to get updates on new runner versions being released.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events