Commit c4c79816 authored by Rémy Coutable's avatar Rémy Coutable Committed by Albert Salim

Run only minimal jobs in fork pipelines

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent e347efe8
...@@ -73,6 +73,9 @@ ...@@ -73,6 +73,9 @@
.if-security-merge-request: &if-security-merge-request .if-security-merge-request: &if-security-merge-request
if: '$CI_PROJECT_NAMESPACE == "gitlab-org/security" && $CI_MERGE_REQUEST_IID' if: '$CI_PROJECT_NAMESPACE == "gitlab-org/security" && $CI_MERGE_REQUEST_IID'
.if-fork-merge-request: &if-fork-merge-request
if: '$CI_PROJECT_NAMESPACE !~ /^gitlab(-org)?($|\/)/ && $CI_MERGE_REQUEST_IID && $CI_MERGE_REQUEST_LABELS !~ /pipeline:run-all-rspec/'
.if-default-branch-schedule-2-hourly: &if-default-branch-schedule-2-hourly .if-default-branch-schedule-2-hourly: &if-default-branch-schedule-2-hourly
if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule" && $FREQUENCY == "2-hourly"' if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule" && $FREQUENCY == "2-hourly"'
...@@ -731,6 +734,8 @@ ...@@ -731,6 +734,8 @@
.frontend:rules:jest: .frontend:rules:jest:
rules: rules:
- <<: *if-fork-merge-request
when: never
- <<: *if-merge-request-labels-run-all-jest - <<: *if-merge-request-labels-run-all-jest
- <<: *if-default-refs - <<: *if-default-refs
changes: *core-frontend-patterns changes: *core-frontend-patterns
...@@ -747,11 +752,12 @@ ...@@ -747,11 +752,12 @@
.frontend:rules:jest:minimal: .frontend:rules:jest:minimal:
rules: rules:
- <<: *if-fork-merge-request
changes: *code-backstage-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- <<: *if-merge-request-labels-run-all-jest - <<: *if-merge-request-labels-run-all-jest
when: never when: never
- <<: *if-default-refs - changes: *core-frontend-patterns
changes: *core-frontend-patterns
when: never when: never
- <<: *if-merge-request - <<: *if-merge-request
changes: *ci-patterns changes: *ci-patterns
...@@ -882,11 +888,15 @@ ...@@ -882,11 +888,15 @@
.rails:rules:ee-and-foss-migration: .rails:rules:ee-and-foss-migration:
rules: rules:
- <<: *if-fork-merge-request
when: never
- <<: *if-merge-request-labels-run-all-rspec - <<: *if-merge-request-labels-run-all-rspec
- <<: *if-merge-request - <<: *if-merge-request
changes: *core-backend-patterns changes: *core-backend-patterns
- <<: *if-merge-request - <<: *if-merge-request
changes: *ci-patterns changes: *ci-patterns
# When DB schema changes, many migrations spec may be affected. However, the test mapping from Crystalball does not map db change to a specific migration spec well.
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68840.
- <<: *if-merge-request - <<: *if-merge-request
changes: *db-patterns changes: *db-patterns
- <<: *if-automated-merge-request - <<: *if-automated-merge-request
...@@ -899,8 +909,12 @@ ...@@ -899,8 +909,12 @@
.rails:rules:ee-and-foss-migration:minimal: .rails:rules:ee-and-foss-migration:minimal:
rules: rules:
- <<: *if-fork-merge-request
changes: *db-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:unit-integration:minimal-default-rules", rules]
# When DB schema changes, many migrations spec may be affected. However, the test mapping from Crystalball does not map db change to a specific migration spec well.
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68840.
- <<: *if-merge-request - <<: *if-merge-request
changes: *db-patterns changes: *db-patterns
when: never when: never
...@@ -921,11 +935,15 @@ ...@@ -921,11 +935,15 @@
.rails:rules:ee-and-foss-unit: .rails:rules:ee-and-foss-unit:
rules: rules:
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:ee-and-foss-default-rules", rules] - !reference [".rails:rules:ee-and-foss-default-rules", rules]
- changes: *backend-patterns - changes: *backend-patterns
.rails:rules:ee-and-foss-unit:minimal: .rails:rules:ee-and-foss-unit:minimal:
rules: rules:
- <<: *if-fork-merge-request
changes: *backend-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:unit-integration:minimal-default-rules", rules]
- <<: *if-merge-request - <<: *if-merge-request
...@@ -933,11 +951,15 @@ ...@@ -933,11 +951,15 @@
.rails:rules:ee-and-foss-integration: .rails:rules:ee-and-foss-integration:
rules: rules:
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:ee-and-foss-default-rules", rules] - !reference [".rails:rules:ee-and-foss-default-rules", rules]
- changes: *backend-patterns - changes: *backend-patterns
.rails:rules:ee-and-foss-integration:minimal: .rails:rules:ee-and-foss-integration:minimal:
rules: rules:
- <<: *if-fork-merge-request
changes: *backend-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:unit-integration:minimal-default-rules", rules]
- <<: *if-merge-request - <<: *if-merge-request
...@@ -945,11 +967,15 @@ ...@@ -945,11 +967,15 @@
.rails:rules:ee-and-foss-system: .rails:rules:ee-and-foss-system:
rules: rules:
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:system-default-rules", rules] - !reference [".rails:rules:system-default-rules", rules]
- changes: *code-backstage-patterns - changes: *code-backstage-patterns
.rails:rules:ee-and-foss-system:minimal: .rails:rules:ee-and-foss-system:minimal:
rules: rules:
- <<: *if-fork-merge-request
changes: *code-backstage-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:system:minimal-default-rules", rules] - !reference [".rails:rules:system:minimal-default-rules", rules]
...@@ -976,6 +1002,8 @@ ...@@ -976,6 +1002,8 @@
changes: *core-backend-patterns changes: *core-backend-patterns
- <<: *if-merge-request - <<: *if-merge-request
changes: *ci-patterns changes: *ci-patterns
# When DB schema changes, many migrations spec may be affected. However, the test mapping from Crystalball does not map db change to a specific migration spec well.
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68840.
- <<: *if-merge-request - <<: *if-merge-request
changes: *db-patterns changes: *db-patterns
- <<: *if-automated-merge-request - <<: *if-automated-merge-request
...@@ -992,6 +1020,8 @@ ...@@ -992,6 +1020,8 @@
when: never when: never
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:unit-integration:minimal-default-rules", rules]
# When DB schema changes, many migrations spec may be affected. However, the test mapping from Crystalball does not map db change to a specific migration spec well.
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68840.
- <<: *if-merge-request - <<: *if-merge-request
changes: *db-patterns changes: *db-patterns
when: never when: never
...@@ -1000,6 +1030,8 @@ ...@@ -1000,6 +1030,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:ee-and-foss-default-rules", rules] - !reference [".rails:rules:ee-and-foss-default-rules", rules]
- changes: *backend-patterns - changes: *backend-patterns
...@@ -1007,6 +1039,8 @@ ...@@ -1007,6 +1039,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
changes: *backend-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:unit-integration:minimal-default-rules", rules]
- <<: *if-merge-request - <<: *if-merge-request
...@@ -1016,6 +1050,8 @@ ...@@ -1016,6 +1050,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:ee-and-foss-default-rules", rules] - !reference [".rails:rules:ee-and-foss-default-rules", rules]
- changes: *backend-patterns - changes: *backend-patterns
...@@ -1023,6 +1059,8 @@ ...@@ -1023,6 +1059,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
changes: *backend-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:unit-integration:minimal-default-rules", rules]
- <<: *if-merge-request - <<: *if-merge-request
...@@ -1032,6 +1070,8 @@ ...@@ -1032,6 +1070,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:system-default-rules", rules] - !reference [".rails:rules:system-default-rules", rules]
- changes: *code-backstage-patterns - changes: *code-backstage-patterns
...@@ -1039,6 +1079,8 @@ ...@@ -1039,6 +1079,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
changes: *code-backstage-patterns
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:system:minimal-default-rules", rules] - !reference [".rails:rules:system:minimal-default-rules", rules]
...@@ -1051,8 +1093,8 @@ ...@@ -1051,8 +1093,8 @@
changes: *core-backend-patterns changes: *core-backend-patterns
- <<: *if-merge-request - <<: *if-merge-request
changes: *ci-patterns changes: *ci-patterns
- <<: *if-security-merge-request # When DB schema changes, many migrations spec may be affected. However, the test mapping from Crystalball does not map db change to a specific migration spec well.
changes: *db-patterns # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68840.
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
changes: *db-patterns changes: *db-patterns
- <<: *if-automated-merge-request - <<: *if-automated-merge-request
...@@ -1068,6 +1110,8 @@ ...@@ -1068,6 +1110,8 @@
when: never when: never
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:as-if-foss-migration-unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:as-if-foss-migration-unit-integration:minimal-default-rules", rules]
# When DB schema changes, many migrations spec may be affected. However, the test mapping from Crystalball does not map db change to a specific migration spec well.
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68840.
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
changes: *db-patterns changes: *db-patterns
when: never when: never
...@@ -1076,6 +1120,8 @@ ...@@ -1076,6 +1120,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:ee-and-foss-default-rules", rules] - !reference [".rails:rules:ee-and-foss-default-rules", rules]
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
changes: *backend-patterns changes: *backend-patterns
...@@ -1084,6 +1130,8 @@ ...@@ -1084,6 +1130,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:as-if-foss-migration-unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:as-if-foss-migration-unit-integration:minimal-default-rules", rules]
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
...@@ -1093,6 +1141,8 @@ ...@@ -1093,6 +1141,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:ee-and-foss-default-rules", rules] - !reference [".rails:rules:ee-and-foss-default-rules", rules]
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
changes: *backend-patterns changes: *backend-patterns
...@@ -1101,6 +1151,8 @@ ...@@ -1101,6 +1151,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- !reference [".rails:rules:as-if-foss-migration-unit-integration:minimal-default-rules", rules] - !reference [".rails:rules:as-if-foss-migration-unit-integration:minimal-default-rules", rules]
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
...@@ -1110,6 +1162,8 @@ ...@@ -1110,6 +1162,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:system-default-rules", rules] - !reference [".rails:rules:system-default-rules", rules]
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
changes: *code-backstage-patterns changes: *code-backstage-patterns
...@@ -1118,6 +1172,8 @@ ...@@ -1118,6 +1172,8 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-fork-merge-request
when: never
- !reference [".rails:rules:minimal-default-rules", rules] - !reference [".rails:rules:minimal-default-rules", rules]
- <<: *if-merge-request - <<: *if-merge-request
changes: *core-backend-patterns changes: *core-backend-patterns
......
...@@ -90,6 +90,13 @@ In addition, there are a few circumstances where we would always run the full Je ...@@ -90,6 +90,13 @@ In addition, there are a few circumstances where we would always run the full Je
- when any vendored JavaScript file is changed (i.e. `vendor/assets/javascripts/**/*`) - when any vendored JavaScript file is changed (i.e. `vendor/assets/javascripts/**/*`)
- when any backend file is changed ([see the patterns list for details](https://gitlab.com/gitlab-org/gitlab/-/blob/3616946936c1adbd9e754c1bd06f86ba670796d8/.gitlab/ci/rules.gitlab-ci.yml#L205-216)) - when any backend file is changed ([see the patterns list for details](https://gitlab.com/gitlab-org/gitlab/-/blob/3616946936c1adbd9e754c1bd06f86ba670796d8/.gitlab/ci/rules.gitlab-ci.yml#L205-216))
### Fork pipelines
We only run the minimal RSpec & Jest jobs for fork pipelines unless the `pipeline:run-all-rspec`
label is set on the MR. The goal is to reduce the CI minutes consumed by fork pipelines.
See the [experiment issue](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1170).
## Fail-fast job in merge request pipelines ## Fail-fast job in merge request pipelines
To provide faster feedback when a merge request breaks existing tests, we are experimenting with a To provide faster feedback when a merge request breaks existing tests, we are experimenting with a
...@@ -176,6 +183,8 @@ Tests that are [known to be flaky](testing_guide/flaky_tests.md#automatic-retrie ...@@ -176,6 +183,8 @@ Tests that are [known to be flaky](testing_guide/flaky_tests.md#automatic-retrie
skipped unless the `$SKIP_FLAKY_TESTS_AUTOMATICALLY` variable is set to `false` or if the `~"pipeline:run-flaky-tests"` skipped unless the `$SKIP_FLAKY_TESTS_AUTOMATICALLY` variable is set to `false` or if the `~"pipeline:run-flaky-tests"`
label is set on the MR. label is set on the MR.
See the [experiment issue](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1069).
#### Automatic retry of failing tests in a separate process #### Automatic retry of failing tests in a separate process
When the `$RETRY_FAILED_TESTS_IN_NEW_PROCESS` variable is set to `true`, RSpec tests that failed are automatically retried once in a separate When the `$RETRY_FAILED_TESTS_IN_NEW_PROCESS` variable is set to `true`, RSpec tests that failed are automatically retried once in a separate
...@@ -183,6 +192,8 @@ RSpec process. The goal is to get rid of most side-effects from previous tests t ...@@ -183,6 +192,8 @@ RSpec process. The goal is to get rid of most side-effects from previous tests t
We keep track of retried tests in the `$RETRIED_TESTS_REPORT_FILE` file saved as artifact by the `rspec:flaky-tests-report` job. We keep track of retried tests in the `$RETRIED_TESTS_REPORT_FILE` file saved as artifact by the `rspec:flaky-tests-report` job.
See the [experiment issue](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1148).
### Monitoring ### Monitoring
The GitLab test suite is [monitored](performance.md#rspec-profiling) for the `main` branch, and any branch The GitLab test suite is [monitored](performance.md#rspec-profiling) for the `main` branch, and any branch
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment