debian-mirror-gitlab/.gitlab/ci/review-apps/rules.gitlab-ci.yml
2023-01-13 15:02:22 +05:30

103 lines
3 KiB
YAML

# Specific specs passed
.specific-specs: &specific-specs
if: $QA_TESTS != ""
# No specific specs passed
.all-specs: &all-specs
if: $QA_TESTS == ""
# No specific specs in mr pipeline
.all-specs-mr: &all-specs-mr
if: $CI_MERGE_REQUEST_IID && $QA_TESTS == ""
when: manual
# Triggered by change pattern
.app-changes: &app-changes
if: $APP_CHANGE_TRIGGER == "true"
# Run all tests when framework changes present or explicitly enabled full suite execution
.qa-run-all-tests: &qa-run-all-tests
if: $QA_FRAMEWORK_CHANGES == "true" || $QA_RUN_ALL_TESTS == "true"
.default-branch: &default-branch
if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
.qa-manual: &qa-manual
when: manual
allow_failure: true
variables:
QA_TESTS: ""
.never-when-qa-run-all-tests-or-no-specific-specs:
- <<: *qa-run-all-tests
when: never
- <<: *all-specs
when: never
.never-when-specific-specs-always-when-qa-run-all-tests:
- *qa-run-all-tests
- <<: *specific-specs
when: manual
allow_failure: true
variables:
QA_TESTS: ""
# ------------------------------------------
# Prepare
# ------------------------------------------
.rules:dont-interrupt:
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_MERGE_REQUEST_IID
when: manual
allow_failure: true
# ------------------------------------------
# Test
# ------------------------------------------
.rules:qa-smoke:
rules:
# always trigger smoke suite if review pipeline got triggered by specific changes in application code
- <<: *app-changes
variables:
QA_TESTS: "" # unset QA_TESTS even if specific tests were inferred from stage label
- *qa-run-all-tests
- if: $QA_SUITES =~ /Test::Instance::Smoke/
- *qa-manual
.rules:qa-blocking:
rules:
- <<: *app-changes
when: never
- !reference [.never-when-qa-run-all-tests-or-no-specific-specs]
- if: $QA_SUITES =~ /Test::Instance::ReviewBlocking/
.rules:qa-blocking-parallel:
rules:
# always trigger blocking suite if review pipeline got triggered by specific changes in application code
- <<: *app-changes
variables:
QA_TESTS: "" # unset QA_TESTS even if specific tests were inferred from stage label
- !reference [.never-when-specific-specs-always-when-qa-run-all-tests]
- if: $QA_SUITES =~ /Test::Instance::ReviewBlocking/
.rules:qa-non-blocking:
rules:
- !reference [.never-when-qa-run-all-tests-or-no-specific-specs]
- if: $QA_SUITES =~ /Test::Instance::ReviewNonBlocking/
.rules:qa-non-blocking-parallel:
rules:
- !reference [.never-when-specific-specs-always-when-qa-run-all-tests]
- *all-specs-mr # set full suite to manual when no specific specs passed in mr
- if: $QA_SUITES =~ /Test::Instance::ReviewNonBlocking/
# ------------------------------------------
# Prepare/Report
# ------------------------------------------
.rules:prepare-report:
rules:
- when: always
.rules:main-run:
rules:
- *default-branch