2

When creating a new self-hosted runner for GitHub (enterprise), some default labels (Windows, X64, self-hosted) are automatically added. I can also add custom labels with the --labels parameter.

The thing is that I would like to reserve this runner for some specific workflows, but without restricting the repositories where it can be called. Because some projects use this default labels to choose runner, I would like to remove them.

I tried to find where this labels are created, but I'm fearing they are created server-side and that I would not have control over them...

Did anybody deal with a similar situation?

Thank you.

Jorge
  • 55
  • 4

3 Answers3

2

The support for not adding default labels to self-hosted runners, was added in this PR:

https://github.com/actions/runner/pull/2443

It should become available in the next stable release that includes this change.

To use it, pass in:

--no-default-labels 

to the config.sh script, when configuring the self hosted runner. Opting out of the default labels makes the --label option, mandatory.

Gabriel Samfira
  • 2,675
  • 1
  • 17
  • 19
  • This is great, but how would you apply it to the manifest? I assume it goes in the RunnerDeployment manifest under env: An example would be great – Branden Aug 15 '23 at 19:51
  • I assume you're referring to the ARC controller. Sadly I am not familiar with it. But there does seem to be a draft PR that discusses adding this to ARC: https://github.com/actions/actions-runner-controller/pull/2590 – Gabriel Samfira Aug 16 '23 at 07:10
  • 1
    Yea I was reading that too, I think this might be available in something new called the RunnerScaleSet. Of course the docs aren't up to date yet. I am researching into this at the moment. Of course this is the last thing I noticed after all infra work and workflows are done when using runner groups in a shared Org. – Branden Aug 16 '23 at 12:21
  • When I added this, the JIT runners, which `RunnerScaleSet` may leverage (have not looked at ARC yet), didn't exist yet. It may still not be available for GH enterprise server. But if you're only interested up to org level, you should be good to go. This flag is still useful for people that manage their runners manually or use alternative runner autoscalers. I plan to implement this flag in our own runner autoscaler, soon. – Gabriel Samfira Aug 16 '23 at 12:49
1

You cannot remove the default labels. If this runner is meant to be used exclusively by specific repos, then move them into a Runner Group and only allow that groups to be used by those repos.

No other way to configure that at the moment.

Rob Bos
  • 1,320
  • 1
  • 10
  • 25
  • Ahh! Too bad. We manage pools of runners for multiple repos, orgs and enterprise. If we configure runners on all hierarchy levels, github will send a hook to each. If someone used just "self-hosted" as a label to target a runner, a new runner would spin up on each hierarchy level as a response to the "queued" event. Would be useful to be able to remove the default labels. This way we could enforce unique labels sets more easily. Thanks for the info! Was looking for a confirmation of this :). – Gabriel Samfira Feb 06 '23 at 13:57
0

For future reference I recommend using https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/about-actions-runner-controller

I was able to convert from ARC and RunnerDeployments to this relatively quickly, less than a couple hours of work and watching this amazing tutorial.

https://www.youtube.com/watch?v=_F5ocPrv6io

He goes through a deep dive and it is very clear. I just finished testing this myself using a runner-group with all repos selected ( it is a shared org unfort ) and then setting the following in my secrets.values.yaml

  runnerGroup: "my-rg"
  runnerScaleSetName: "my-rg"

And in my workflow set my runs-on: my-rg

works. Self-hosted no longer does which is intended in the case other people in the company switch to Actions as well.

Branden
  • 198
  • 2
  • 16