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

Webhook incorrectly filtering workflow_job events based on labels #1132

Closed
mrmeyers99 opened this issue Aug 24, 2021 · 6 comments · Fixed by #1133
Closed

Webhook incorrectly filtering workflow_job events based on labels #1132

mrmeyers99 opened this issue Aug 24, 2021 · 6 comments · Fixed by #1133
Assignees
Labels
bug Something isn't working

Comments

@mrmeyers99
Copy link

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>);
@npalm
Copy link
Member

npalm commented Aug 26, 2021

@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.

@gertjanmaas
Copy link
Collaborator

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 :)

@mrmeyers99
Copy link
Author

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

@gertjanmaas
Copy link
Collaborator

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

@gertjanmaas gertjanmaas added the bug Something isn't working label Aug 26, 2021
@gertjanmaas gertjanmaas self-assigned this Aug 26, 2021
@npalm
Copy link
Member

npalm commented Aug 26, 2021

New release is out with a fix

@russmac
Copy link

russmac commented Aug 28, 2021

Thanks for this! @gertjanmaas @npalm @mrmeyers99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants