ci: make check-tree optional for branches other than main

Old branches tend to be formatted with a different versions of
clang-format, so when patches are backported, they introduce some
differences in formatting, making the check-tree job to fail.

These changes in formatting are normally small, and we don't pay much
attention to them, causing that the pipelines are always red, increasing
the work required to check if there are important failures or not.

Make check-tree optional for branches other than main. This way,
failures will be shown as a "warning", and if a pipeline only shows a
warning we don't need to inspect it.

(cherry picked from commit 9e47c9bc6a)
(cherry picked from commit b497ce4372)
(cherry picked from commit f43af853e6)
This commit is contained in:
Íñigo Huguet 2024-12-27 09:08:43 +01:00
parent eae3de9c96
commit a85941660a
2 changed files with 17 additions and 5 deletions

View file

@ -57,11 +57,11 @@ variables:
#
# This is done by running `ci-fairy generate-template` and possibly bumping
# ".default_tag".
ALPINE_TAG: 'tag-21b37b356080'
CENTOS_TAG: 'tag-7397c485797c'
DEBIAN_TAG: 'tag-501092ec7ae8'
FEDORA_TAG: 'tag-7397c485797c'
UBUNTU_TAG: 'tag-501092ec7ae8'
ALPINE_TAG: 'tag-c76cdca5b069'
CENTOS_TAG: 'tag-4f0d8223e66e'
DEBIAN_TAG: 'tag-dc240734a387'
FEDORA_TAG: 'tag-4f0d8223e66e'
UBUNTU_TAG: 'tag-dc240734a387'
ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh'
CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh'
@ -359,6 +359,12 @@ check-tree:
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
needs:
- "tier1:fedora:40@prep"
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_PIPELINE_SOURCE != 'schedule'
stage: tier1
script:
- date '+%Y%m%d-%H%M%S'; clang-format --version

View file

@ -203,6 +203,12 @@ check-tree:
FDO_DISTRIBUTION_TAG: ${{default_distro.name.upper()}}_TAG
needs:
- "tier{{default_distro.tier}}:{{default_distro.name}}:{{default_distro.versions[0]}}@prep"
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_PIPELINE_SOURCE != 'schedule'
stage: tier1
script:
- date '+%Y%m%d-%H%M%S'; clang-format --version