Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-default-labels config option to self-hosted runners #2443

Merged
merged 3 commits into from
May 11, 2023

Conversation

gabriel-samfira
Copy link
Contributor

My apologies for the large wall of text bellow 😄 .

This change allows us to remove the default labels (self-hosted, linux, x64 for example) attached to runners. In a lot of cases, workflow authors only include the self-hosted label to target runners. In an environment where we manage pools of ephemeral self-hosted runners, this scenario negates the usefulness of custom labels, causing a random runner to pick up a job.

For example, if you have a set of runners with custom labels like:

  • gpu
  • high-memory

And another with:

  • fpga
  • medium-memory

And the workflow author defines just self-hosted (because it's easy and the documentation encourages authors to use it to target self hosted runners), you may get a runner with a gpu when in fact you required one with fpga.

Yes, teams could be encouraged to target runners using only custom labels, but when you have many teams, this doesn't always work out, and we end up consuming runner types we should not, potentially generating unnecessary cost (gpu instances may be more expensive than general purpose ones).

It's easier to deal with support tickets where a team asks why the self-hosted label is not working, than having the ops team responsible for maintaining the runners, ping each team asking them to change their workflows so as not to accidentally consume expensive runners when they actually should be using general purpose runners.

Runner groups are only available to enterprise users. Removing the default labels would be useful even for single repos with more collaborators and free tier orgs that a lot of open source projects use. It's also simpler to use labels to target runners if we don't have strict ACL requirements (that groups enable) and we simply want a simple way to target specific runners.

Allowing us to remove the default labels will give us the ability to define unique label sets and thus schedule jobs more efficiently. It also allows us to better react to queued workflow webhook and pick the right runner type to spin up if we have automation tools that allow us to define multiple pools with different characteristics (like detailed above). This saves on cost as we can correctly target runner types we can choose to spin up only on-demand as opposed to having them linger around.

Hoping this makes sense smile 😄.

Signed-off-by: Gabriel Adrian Samfira <[email protected]>
Signed-off-by: Gabriel Adrian Samfira <[email protected]>
@gabriel-samfira gabriel-samfira requested a review from a team as a code owner February 16, 2023 15:44
@gabriel-samfira gabriel-samfira changed the title Add no default labels Add --no-default-labels config option to self-hosted runners Feb 16, 2023
@gabriel-samfira
Copy link
Contributor Author

Hi folks!

Any chance to get some feedback on this PR? Thanks!

@alexsanderp
Copy link

Any chance to get some feedback on this PR? Thanks!

@pavlovic-ivan
Copy link

I would just like to express support for this issue and PR by adding this comment. Hopefully @actions/actions-runtime will pick this up soon.

@Rayshard
Copy link

Rayshard commented Apr 4, 2023

+1 on supporting this issue!

@sameeraksc
Copy link

we also need this feature badly

TingluoHuang
TingluoHuang previously approved these changes May 11, 2023
@gabriel-samfira
Copy link
Contributor Author

Hi @TingluoHuang

Some of the linting failures seem to be at lines I didn't change. Would you like me to fix those as well? There is also a file encoding error thrown.

@TingluoHuang TingluoHuang merged commit eeb0cf6 into actions:main May 11, 2023
@gabriel-samfira
Copy link
Contributor Author

Ohh! Thanks for making the changes and for merging! 😄

nikola-jokic pushed a commit to nikola-jokic/runner that referenced this pull request May 12, 2023
…#2443)

* Add --no-default-labels option

Signed-off-by: Gabriel Adrian Samfira <[email protected]>

* Add tests

Signed-off-by: Gabriel Adrian Samfira <[email protected]>

* .

---------

Signed-off-by: Gabriel Adrian Samfira <[email protected]>
Co-authored-by: Tingluo Huang <[email protected]>
@shankarRaman
Copy link

@gabriel-samfira does this mean that the default labels will no longer be added when registering runners? We use https://github.com/actions/actions-runner-controller for creating our runners.

@gabriel-samfira
Copy link
Contributor Author

@shankarRaman This PR adds the ability to opt out of the default labels when configuring the runner using Runner.Listener configure. But this is something that the automation you're using has to opt into. I don't think action-runner-controller uses config.sh to configure the runners, so this might not help.

If you're using action-runner-controller and need to configure your runners without the default labels, you should probably open an issue or ask on that projects page. You should get a much more informed answer than I am able to give.

@nkomm00
Copy link

nkomm00 commented Sep 8, 2023

In which version of actions runner "--no-default-labels" is available?

@Rayshard
Copy link

Rayshard commented Sep 8, 2023

In which version of actions runner "--no-default-labels" is available?

2.305.0+ https://github.com/actions/runner/releases/tag/v2.305.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants