From d6d3834440b0fe8105cd3b572b9c011672b17ac6 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 22 Oct 2024 13:39:00 +0200 Subject: cirrus-run: Avoid hard job failure when CI credits run out Recently the libvirt project started to run out of CI credits on cirrus towards the end of the month. As this is annoying we'd prefer if the job is allowed to fail in such case. This patch (temporarily) switches to 'cirrus-run' version with patches allowing detection of CI credit failure, which also returns a different error code allowing us to allow return code '3' to be considered an allowed failure. Signed-off-by: Peter Krempa --- containers/cirrus-run/Dockerfile | 4 +++- lcitool/gitlab.py | 2 ++ tests/data/manifest/out/ci/gitlab/build-templates.yml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/containers/cirrus-run/Dockerfile b/containers/cirrus-run/Dockerfile index c59809c..78aafcd 100644 --- a/containers/cirrus-run/Dockerfile +++ b/containers/cirrus-run/Dockerfile @@ -2,4 +2,6 @@ FROM docker.io/library/python:3.9-alpine COPY cirrus-vars.py /usr/bin/cirrus-vars -RUN pip3 install cirrus-run==1.0.1 +#RUN pip3 install cirrus-run==1.0.1 +RUN apk add git +RUN pip3 install 'cirrus-run @ git+https://github.com/pipo/cirrus-run@job-credits-2' diff --git a/lcitool/gitlab.py b/lcitool/gitlab.py index e5e2142..606c411 100644 --- a/lcitool/gitlab.py +++ b/lcitool/gitlab.py @@ -338,6 +338,8 @@ def cirrus_template(cidir): image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest interruptible: true needs: [] + allow_failure: + exit_codes: 3 script: - set -o allexport - source {cidir}/cirrus/$NAME.vars diff --git a/tests/data/manifest/out/ci/gitlab/build-templates.yml b/tests/data/manifest/out/ci/gitlab/build-templates.yml index 9aa81a1..825c658 100644 --- a/tests/data/manifest/out/ci/gitlab/build-templates.yml +++ b/tests/data/manifest/out/ci/gitlab/build-templates.yml @@ -275,6 +275,8 @@ image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest interruptible: true needs: [] + allow_failure: + exit_codes: 3 script: - set -o allexport - source ci/cirrus/$NAME.vars -- cgit v1.1