Skip to content

Commit

Permalink
Cirrus: Simplify only_if/skip + optimize multiarch
Browse files Browse the repository at this point in the history
Using both the 'skip' and 'only_if' features at the same time may be
hard for maintainers to decipher.  Consolidate them into `only_if` since
that bypasses creation of the task all together - meaning there are
potentially fewer tasks for a developer to scroll through.

Since the `multiarch` Cirrus-Cron build no-longer depends on the direct
"build-ability" from the current repo. state, it can be further
optimized.  When operating in this context, avoid running many/most
other tasks, depending instead only on `ext_svc_check`.

Signed-off-by: Chris Evich <cevich@redhat.com>
  • Loading branch information
cevich committed May 31, 2022
1 parent 398e7ce commit 5091eeb
Showing 1 changed file with 42 additions and 37 deletions.
79 changes: 42 additions & 37 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ gcp_credentials: ENCRYPTED[a28959877b2c9c36f151781b0a05407218cda646c7d047fc556e4
ext_svc_check_task:
alias: 'ext_svc_check' # int. ref. name - required for depends_on reference
name: "Ext. services" # Displayed Title - has no other significance
skip: &tags "$CIRRUS_TAG != ''" # Don't run on tags
# Don't create this task for new tags so release process is more reliable
only_if: $CIRRUS_TAG == ''
# Default/small container image to execute tasks with
container: &smallcontainer
image: ${CTR_FQIN}
Expand Down Expand Up @@ -117,7 +118,8 @@ ext_svc_check_task:
automation_task:
alias: 'automation'
name: "Check Automation"
skip: &branches_and_tags "$CIRRUS_PR == '' || $CIRRUS_TAG != ''" # Don't run on branches/tags
# This task is not needed for branches, tags, or cron runs.
only_if: &is_pr "$CIRRUS_PR != ''"
container: *smallcontainer
env:
TEST_FLAVOR: automation
Expand All @@ -138,6 +140,8 @@ automation_task:
build_task:
alias: 'build'
name: 'Build for $DISTRO_NV'
# Multiarch doesn't depend on buildability in this automation context
only_if: "$CIRRUS_CRON != 'multiarch'"
gce_instance: &standardvm
image_project: libpod-218412
zone: "us-central1-a"
Expand Down Expand Up @@ -189,7 +193,7 @@ validate_task:
# automation reliability/speed in those contexts. Any missed errors due
# to nonsequential PR merging practices, will be caught on a future PR,
# build or test task failures.
skip: *branches_and_tags
only_if: *is_pr
depends_on:
- ext_svc_check
- automation
Expand Down Expand Up @@ -218,9 +222,11 @@ validate_task:
bindings_task:
name: "Test Bindings"
alias: bindings
# Don't run for [CI:DOCS] or [CI:BUILD]
only_if: &not_build $CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' && $CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*'
skip: *branches_and_tags
# Don't create task for PRs using [CI:DOCS] or [CI:BUILD]
only_if: >-
$CIRRUS_PR != '' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*'
depends_on:
- build
gce_instance: *standardvm
Expand Down Expand Up @@ -249,6 +255,10 @@ bindings_task:
swagger_task:
name: "Test Swagger"
alias: swagger
# Don't create task for [CI:BUILD] or multiarch builds
only_if: >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' &&
$CIRRUS_CRON != 'multiarch'
depends_on:
- build
gce_instance: *standardvm
Expand Down Expand Up @@ -276,7 +286,7 @@ swagger_task:
consistency_task:
name: "Test Code Consistency"
alias: consistency
skip: *tags
only_if: *is_pr
depends_on:
- build
container: *smallcontainer
Expand All @@ -297,8 +307,10 @@ consistency_task:
alt_build_task:
name: "$ALT_NAME"
alias: alt_build
# Don't run for [CI:DOCS]; DO run for [CI:BUILD]
only_if: &not_docs $CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*'
# Don't create task for [CI:DOCS] or multiarch builds
only_if: &not_docs_multiarch >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CRON != 'multiarch'
depends_on:
- build
env:
Expand Down Expand Up @@ -330,7 +342,7 @@ alt_build_task:
osx_alt_build_task:
name: "OSX Cross"
alias: osx_alt_build
only_if: *not_docs
only_if: *not_docs_multiarch
depends_on:
- build
env:
Expand Down Expand Up @@ -359,8 +371,12 @@ osx_alt_build_task:
docker-py_test_task:
name: Docker-py Compat.
alias: docker-py_test
skip: *tags
only_if: *not_build
# Don't create task for tags, or if using [CI:DOCS], [CI:BUILD], multiarch
only_if: &not_tag_build_docs_multiarch >-
$CIRRUS_TAG == '' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' &&
$CIRRUS_CRON != 'multiarch'
depends_on:
- build
gce_instance: *standardvm
Expand All @@ -379,8 +395,7 @@ docker-py_test_task:
unit_test_task:
name: "Unit tests on $DISTRO_NV"
alias: unit_test
skip: *tags
only_if: *not_build
only_if: *not_tag_build_docs_multiarch
depends_on:
- validate
matrix:
Expand All @@ -404,8 +419,7 @@ unit_test_task:
apiv2_test_task:
name: "APIv2 test on $DISTRO_NV"
alias: apiv2_test
only_if: *not_build
skip: *tags
only_if: *not_tag_build_docs_multiarch
depends_on:
- validate
gce_instance: *standardvm
Expand All @@ -424,8 +438,7 @@ apiv2_test_task:
compose_test_task:
name: "$TEST_FLAVOR test on $DISTRO_NV ($PRIV_NAME)"
alias: compose_test
only_if: *not_build
skip: *tags
only_if: *not_tag_build_docs_multiarch
depends_on:
- validate
gce_instance: *standardvm
Expand Down Expand Up @@ -457,8 +470,7 @@ local_integration_test_task: &local_integration_test_task
# <int.|sys.> <podman|remote> <Distro NV> <root|rootless>
name: &std_name_fmt "$TEST_FLAVOR $PODBIN_NAME $DISTRO_NV $PRIV_NAME $TEST_ENVIRON"
alias: local_integration_test
only_if: *not_build
skip: *branches_and_tags
only_if: *not_tag_build_docs_multiarch
depends_on:
- unit_test
matrix: *platform_axis
Expand Down Expand Up @@ -492,8 +504,7 @@ remote_integration_test_task:
container_integration_test_task:
name: *std_name_fmt
alias: container_integration_test
only_if: *not_build
skip: *branches_and_tags
only_if: *not_tag_build_docs_multiarch
depends_on:
- unit_test
matrix: &fedora_vm_axis
Expand Down Expand Up @@ -522,8 +533,7 @@ container_integration_test_task:
rootless_integration_test_task:
name: *std_name_fmt
alias: rootless_integration_test
only_if: *not_build
skip: *branches_and_tags
only_if: *not_tag_build_docs_multiarch
depends_on:
- unit_test
matrix: *platform_axis
Expand All @@ -545,8 +555,7 @@ rootless_integration_test_task:
local_system_test_task: &local_system_test_task
name: *std_name_fmt
alias: local_system_test
skip: *tags
only_if: *not_build
only_if: *not_tag_build_docs_multiarch
depends_on:
- local_integration_test
matrix: *platform_axis
Expand Down Expand Up @@ -593,8 +602,7 @@ rootless_remote_system_test_task:
buildah_bud_test_task:
name: *std_name_fmt
alias: buildah_bud_test
skip: *tags
only_if: *not_build
only_if: *not_tag_build_docs_multiarch
depends_on:
- local_integration_test
env:
Expand All @@ -621,8 +629,7 @@ buildah_bud_test_task:
rootless_system_test_task:
name: *std_name_fmt
alias: rootless_system_test
skip: *tags
only_if: *not_build
only_if: *not_tag_build_docs_multiarch
depends_on:
- rootless_integration_test
matrix: *platform_axis
Expand All @@ -639,8 +646,7 @@ rootless_system_test_task:
rootless_gitlab_test_task:
name: *std_name_fmt
alias: rootless_gitlab_test
skip: *tags
only_if: *not_build
only_if: *not_tag_build_docs_multiarch
# Community-maintained downstream test may fail unexpectedly.
# Ref. repository: https://gitlab.com/gitlab-org/gitlab-runner
# If necessary, uncomment the next line and file issue(s) with details.
Expand All @@ -666,8 +672,7 @@ rootless_gitlab_test_task:
upgrade_test_task:
name: "Upgrade test: from $PODMAN_UPGRADE_FROM"
alias: upgrade_test
skip: *tags
only_if: *not_build
only_if: *not_tag_build_docs_multiarch
depends_on:
- local_system_test
matrix:
Expand Down Expand Up @@ -697,7 +702,7 @@ image_build_task: &image-build
# this task to a specific Cirrus-Cron entry with this name.
only_if: $CIRRUS_CRON == 'multiarch'
depends_on:
- build
- ext_svc_check
timeout_in: 120m # emulation is sssllllooooowwww
gce_instance:
<<: *standardvm
Expand Down Expand Up @@ -809,7 +814,7 @@ success_task:
artifacts_task:
name: "Artifacts"
alias: artifacts
only_if: *not_docs
only_if: *not_docs_multiarch
depends_on:
- success
# This task is a secondary/convenience for downstream consumers, don't
Expand Down Expand Up @@ -862,7 +867,7 @@ artifacts_task:
release_task:
name: "Verify Release"
alias: release
only_if: *tags
only_if: $CIRRUS_TAG != ''
depends_on:
- success
gce_instance: *standardvm
Expand Down

0 comments on commit 5091eeb

Please sign in to comment.