Choosing between workspace level pipeline runners
Asked by sreeram_anikodemahadevan:

In our org initially we only had repository level pipeline runners  
As the number of projects grew we found most of the runners can be streamlined to a few rather managing multiple individual runners, otherwise costing CPU, Memory and Maintenance.

We decided to create workspace level runner that can be shared across multiple repos

We don't know how to choose/define which workspace runner to use within individual repository.  

Any examples/help/references will be greatly appreciated

Note: We use self.hosted windows pipelines


Answers:
author: Patrik S
body: Hello [@sreeram_anikodemahadevan](/t5/user/viewprofilepage/user-id/5315954) and thank you for reaching out to the Community!

When a pipeline build is triggered, it will be assigned to the first available runner that matches **all the labels** you have configured in the pipeline step.

So if you want to divide your runner(s) into groups, you can assign different labels to each set of runners, and then on each repository configure the pipeline steps to use the desired runner/group of runners.

Runner labels can be assigned during the runner creation, and for already created runners you can edit the label by accessing the runner's settings. For workspace runners, you can edit the labels as below:

1. Navigate to **Workspace Settings** \> **Workspace Runners**. This will show a list of all the runners created under that workspace
2. On the line containing the runner you want to edit the label, select the **three-dot icon** in the column Actions
3. In the drop-down, click on **Edit** option
4. Assign any new labels you want. You can repeat the same label in multiple runners if you want to create groups of runners. Some labels are required and can't be removed, such as *self.hosted* and *windows* (for windows runners) :   
   ![Screenshot 2023-10-12 at 4.14.55 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/286028iD870FD453B9360F7/image-size/large?v=v2&px=999 "Screenshot 2023-10-12 at 4.14.55 PM.png")

In the example above we are assigning the label **group1** to one of the runners. Suppose we have another runner assigned with the **group2**label. You can define in each repository's pipelines YML file which step will run in which runner/group of runners as the following example :

```
pipelines:
  default:
      - step:
          name: Step 1
          runs-on: 
            - 'windows'
            - 'self.hosted'
            - 'group1'
          script:
            - echo "This step will run on a runner of group1";
      - step:
          name: Step 2
          runs-on:
            - 'windows'
            - 'self.hosted'
            - 'group2'
          script:
            - echo "This step will run on a runner of group2";
```

where step 1 will be executed in any runner of ***group1*** , while step 2 will be assigned to a runner in ***group2**.*

Hope that helps to clarify your questions! Should you have any follow-up questions, let me know :)

Thank you, [@sreeram_anikodemahadevan](/t5/user/viewprofilepage/user-id/5315954) !

Patrik S


Tags: bitbucket-cloud

bitbucket-pipelines

cloud