Skip to content

chore(CI/CD): Enable only one run per PR (cancel previous) - #550

Open
rgildein wants to merge 3 commits into
mainfrom
chore/CI-save-resources
Open

chore(CI/CD): Enable only one run per PR (cancel previous)#550
rgildein wants to merge 3 commits into
mainfrom
chore/CI-save-resources

Conversation

@rgildein

@rgildein rgildein commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

Add concurrency and group for all GitHub actions, the group name is composed:

  • github.workflow — the workflow's name: field (e.g. "Lint", "Test and Code Coverage")
  • github.ref — the full ref of the branch or tag that triggered the run (e.g. refs/heads/feat/my-feature, refs/pull/42/merge)

Actions cancelling prior runs on new push for all workflows, except if it's merged/pushed/tagged the main branch.

Expected output

With these changes I want to prevent running multiple jobs and save resources. Usually such situation happens during updating PR with current main branch or when I see failing lint and I push fix immediately.

Add concurrency and group for all GitHub actions, the group name is composed:
- github.workflow — the workflow's name: field (e.g. "Lint", "Test and Code Coverage")
- github.ref — the full ref of the branch or tag that triggered the run
  (e.g. refs/heads/feat/my-feature, refs/pull/42/merge)

Actions cancelling prior runs on new push: check-codegen, kustomize-validation,
lint, test, test-gnmi, test-e2e, test-chart, reuse, size-label.
Both publish-image, publish-chart are kept running, since we do not want to stop
them in the middle of push step, which would leave partial state.

Signed-off-by: Robert Gildein <rgildein@users.noreply.github.com>
@rgildein
rgildein requested a review from nikatza September 8, 2026 07:22
@rgildein rgildein self-assigned this Sep 8, 2026
@github-actions github-actions Bot added the size/M label Sep 8, 2026
felix-kaestner
felix-kaestner previously approved these changes Sep 8, 2026
@felix-kaestner

Copy link
Copy Markdown
Contributor

Just as a note: We don't use semantic commits. ref/ https://github.com/ironcore-dev/network-operator/blob/main/AGENTS.md?plain=1#L53-L57

Also, I think merging back main will break the commit message validation for the 'Signed-off-by:' line. So we have to use rebase in order to bring a PR up-to-date with the latest main.

@adamtrizuljak-sap adamtrizuljak-sap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both docker push and helm push should be immune to being interrupted, so I would apply the concurrency group to them as well.

@felix-kaestner
felix-kaestner dismissed their stale review September 8, 2026 12:03

Open Review.

@rgildein

rgildein commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Just as a note: We don't use semantic commits. ref/ https://github.com/ironcore-dev/network-operator/blob/main/AGENTS.md?plain=1#L53-L57

The github.ref is full formatted "path" for branch name in PR. (see docs), so it's not related with commit message at all and even for branch name it does not matter if it's my-nice-brach or feat/my-nicer-branch or anything else.

Also, I think merging back main will break the commit message validation for the 'Signed-off-by:' line. So we have to use rebase in order to bring a PR up-to-date with the latest main.

This part I did not understand? One thing is that if two merge happened one after another to the main branch, already running workflows will be cancelled, so maybe we need to avoid it?

@rgildein

rgildein commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Both docker push and helm push should be immune to being interrupted, so I would apply the concurrency group to them as well.

Are you sure? Already pushed layers will be removed?

Signed-off-by: Robert Gildein <rgildein@users.noreply.github.com>
@rgildein
rgildein force-pushed the chore/CI-save-resources branch from a16b1f9 to 9bcc3cd Compare September 8, 2026 15:25
@felix-kaestner

Copy link
Copy Markdown
Contributor

Just as a note: We don't use semantic commits. ref/ https://github.com/ironcore-dev/network-operator/blob/main/AGENTS.md?plain=1#L53-L57

The github.ref is full formatted "path" for branch name in PR. (see docs), so it's not related with commit message at all and even for branch name it does not matter if it's my-nice-brach or feat/my-nicer-branch or anything else.

Also, I think merging back main will break the commit message validation for the 'Signed-off-by:' line. So we have to use rebase in order to bring a PR up-to-date with the latest main.

This part I did not understand? One thing is that if two merge happened one after another to the main branch, already running workflows will be cancelled, so maybe we need to avoid it?

@rgildein The comment regarding semantic commits was refering to the commit message of 56ee9c8 and the title of this PR, not the changes themselves. Regarding the comment on merging back main, I was just refering to the fact that the "Merging is blocked" gate that happens, as you merge back the main branch. I just meant that you could prevent this by using a rebase.

@hardikdr hardikdr added the area/switch-automation Automation processes for network switch management and operations. label Sep 9, 2026
@hardikdr hardikdr added this to Roadmap Sep 9, 2026
@adamtrizuljak-sap

Copy link
Copy Markdown
Contributor

Both docker push and helm push should be immune to being interrupted, so I would apply the concurrency group to them as well.

Are you sure? Already pushed layers will be removed?

That's the responsibility of the image registry, not ours :) Best case, they auto-remove the layers from the failed push. Worst case, the layers remain there and subsequent pushes can reuse them. And helm push is just an HTTP upload of an archived file. If it breaks mid-upload, the server just ignores it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/switch-automation Automation processes for network switch management and operations. size/M

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants