icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Run only a single job per workflow at a time

Open nilmerg opened this issue 3 years ago • 4 comments

This limits each run of these workflows to a single action runner. This means, for each PR, merge or release only five runners run concurrently.

It also cancels pending jobs automatically, scoped to the workflow and pull request. Merge and release runs cannot cancel each other though.

We are limited to 20 runners concurrently. This means four PRs can still lock them up. But at least it prevents a single PR from locking up all resources.

At the moment it's only a draft, so feel free to ignore this at the moment. But I'd really like to merge this in the next days/weeks. (If it works as I thought, I'll cancel the runs after creating this PR so I can't tell if it does until all releases are finished)

nilmerg avatar Jun 29 '22 14:06 nilmerg

Yes.

nilmerg avatar Jun 30 '22 13:06 nilmerg

I just clicked re-run for a single workflow to have a look at how this works and all jobs started running immediatly: 20220704_09h34m31s_grim

So I'm not yet convinced that it works.

I doubt that’s acceptable.

Is it acceptable that one repo uses up the full organization runner limit for quite some time blocking other repos? I mean probably probably not great, but acceptable if that's the best what we can do with GH Actions (if we get it to actually work somehow).

julianbrost avatar Jul 04 '22 07:07 julianbrost

I doubt that’s acceptable.

I could have proposed to limit it to just a single runner at a time. For web repositories this wouldn't be a problem, but I figured it would be one here ;)

So I'm not yet convinced that it works.

Seems to work now.

Runs also get cancelled mostly fine. There were only two cases with deb.yml and raspbian.yml which weren't cancelled at all. Though, neither the previous cancel action was successful nor my own attempts. These workflows, once running, seem to be not cancellable at all.

nilmerg avatar Jul 04 '22 12:07 nilmerg

Nope, it does not. It seems to cancel its own queue entries (╯°□°)╯︵ ┻━┻

nilmerg avatar Jul 04 '22 13:07 nilmerg

I got it working!!!!1 Please consider merging @julianbrost

nilmerg avatar Jan 19 '23 15:01 nilmerg

TODO

  • #9636
  • [ ] rebase

Al2Klimov avatar Jan 19 '23 15:01 Al2Klimov

Both #9636 and this PR have a lot of overlapping changes. How will they interact with each other? One uses group: deb-${{ github.ref }}, the other group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}. How would the combination of both look? Or is there a general conflict between the PRs (i.e. not only a conflict preventing automatic merging of both)?

julianbrost avatar Jan 20 '23 13:01 julianbrost

group: deb-${{ github.ref }} will be the final definition. Mine is then obsolete. It has the only change that master / tag runs don't get cancelled.

nilmerg avatar Jan 20 '23 13:01 nilmerg

A tag run? Gets cancelled? How?

Al2Klimov avatar Jan 20 '23 14:01 Al2Klimov

github.ref will also be a tag name, so subsequent pushes onto the same tag cancel the previous runs like on the master

nilmerg avatar Jan 20 '23 14:01 nilmerg

Only in this case they get cancelled? Then I consider that behaviour desired.

Al2Klimov avatar Jan 20 '23 14:01 Al2Klimov

So I'll have a closer look at #9636 and if it gets merged as-is, this PR will reduce down to adding max-parallel: 1?

julianbrost avatar Jan 20 '23 14:01 julianbrost

LGTM, but... only 4/5?

Docker has no matrix and runs only one job anyways.

julianbrost avatar Jan 20 '23 14:01 julianbrost

Wait! One job per PR! #9636 already does this, but AFAIK OP's goals are beyond that.

Al2Klimov avatar Jan 20 '23 15:01 Al2Klimov

? My goals can be observed below :wink:

nilmerg avatar Jan 20 '23 15:01 nilmerg

#9636 limits to one workflow, this PR additionally limits to one job per workflow.

julianbrost avatar Jan 20 '23 15:01 julianbrost