How do I share self hosted Windows Pipeline runner across main and fork repositories
Asked by Video Guy:

I have a main repo say project.git. I have a self hosted Windows runner setup to monitor changes to this repo and kick off a build. It has been working great.

I forked the repo to say joe.git. I want to test my changes in joe.git before promoting them to project.git with a pull request. I want to reuse the runner setup for project.git. I don't see any option for my fork to reuse the runner that was already setup for project.git. The only option is to add a new runner for the fork; start it and then commit changes.

Don't you think it is unnecessary?

Wondering if there is any trick to make main repo runners available to forks...

Thanks


Answers:
author: Patrik S
body: Hey [@Video Guy](/t5/user/viewprofilepage/user-id/551282) ,

Thank you for reaching out to Atlassian Community!

Just to give you a background, you can create runners at both the repository and workspace level. Repository level runners will be only available for the repo where they were created. Workspace runners are available to be used by all the repositories within the workspace.

So in this case, if the forked repository is in the same workspace as the main repository, you can create your runners at the workspace level, so the runners will be available to be used both in the main and forked repo, without the need to create one runner per repository.

To create a workspace runner you can follow the below steps :

1. Access your workspace and go to **Settings**
2. On the menu on the left, click on **Workspace Runners** under the Pipelines section
3. Click on **Add Runner**

Once the runner is created, all the pipeline steps from repositories in that workspace that have labels matching the runner's labels will be able to use it.

More details are outlined in the following documentation :

* <https://support.atlassian.com/bitbucket-cloud/docs/adding-a-new-runner-in-bitbucket/#Adding-a-new-workspace-runner>

Hope that helps!

Thank you, [@Video Guy](/t5/user/viewprofilepage/user-id/551282) .

Kind regards,

Patrik S

comments: author: Video Guy
body: Thanks Patrik!

I followed your instructions and added a runner to the main project workspace. I rerun a build and I see it getting built on the workspace runner.

Then I moved to my fork repository. I found that it belongs to completely different workspace. I don't see any method to move my fork to main repo's workspace. And the workspace runner is not listed in fork's runners page.

What am I doing wrong?

Thanks


author: Patrik S
body: Hello [@Video Guy](/t5/user/viewprofilepage/user-id/551282) ,

The workspace runners are only available to be used by repositories within the same workspace where the runners were created. When you create a forked repository, you have the option to choose in which workspace the fork will be created, so you need to select the workspace where you have the runners set up.

If you want to move an already existing fork repository from a different workspace to the workspace where you have the runners, you can do it by using the feature [Transfer repositories to a workspace.](https://support.atlassian.com/bitbucket-cloud/docs/transfer-repositories-and-groups-to-a-workspace/)

Kind regards,

Patrik S


Tags: bitbucket-cloud

bitbucket-pipelines

bitbucket-runners

cloud

git

server