Skip to content

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

@volkerhess2

Description

@volkerhess2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions