Skip to content

Update devops label validator to initialize with label names

What does this MR do and why?

Resolves bug described in #1332 (closed)

This MR improves the implementation of the DevopsLabelValidator by changing the initializer to accept just the label names. It is up to the caller to decide which label names to validate against.

So, for the DevopsLabelsNudger processor, the DevopsLabelsValidator object will be initialized with event.label_names to check for the presence of the expected labels. 5 minutes later, when the async job is executed, it will query the issue api and fetch its real time labels, and pass this updated label lists to the DevopsLabelsValidator object. This ultimately ensures that, before the nudge comment is posted, it queries the issue api and fetch the labels, instead of repeating the validation against the event attributes which could contain outdated label information.

Expected impact & dry-runs

These are strongly recommended to assist reviewers and reduce the time to merge your change.

See https://gitlab.com/gitlab-org/quality/triage-ops/-/tree/master/doc/scheduled#testing-policies-with-a-dry-run on how to perform dry-runs for new policies.

See https://gitlab.com/gitlab-org/quality/triage-ops/-/blob/master/doc/reactive/best_practices.md#use-the-sandbox-to-test-new-processors on how to make sure a new processor can be tested.

Action items

Edited by Jennifer Li

Merge request reports