Jobs running with "labeled" trigger get triggered multiple times #1948
Labels
automation
bug
Something isn't working
confirmed
For issues and PRs which we definitely want (disables the stale bot)
priority:low
Turns out all our "conditional on label" jobs [1] are getting triggered each time a label is added, so when doing a release the automation actually adds 2 labels
ready-to-test
ande2e-all-k8s
.[1] (e.g. https://github.com/submariner-io/submariner-operator/blob/devel/.github/workflows/e2e-full.yml#L4-L11)
This action from the CLI perspective is just one action - create the PR with 2 labels, but behind the scenes it translates to 3 GHA trigger events:
ready-to-test
e2e-all-k8s
In this case for the E2E Full job:
Only the last workflow's results are displayed on the "Conversation" page in the PR, but if you go to the "Checks" page you can see all workflows.
This means that ~10 jobs are being run extraneously.On operator repository it's even worse since the "All K8s" workflow is being run twice and that has 25 jobs (maybe we should trim that a bit?).
The reason it runs twice is probably due to a race between the labeling itself and generation of the event for GHA, so by the time the event is generated for labeling with ready-to-test the PR already has e2e-all-k8s present, and that gets sent in the payload as well (that's my hypothesis).
The situation is even worse, though, since for any PR that already has one of the labels present, any additional labeling by users will run the workflow again, even when the PR is closed.
So, what can we do?
This is also a major problem in case any of the jobs is under marked required under branch protection rule(s), since the last run takes precedence and will cause PR to be un-mergable.
The text was updated successfully, but these errors were encountered: