actions / actions/runner

Replaced runner runs jobs for labels it is no longer labeled with

Open
#4,225 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

Describe the bug
We use self-hosted runners. If we replace a runner with the same name but different labels, the existing runner gets replaced as expected: The github website shows the new runner with the same name and the new labels under Settings > Actions > Runners. But the new runner still gets assigned to jobs with the old labels with which it is not labeled anymore.

To Reproduce
Steps to reproduce the behavior:

  1. Create a github actions workflow with a job config that uses 'runs-on' with the label "tst":
    runs-on:
    - self-hosted
    - tst
  1. Create a self-hosted runner and configure it with the label "tst". we used
    ./config.sh --url "https://github.com/${ORGANIZATION}/${REPO}" --token "${REG_TOKEN}" --labels "tst" --name "my-runner" --replace

  2. Run the job

  3. Replace the runner with a new runner with the same name but different labels. we used

./config.sh --url "https://github.com/${ORGANIZATION}/${REPO}" --token "${REG_TOKEN}" --labels "stage" --name "my-runner" --replace

  1. Check in github that the runner is labeled with "stage" and not with "tst"

  2. Run the job that has runs-on config for "tst" again

  3. Bug: The replaced runner picks up the job but github shows it doesn't have the label "tst", only the label "stage".

Expected behavior
The runner should only run the jobs that match the labels it has and not run the jobs that match the labels of the runner it has replaced.

Runner Version and Platform

Version of your runner?
'2.331.0'

OS of the machine running the runner?
"ubuntu-os-cloud/ubuntu-minimal-2404-lts-amd64"

Job Log Output

If applicable, include the relevant part of the job / step log output here. All sensitive information should already be masked out, but please double-check before pasting here.

Runner and Worker's Diagnostic Logs

If applicable, add relevant diagnostic log information. Logs are located in the runner's _diag folder. The runner logs are prefixed with Runner_ and the worker logs are prefixed with Worker_. Each job run correlates to a worker log. All sensitive information should already be masked out, but please double-check before pasting here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the replacement flow with config.sh, using runs-on labels tst and stage on runner version 2.331.0. Inspect the diag Runner and Worker_ logs for the replaced runner and compare job assignment with the labels shown in GitHub. Done means the replacement no longer accepts tst jobs and accepts only jobs matching stage.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github-actions
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.