ci: cancel superseded runs with native concurrency groups

cancel-redundant-workflows.yml had some overhead as it was spawning an extra
workflow_run job per workflow. With concurrency groups, a new push cancels the
PR's previous run directly.

A cancelled step can leave its docker container running against the shared
sstate.  Label containers with the runner name and remove them in the cleanup
step. Rename docker-prune-images to docker-cleanup accordingly.

Signed-off-by: Andrei Gherzan <andrei@gherzan.com>
This commit is contained in:
Andrei Gherzan committed 2026-10-19 04:47:47 +01:00
1 parent 651a6a21ed
commit 67d7736ed4
6 files changed
+32 -31

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ runs:
run: |
# Images older than max_age_days are rebuilt so that base image and
# package updates are picked up.
# Keep docker-prune-images at twice this.
# Keep docker-cleanup at twice this.
max_age_days=7
tag="$(git rev-parse --short=12 HEAD:.github/workflows/docker-images)"
image="${{ inputs.docker_image }}:$tag"
@@ -2,11 +2,20 @@
#
# SPDX-License-Identifier: MIT
name: "Prune old CI docker images"
name: "Cleanup CI docker containers and images"
runs:
using: "composite"
steps:
- name: Remove CI containers left on this runner
shell: bash
# A runner executes one job at a time, so any container labelled with
# its name is left over from this job (e.g. after a cancellation) or a
# previous one.
run: |
echo "Removing CI containers left by runner $RUNNER_NAME..."
docker ps -aq --filter "label=meta-raspberrypi-ci.runner=$RUNNER_NAME" |
xargs -r docker rm -f
- name: Prune old CI docker images
shell: bash
# Only images built by docker-build carry the label. Keep this at twice