Multiple Self-hosted Github actions runners

I have two self hosted github action runners - 

  1. The first runner is running in my dev env

  2. The second runner is running in my qa env.

Is there a way to select these runners based on which branch the Java CI action is being executed.

so e.g. I want to run my master branch on the runner hosted in QA env and I want to run my feature branch run on the runner which is hosted in the dev env.

Is there a way to do this. Currently I see that I can only use _ self-hosted  _label but how can I choose - 

run:
 on: my-runner
1 Like

Hi @sgrmgj-quotient ,

Currently self hosted runner supports below labels:

  • self-hosted: Default label applied to all self-hosted runners.
  • linux, windows, or macos: Applied depending on operating system type.
  • x86, x64, ARM, or ARM64: Applied depending on architecture type.

For example, you can use below code to choose a macos self-hosted runner.

runs-on: [self-hosted, macos]

If your two runners used different OS/architecture, then they can be specified separately in your workflow.

Github engineering team are going to support custom labels, should be completed by 31 March 2020.

Let’s wait for the feature to be released, then you can use custom label to specify the self-hosted runner in workflow. You could keep an eye on Changelog site for the new features of Github Actions. 

Thanks!

1 Like

Thank you so much for the reply.

how to add different type of linux distribution label on custom runner?

Custom labels are now available for self-hosted runners.

https://github.blog/changelog/2020-04-22-github-actions-organization-level-self-hosted-runners/

1 Like

And most importantly: how do we enforce this assignment? Code in unmerged feature branches (including the workflow file itself) is untrusted, so any labels configured there cannot be relied upon.