Skip to content

Webhook incorrectly filtering workflow_job events based on labels #1132

Closed

Description

@mrmeyers99

I tried using the workflow_job event instead of check_run. The webhook is ignoring the job though because it thinks that the labels do not match the configured labels for my runner.

2021-08-24T14:42:12.675Z	0b278f9f-b863-4236-b0f8-7a88a5b15e6a	DEBUG	Received workflow job event with labels: '["my-label"]'. The event does NOT match the configured labels: '
{}
'

The configured labels is empty, and I think it's an issue with the way RUNNER_LABELS is stored. runner_extra_labels is a comma separated list of labels. That variable is mapped to the RUNNER_LABELS environment variable for the lambda, but the workflow_job handler is expecting the RUNNER_LABELS environment variable to be a proper json array.

function isRunnerNotAllowed(job: WorkflowJob): boolean {
  const runnerLabelsEnv = (process.env.RUNNER_LABELS as string) || '[]';
  const runnerLabels = new Set(JSON.parse(runnerLabelsEnv) as Array<string>);

Activity

  1. npalm commented on Aug 26, 2021

    @npalm
    Member

    @gertjanmaas can you have a look at the issue. I have just checked the default example which uses extra labels, and here it works fine. So maybe we have indeed an issue for an empty list.

  2. gertjanmaas commented on Aug 26, 2021

    @gertjanmaas
    Contributor

    I checked the code and it seems the labels are not transferred from the terraform module to the webhook environment variable correctly. I'll make a PR for this and test out a couple of situations (including no labels).

    Not sure if I have time to do this today, but I'll try :)

  3. mrmeyers99 commented on Aug 26, 2021

    @mrmeyers99
    Author

    For what it's worth my list was not empty. I had about 7 comma separated labels.

  4. gertjanmaas commented on Aug 26, 2021

    @gertjanmaas
    Contributor

    Then I misunderstood the ticket, but it also doesn't work as expected when labels are entered. 🙂

  5. added
    bug
    on Aug 26, 2021
  6. self-assigned this
    on Aug 26, 2021
  7. npalm commented on Aug 26, 2021

    @npalm
    Member

    New release is out with a fix

  8. russmac commented on Aug 28, 2021

    @russmac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions