canonical / prometheus-k8s-operator

https://charmhub.io/prometheus-k8s
Apache License 2.0
21 stars 35 forks source link

cancel jobs if new commit is pushed to the same branch #401

Closed beliaev-maksim closed 1 year ago

beliaev-maksim commented 1 year ago

currently if you constantly push to the same branch, then CI runs for multiple commits in parallel

that is useless, we do not care about old commits in the same branch. Thus, we can cancel jobs and free up machine resources

we create a unique group that consists of workflow name and a branch name. If new commits are pushed to the same group, previous pipeline is aborted.

We can save hundreds of machine hours

see: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow

sed-i commented 1 year ago

After we convince ourselves this works as expected, could this be moved to https://github.com/canonical/observability/tree/main/.github/workflows ?