cirrus.yml: automatic skips based on source

As we want to get rid of the special titles convert the existing skips
to the only_if condition, this makes it more readable as we do not need
to negate so much.

Then add similar conditions for all test tasks, this removes the need to
a special title such as CI:DOCS as the logic is smart enough to only
docs changes when no source code was changed.

Update the documentation for the new logic and no longer point
contributors to the CI:DOCS title as it is gone now.

There is a bunch of duplication in the rules as yaml doesn't allow us to
share only parts of a string. To prevent unwanted drift a test case in
contrib/cirrus/cirrus_yaml_test.py is added to ensure all conditions
follow the same base ruleset.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2024-07-03 13:58:09 +02:00
parent 189d862d54
commit 55ad0d6e0e
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
5 changed files with 161 additions and 225 deletions

View File

@ -222,7 +222,7 @@ build_aarch64_task:
alt_build_task: alt_build_task:
name: "$ALT_NAME" name: "$ALT_NAME"
alias: alt_build alias: alt_build
# Don't create task for [CI:DOCS], or rhel-release builds # Don't create task on rhel-release builds
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md
only_if: &no_rhel_release | only_if: &no_rhel_release |
$CIRRUS_BRANCH !=~ 'v[0-9\.]+-rhel' && $CIRRUS_BRANCH !=~ 'v[0-9\.]+-rhel' &&
@ -314,9 +314,7 @@ freebsd_alt_build_task:
alias: freebsd_alt_build alias: freebsd_alt_build
# Only run on 'main' and PRs against 'main' # Only run on 'main' and PRs against 'main'
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md
only_if: | only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BASE_BRANCH == 'main'
$CIRRUS_CHANGE_TITLE !=~ '.*CI:MACHINE.*' &&
( $CIRRUS_BRANCH == 'main' || $CIRRUS_BASE_BRANCH == 'main' )
env: env:
<<: *stdenvars <<: *stdenvars
# Functional FreeBSD builds must be built natively since they depend on CGO # Functional FreeBSD builds must be built natively since they depend on CGO
@ -368,13 +366,16 @@ build_success_task:
bindings_task: bindings_task:
name: "Test Bindings" name: "Test Bindings"
alias: bindings alias: bindings
# Don't create task for PRs using [CI:DOCS] or [CI:BUILD] # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
# Docs: ./contrib/cirrus/CIModes.md # only when: - main rules (see doc above); or
# - bindings test code is changed; or
# - actual source code changed
only_if: >- only_if: >-
$CIRRUS_PR != '' && $CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' && $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' && changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:MACHINE.*' changesInclude('pkg/bindings/test/**') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: &build depends_on: &build
- build_success - build_success
gce_instance: *standardvm gce_instance: *standardvm
@ -410,11 +411,6 @@ bindings_task:
swagger_task: swagger_task:
name: "Test Swagger" name: "Test Swagger"
alias: swagger alias: swagger
# Don't create task for [CI:BUILD]
# Docs: ./contrib/cirrus/CIModes.md
only_if: |
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:MACHINE.*'
depends_on: *build depends_on: *build
gce_instance: *standardvm gce_instance: *standardvm
env: env:
@ -496,14 +492,16 @@ win_installer_task:
docker-py_test_task: docker-py_test_task:
name: Docker-py Compat. name: Docker-py Compat.
alias: docker-py_test alias: docker-py_test
# Don't create task for tags, branches, or PRs w/ [CI:<magic>] # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
# N/B: for PRs $CIRRUS_BRANCH == 'pull/<number>' # only when: - main rules (see doc above); or
# Docs: ./contrib/cirrus/CIModes.md # - docker-py test code is changed; or
only_if: &not_tag_branch_build_docs_machine >- # - actual source code changed
$CIRRUS_PR != '' && only_if: >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' && $CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' && $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:MACHINE.*' changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
changesInclude('test/python/**') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
gce_instance: *standardvm gce_instance: *standardvm
env: env:
@ -520,8 +518,17 @@ docker-py_test_task:
unit_test_task: unit_test_task:
name: "Unit tests on $DISTRO_NV" name: "Unit tests on $DISTRO_NV"
alias: unit_test alias: unit_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_branch_build_docs_machine # only when: - main rules (see doc above); or
# - unit test files are changed (contains a false positves such as test/e2e/
# but that should not be an issue, it only runs when it doesn't have to)
# - actual source code changed
only_if: >-
$CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
changesInclude('**/*_test.go') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
matrix: matrix:
- env: *stdenvars - env: *stdenvars
@ -542,8 +549,16 @@ unit_test_task:
apiv2_test_task: apiv2_test_task:
name: "APIv2 test on $DISTRO_NV ($PRIV_NAME)" name: "APIv2 test on $DISTRO_NV ($PRIV_NAME)"
alias: apiv2_test alias: apiv2_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_branch_build_docs_machine # only when: - main rules (see doc above); or
# - apiv2 test code is changed; or
# - actual source code changed
only_if: >-
$CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
changesInclude('test/apiv2/**') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
gce_instance: *standardvm gce_instance: *standardvm
# Test is normally pretty quick, about 10-minutes. If it hangs, # Test is normally pretty quick, about 10-minutes. If it hangs,
@ -566,8 +581,16 @@ apiv2_test_task:
compose_test_task: compose_test_task:
name: "$TEST_FLAVOR test on $DISTRO_NV ($PRIV_NAME)" name: "$TEST_FLAVOR test on $DISTRO_NV ($PRIV_NAME)"
alias: compose_test alias: compose_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_branch_build_docs_machine # only when: - main rules (see doc above); or
# - compose test code is changed; or
# - actual source code changed
only_if: >-
$CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
changesInclude('test/compose/**') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
gce_instance: *standardvm gce_instance: *standardvm
matrix: matrix:
@ -590,19 +613,16 @@ local_integration_test_task: &local_integration_test_task
# <int.|sys.> <podman|remote> <Distro NV> <root|rootless> # <int.|sys.> <podman|remote> <Distro NV> <root|rootless>
name: &std_name_fmt "$TEST_FLAVOR $PODBIN_NAME $DISTRO_NV $PRIV_NAME $TEST_ENVIRON ${CI_DESIRED_DATABASE}" name: &std_name_fmt "$TEST_FLAVOR $PODBIN_NAME $DISTRO_NV $PRIV_NAME $TEST_ENVIRON ${CI_DESIRED_DATABASE}"
alias: local_integration_test alias: local_integration_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_branch_build_docs_machine # only when: - main rules (see doc above); or
# skip when: - it is a PR (we never want to skip on nightly tests); and # - int test code is changed; or
# - CI:ALL title is not set; and # - actual source code changed
# - no danger files are changed; and only_if: &only_if_int_test >-
# - when no int test code is changed; and $CIRRUS_PR == '' ||
# - NOT (source code is changed AND NOT only test files) $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
skip: &skip_int_test >- changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
$CIRRUS_PR != '' && changesInclude('test/e2e/**', 'test/utils/**') ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:ALL.*' && (changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
!changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') &&
!changesInclude('test/e2e/**', 'test/utils/**') &&
!(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
matrix: *platform_axis matrix: *platform_axis
# integration tests scale well with cpu as they are parallelized # integration tests scale well with cpu as they are parallelized
@ -643,8 +663,7 @@ container_integration_test_task:
name: *std_name_fmt name: *std_name_fmt
alias: container_integration_test alias: container_integration_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md
only_if: *not_tag_branch_build_docs_machine only_if: *only_if_int_test
skip: *skip_int_test
depends_on: *build depends_on: *build
matrix: &fedora_vm_axis matrix: &fedora_vm_axis
- env: - env:
@ -672,8 +691,7 @@ rootless_integration_test_task:
name: *std_name_fmt name: *std_name_fmt
alias: rootless_integration_test alias: rootless_integration_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md
only_if: *not_tag_branch_build_docs_machine only_if: *only_if_int_test
skip: *skip_int_test
depends_on: *build depends_on: *build
matrix: *platform_axis matrix: *platform_axis
gce_instance: *fastvm gce_instance: *fastvm
@ -690,22 +708,14 @@ rootless_integration_test_task:
podman_machine_task: podman_machine_task:
name: *std_name_fmt name: *std_name_fmt
alias: podman_machine alias: podman_machine
# Only run for PRs and never [CI:DOCS] or [CI:BUILD] # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
# Docs: ./contrib/cirrus/CIModes.md # only when: - main rules (see doc above); or
only_if: &machine_cron_not_tag_build_docs >- # - machine code files are changed
($CIRRUS_PR != '' && only_if: &only_if_machine_test >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' && $CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
) || $CIRRUS_CRON == "main" changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
# skip when: - it is a PR (we never want to skip on nightly tests); and changesInclude('cmd/podman/machine/**', 'pkg/machine/**', '**/*machine*.go')
# - CI:ALL title is not set; and
# - no danger files are changed; and
# - no machine code files are changed
skip: &skip_machine_test >-
$CIRRUS_PR != '' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:ALL.*' &&
!changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') &&
!changesInclude('cmd/podman/machine/**', 'pkg/machine/**', '**/*machine*.go')
depends_on: *build depends_on: *build
ec2_instance: ec2_instance:
image: "${VM_IMAGE_NAME}" image: "${VM_IMAGE_NAME}"
@ -726,8 +736,7 @@ podman_machine_task:
podman_machine_aarch64_task: podman_machine_aarch64_task:
name: *std_name_fmt name: *std_name_fmt
alias: podman_machine_aarch64 alias: podman_machine_aarch64
only_if: *machine_cron_not_tag_build_docs only_if: *only_if_machine_test
skip: *skip_machine_test
depends_on: *build depends_on: *build
ec2_instance: ec2_instance:
<<: *standard_build_ec2_aarch64 <<: *standard_build_ec2_aarch64
@ -750,10 +759,8 @@ podman_machine_aarch64_task:
podman_machine_windows_task: podman_machine_windows_task:
name: *std_name_fmt name: *std_name_fmt
alias: podman_machine_windows alias: podman_machine_windows
# Only run for non-docs/copr PRs and non-release branch builds # Docs: ./contrib/cirrus/CIModes.md
# and never for tags. Docs: ./contrib/cirrus/CIModes.md only_if: *only_if_machine_test
only_if: *machine_cron_not_tag_build_docs
skip: *skip_machine_test
depends_on: *build depends_on: *build
ec2_instance: ec2_instance:
<<: *windows <<: *windows
@ -777,8 +784,7 @@ podman_machine_windows_task:
podman_machine_mac_task: podman_machine_mac_task:
name: *std_name_fmt name: *std_name_fmt
alias: podman_machine_mac alias: podman_machine_mac
only_if: *machine_cron_not_tag_build_docs only_if: *only_if_machine_test
skip: *skip_machine_test
depends_on: *build depends_on: *build
persistent_worker: *mac_pw persistent_worker: *mac_pw
env: env:
@ -824,24 +830,16 @@ podman_machine_mac_task:
local_system_test_task: &local_system_test_task local_system_test_task: &local_system_test_task
name: *std_name_fmt name: *std_name_fmt
alias: local_system_test alias: local_system_test
# Don't create task for tags, or if using [CI:*] magic # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
# Docs: ./contrib/cirrus/CIModes.md # only when: - main rules (see doc above); or
only_if: &not_tag_magic >- # - sys test code is changed; or
$CIRRUS_TAG == '' && # - actual source code changed
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' && only_if: &only_if_system_test >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' && $CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:MACHINE.*' $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
# skip when: - it is a PR (we never want to skip on nightly tests); and changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
# - CI:ALL title is not set; and changesInclude('test/system/**') ||
# - no danger files are changed; and (changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
# - no system test code is changed; and
# - NOT (source code is changed AND not only test files)
skip: &skip_system_test >-
$CIRRUS_PR != '' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:ALL.*' &&
!changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') &&
!changesInclude('test/system/**') &&
!(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
matrix: *platform_axis matrix: *platform_axis
gce_instance: *standardvm gce_instance: *standardvm
@ -856,10 +854,8 @@ local_system_test_task: &local_system_test_task
local_system_test_aarch64_task: &local_system_test_task_aarch64 local_system_test_aarch64_task: &local_system_test_task_aarch64
name: *std_name_fmt name: *std_name_fmt
alias: local_system_test_aarch64 alias: local_system_test_aarch64
# Don't create task for tags, or if using [CI:DOCS], [CI:BUILD]
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md
only_if: *not_tag_magic only_if: *only_if_system_test
skip: *skip_system_test
depends_on: *build depends_on: *build
persistent_worker: *mac_pw persistent_worker: *mac_pw
ec2_instance: *standard_build_ec2_aarch64 ec2_instance: *standard_build_ec2_aarch64
@ -910,8 +906,7 @@ rootless_system_test_task:
name: *std_name_fmt name: *std_name_fmt
alias: rootless_system_test alias: rootless_system_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md
only_if: *not_tag_magic only_if: *only_if_system_test
skip: *skip_system_test
depends_on: *build depends_on: *build
matrix: *platform_axis matrix: *platform_axis
gce_instance: *standardvm gce_instance: *standardvm
@ -927,8 +922,16 @@ rootless_system_test_task:
minikube_test_task: minikube_test_task:
name: *std_name_fmt name: *std_name_fmt
alias: minikube_test alias: minikube_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_magic # only when: - main rules (see doc above); or
# - minikube test code is changed or one of the shared helper import files from the system test; or
# - actual source code changed
only_if: >-
$CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
changesInclude('test/minikube/**', 'test/system/*.bash') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
# 2024-05-21: flaking almost constantly since March. # 2024-05-21: flaking almost constantly since March.
skip: $CI == $CI skip: $CI == $CI
depends_on: *build depends_on: *build
@ -945,8 +948,16 @@ minikube_test_task:
farm_test_task: farm_test_task:
name: *std_name_fmt name: *std_name_fmt
alias: farm_test alias: farm_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_magic # only when: - main rules (see doc above); or
# - farm test code is changed or one of the shared helper import files from the system test; or
# - actual source code changed
only_if: >-
$CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
changesInclude('test/farm/**', 'test/system/*.bash') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
gce_instance: *standardvm gce_instance: *standardvm
env: env:
@ -961,17 +972,15 @@ farm_test_task:
buildah_bud_test_task: buildah_bud_test_task:
name: *std_name_fmt name: *std_name_fmt
alias: buildah_bud_test alias: buildah_bud_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_magic # only when: - main rules (see doc above); or
# skip when: - it is a PR (we never want to skip on nightly tests); and # - podman build source code files or bud tests files are changed
# - CI:ALL title is not set; and # (vendor updates, i.e. buildah, are already covered in the main rules)
# - no danger files are changed; and only_if: >-
# - no build source files are changed and no bud tests $CIRRUS_PR == '' ||
skip: >- $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
$CIRRUS_PR != '' && changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
$CIRRUS_CHANGE_TITLE !=~ '.*CI:ALL.*' && changesInclude('**/*build*.go', 'test/buildah-bud/**')
!changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') &&
!changesInclude('**/*build*.go', 'test/buildah-bud/**')
depends_on: *build depends_on: *build
env: env:
<<: *stdenvars <<: *stdenvars
@ -991,8 +1000,16 @@ buildah_bud_test_task:
upgrade_test_task: upgrade_test_task:
name: "Upgrade test: from $PODMAN_UPGRADE_FROM" name: "Upgrade test: from $PODMAN_UPGRADE_FROM"
alias: upgrade_test alias: upgrade_test
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes)
only_if: *not_tag_magic # only when: - main rules (see doc above); or
# - upgrade test code is changed or one of the shared helper import files from the system test; or
# - actual source code changed
only_if: >-
$CIRRUS_PR == '' ||
$CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' ||
changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') ||
changesInclude('test/upgrade/**', 'test/system/*.bash') ||
(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))
depends_on: *build depends_on: *build
matrix: matrix:
- env: - env:
@ -1092,12 +1109,7 @@ success_task:
CTR_FQIN: ${FEDORA_CONTAINER_FQIN} CTR_FQIN: ${FEDORA_CONTAINER_FQIN}
container: *smallcontainer container: *smallcontainer
clone_script: *noop clone_script: *noop
script: | script: *noop
if [[ "$CIRRUS_CHANGE_TITLE" =~ CI:MACHINE ]] && [[ -n "$CIRRUS_PR" ]]; then
echo "Error: Risk of untested change merge."
echo "Please remove [CI:MACHINE] from title."
exit 1
fi
# WARNING: Most of the artifacts captured here are also have their # WARNING: Most of the artifacts captured here are also have their
# permalinks present in the `DOWNLOADS.md` file. Any changes made # permalinks present in the `DOWNLOADS.md` file. Any changes made
@ -1107,7 +1119,6 @@ artifacts_task:
alias: artifacts alias: artifacts
# Docs: ./contrib/cirrus/CIModes.md # Docs: ./contrib/cirrus/CIModes.md
only_if: >- only_if: >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_BRANCH !=~ 'v[0-9\.]+-rhel' && $CIRRUS_BRANCH !=~ 'v[0-9\.]+-rhel' &&
$CIRRUS_BASE_BRANCH !=~ 'v[0-9\.]+-rhel' $CIRRUS_BASE_BRANCH !=~ 'v[0-9\.]+-rhel'
depends_on: depends_on:

View File

@ -3,8 +3,6 @@ Thanks for sending a pull request!
Please make sure you've read our contributing guidelines and how to submit a pull request (https://github.com/containers/podman/blob/main/CONTRIBUTING.md#submitting-pull-requests). Please make sure you've read our contributing guidelines and how to submit a pull request (https://github.com/containers/podman/blob/main/CONTRIBUTING.md#submitting-pull-requests).
In case you're only changing docs, make sure to prefix the pull-request title with "[CI:DOCS]". That will prevent functional tests from running and save time and energy.
Finally, be sure to sign commits with your real name. Since by opening Finally, be sure to sign commits with your real name. Since by opening
a PR you already have commits, you can add signatures if needed with a PR you already have commits, you can add signatures if needed with
something like `git commit -s --amend`. something like `git commit -s --amend`.

View File

@ -162,10 +162,6 @@ when the PR is merged.
PRs will be approved by an [approver][owners] listed in [`OWNERS`](OWNERS). PRs will be approved by an [approver][owners] listed in [`OWNERS`](OWNERS).
In case you're only changing docs, make sure to prefix the PR title with
"[CI:DOCS]". That will prevent functional tests from running and save time and
energy.
### Describe your Changes in Commit Messages ### Describe your Changes in Commit Messages
Describe your problem. Whether your patch is a one-line bug fix or 5000 lines Describe your problem. Whether your patch is a one-line bug fix or 5000 lines

View File

@ -42,72 +42,32 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
## Cirrus Task contexts and runtime modes ## Cirrus Task contexts and runtime modes
### Intended general PR Tasks (*italic*: matrix) By default cirrus will trigger task depending on the source changes.
+ *build*
+ validate
+ bindings
+ swagger
+ *alt_build*
+ osx_alt_build
+ freebsd_alt_build
+ docker-py_test
+ *unit_test*
+ apiv2_test
+ *compose_test*
+ *local_integration_test*
+ *remote_integration_test*
+ *container_integration_test*
+ *rootless_integration_test*
+ *local_system_test*
+ *remote_system_test*
+ *rootless_remote_system_test*
+ *buildah_bud_test*
+ *rootless_system_test*
+ rootless_gitlab_test
+ *upgrade_test*
+ meta
+ success
+ artifacts
### Intended for PR w/ "release" or "bump" in title: It is implemented using the `only_if` field for the cirrus tasks, this logic
+ (All the general PR tasks above) uses the following main rules:
+ release_test - Never skip on cron runs: `$CIRRUS_PR == ''`
- Never skip when using the special `CI:ALL` title: `$CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*'`, see below.
- Never skip when a danger file is changed, these files contain things that can
affect any tasks so the code cannot skip it. It includes
- `.cirrus.yml` (cirrus changes)
- `Makefile` (make targets are used to trigger tests)
- `contrib/cirrus/**` (cirrus scripts to run the tests)
- `vendor/**` (dependency updates)
- `hack/**` (contains scripts used by several tests)
- `version/rawversion/*` (podman version changes, intended to ensure all release PRs test everything to not release known broken code)
### Intended `[CI:DOCS]` PR Tasks: After that, task-specific rules are added, check [.cirrus.yml](../../.cirrus.yml) for them.
+ *build* Another common rule used there is `(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))`.
+ validate This rule defines the set of source code. Podman uses both go and c source code,
+ swagger however as some tests are also using go code we manually exclude the test
+ meta directories from this list.
+ success
### Intended `[CI:BUILD]` PR Tasks: ### Intended `[CI:ALL]` behavior:
+ *build*
+ validate
+ *alt_build*
+ osx_alt_build
+ freebsd_alt_build
+ meta
+ success
+ artifacts
### Intended `[CI:MACHINE]` PR Tasks: As of June 2024, the default Cirrus CI setup skips tasks that it deems
unnecessary, such as running e2e or system tests on a doc-only PR (see
If and only if the PR is in **draft-mode**, run only the following #23174). This string in a PR title forces all CI jobs to run.
tasks. The draft-mode check is necessary to remove the risk of
merging a change that affects the untested aspects of podman.
+ *build*
+ validate
+ *alt_build*
+ win_installer
+ osx_alt_build
+ podman_machine_task
+ podman_machine_aarch64_task
+ podman_machine_windows_task
+ podman_machine_mac_task
+ meta
+ success
+ artifacts
### Intended `[CI:NEXT]` behavior: ### Intended `[CI:NEXT]` behavior:
@ -125,32 +85,3 @@ is removed.
**Note:** When changing the draft-status of PR, you will need to re-push a **Note:** When changing the draft-status of PR, you will need to re-push a
commit-change before Cirrus-CI will notice the draft-status update (i.e. commit-change before Cirrus-CI will notice the draft-status update (i.e.
pressing the re-run button **is not** good enough). pressing the re-run button **is not** good enough).
### Intended `[CI:ALL]` behavior:
Run even the tasks that are skipped based on changed sources conditions otherwise.
### Intended Branch tasks (and Cirrus-cron jobs):
+ *build*
+ swagger
+ *alt_build*
+ osx_alt_build
+ freebsd_alt_build
+ *local_system_test*
+ *remote_system_test*
+ *rootless_remote_system_test*
+ *rootless_system_test*
+ meta
+ success
+ artifacts
### Intended for new Tag tasks:
+ *build*
+ swagger
+ *alt_build*
+ osx_alt_build
+ freebsd_alt_build
+ meta
+ success
+ artifacts
+ release

View File

@ -60,20 +60,20 @@ class TestDependsOn(TestCaseBase):
msg=('No success aggregation task depends_on "{0}"'.format(task_name)) msg=('No success aggregation task depends_on "{0}"'.format(task_name))
self.assertIn(task_name, success_deps, msg=msg) self.assertIn(task_name, success_deps, msg=msg)
def test_skips(self): def test_only_if(self):
"""2024-06 PR#23030: ugly but necessary duplication in skip conditions. Prevent typos or unwanted changes.""" """2024-07 PR#23174: ugly but necessary duplication in only_if conditions. Prevent typos or unwanted changes."""
beginning = "$CIRRUS_PR != '' && $CIRRUS_CHANGE_TITLE !=~ '.*CI:ALL.*' && !changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') && " beginning = "$CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'hack/**', 'version/rawversion/*') || "
real_source_changes = " && !(changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))" real_source_changes = " || (changesInclude('**/*.go', '**/*.c') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))"
for task_name in self.ALL_TASK_NAMES: for task_name in self.ALL_TASK_NAMES:
task = self.CIRRUS_YAML[task_name + '_task'] task = self.CIRRUS_YAML[task_name + '_task']
if 'skip' in task: if 'only_if' in task:
skip = task['skip'] only_if = task['only_if']
if 'changesInclude' in skip: if 'changesInclude' in only_if:
msg = ('{0}: invalid skip'.format(task_name)) msg = ('{0}: invalid only_if'.format(task_name))
self.assertEqual(skip[:len(beginning)], beginning, msg=msg+": beginning part is wrong") self.assertEqual(only_if[:len(beginning)], beginning, msg=msg+": beginning part is wrong")
if 'changesIncludeOnly' in skip: if 'changesIncludeOnly' in only_if:
self.assertEqual(skip[len(skip)-len(real_source_changes):], real_source_changes, msg=msg+": changesIncludeOnly() part is wrong") self.assertEqual(only_if[len(only_if)-len(real_source_changes):], real_source_changes, msg=msg+": changesIncludeOnly() part is wrong")
def not_task(self): def not_task(self):
"""Ensure no task is named 'task'""" """Ensure no task is named 'task'"""