Commit efe73cf7 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '213944-run-as-if-foss-jobs-on-master-only-2' into 'master'

Run `*-as-if-foss` jobs on master only

Closes #213944

See merge request gitlab-org/gitlab!31918
parents 4842489d 0c1398d9
......@@ -163,7 +163,7 @@ frontend-fixtures:
frontend-fixtures-as-if-foss:
extends:
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs-no-foss
- .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss
.frontend-job-base:
......@@ -206,7 +206,7 @@ karma:
karma-as-if-foss:
extends:
- .karma-base
- .frontend:rules:default-frontend-jobs-no-foss
- .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss
needs: ["frontend-fixtures-as-if-foss"]
......@@ -241,7 +241,7 @@ jest:
jest-as-if-foss:
extends:
- .jest-base
- .frontend:rules:default-frontend-jobs-no-foss
- .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss
needs: ["frontend-fixtures-as-if-foss"]
cache:
......
......@@ -23,7 +23,7 @@ qa:internal:
qa:internal-as-if-foss:
extends:
- .qa-job-base
- .qa:rules:ee-only
- .qa:rules:as-if-foss
- .as-if-foss
script:
- bundle exec rspec
......@@ -38,7 +38,7 @@ qa:selectors:
qa:selectors-as-if-foss:
extends:
- qa:selectors
- .qa:rules:ee-only
- .qa:rules:as-if-foss
- .as-if-foss
.package-and-qa-base:
......
......@@ -252,7 +252,8 @@ rspec:coverage:
.rspec-base-pg11-as-if-foss:
extends:
- .rspec-base-ee
- .rspec-base
- .rails:rules:as-if-foss
- .as-if-foss
- .use-pg11
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache as-if-foss"]
......
......@@ -34,6 +34,12 @@
.if-merge-request: &if-merge-request
if: '$CI_MERGE_REQUEST_IID'
.if-merge-request-title-as-if-foss: &if-merge-request-title-as-if-foss
if: '$CI_MERGE_REQUEST_TITLE =~ /RUN AS-IF-FOSS/'
.if-security-merge-request: &if-security-merge-request
if: '$CI_PROJECT_NAMESPACE == "gitlab-org/security" && $CI_MERGE_REQUEST_IID'
.if-dot-com-gitlab-org-schedule: &if-dot-com-gitlab-org-schedule
if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" && $CI_PIPELINE_SOURCE == "schedule"'
......@@ -43,9 +49,6 @@
.if-dot-com-gitlab-org-merge-request: &if-dot-com-gitlab-org-merge-request
if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" && $CI_MERGE_REQUEST_IID'
.if-dot-com-gitlab-org-and-security-merge-request: &if-dot-com-gitlab-org-and-security-merge-request
if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/security$)/ && $CI_MERGE_REQUEST_IID'
.if-dot-com-gitlab-org-and-security-tag: &if-dot-com-gitlab-org-and-security-tag
if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/security$)/ && $CI_COMMIT_TAG'
......@@ -59,6 +62,7 @@
# Changes patterns #
####################
.ci-patterns: &ci-patterns
- ".gitlab-ci.yml"
- ".gitlab/ci/**/*"
.yaml-patterns: &yaml-patterns
......@@ -234,6 +238,7 @@
##################
# Frontend rules #
##################
# This job only runs on `master` since it pushes to the cache.
.frontend:rules:gitlab-assets-compile-pull-push-cache:
rules:
- <<: *if-not-canonical-namespace
......@@ -256,13 +261,14 @@
changes: *code-backstage-qa-patterns
when: on_success
# This job only runs on `master` since it pushes to the cache.
.frontend:rules:compile-assets-pull-push-cache-as-if-foss:
rules:
- <<: *if-not-ee
when: never
- <<: *if-master-refs
- <<: *if-master-push
changes: *code-backstage-qa-patterns
when: on_success
- <<: *if-master-schedule-2-hourly
.frontend:rules:compile-assets-pull-cache:
rules:
......@@ -274,9 +280,14 @@
rules:
- <<: *if-not-ee
when: never
- <<: *if-default-refs
- <<: *if-master-push
changes: *code-backstage-qa-patterns
when: on_success
- <<: *if-master-schedule-2-hourly
- <<: *if-security-merge-request
changes: *code-backstage-qa-patterns
- <<: *if-merge-request-title-as-if-foss
- <<: *if-merge-request
changes: *ci-patterns
.frontend:rules:default-frontend-jobs:
rules:
......@@ -284,13 +295,18 @@
changes: *code-backstage-patterns
when: on_success
.frontend:rules:default-frontend-jobs-no-foss:
.frontend:rules:default-frontend-jobs-as-if-foss:
rules:
- <<: *if-not-ee
when: never
- <<: *if-default-refs
- <<: *if-master-push
changes: *code-backstage-patterns
when: on_success
- <<: *if-master-schedule-2-hourly
- <<: *if-security-merge-request
changes: *code-backstage-patterns
- <<: *if-merge-request-title-as-if-foss
- <<: *if-merge-request
changes: *ci-patterns
.frontend:rules:ee-mr-and-master-only:
rules:
......@@ -348,13 +364,18 @@
changes: *code-qa-patterns
when: on_success
.qa:rules:ee-only:
.qa:rules:as-if-foss:
rules:
- <<: *if-not-ee
when: never
- <<: *if-default-refs
- <<: *if-master-push
changes: *code-qa-patterns
when: on_success
- <<: *if-master-schedule-2-hourly
- <<: *if-security-merge-request
changes: *code-qa-patterns
- <<: *if-merge-request-title-as-if-foss
- <<: *if-merge-request
changes: *ci-patterns
.qa:rules:package-and-qa:
rules:
......@@ -391,6 +412,19 @@
- <<: *if-default-refs
changes: *code-backstage-patterns
.rails:rules:as-if-foss:
rules:
- <<: *if-not-ee
when: never
- <<: *if-master-push
changes: *code-backstage-patterns
- <<: *if-master-schedule-2-hourly
- <<: *if-security-merge-request
changes: *code-backstage-patterns
- <<: *if-merge-request-title-as-if-foss
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:ee-mr-and-master-only:
rules:
- <<: *if-not-ee
......
......@@ -516,6 +516,22 @@ for more information.
Consult the [Review Apps](testing_guide/review_apps.md) dedicated page for more information.
## As-if-FOSS jobs
The `* as-if-foss` jobs allows to run GitLab's test suite "as-if-FOSS", meaning as if the jobs would run in the context
of the `gitlab-org/gitlab-foss` project. These jobs are only created in the following cases:
- `master` commits (pushes and scheduled pipelines).
- `gitlab-org/security/gitlab` merge requests.
- Merge requests which include `RUN AS-IF-FOSS` in their title.
- Merge requests that changes the CI config.
The `* as-if-foss` jobs have the `FOSS_ONLY='1'` variable set and gets their EE-specific
folders removed before the tests start running.
The intent is to ensure that a change won't introduce a failure once the `gitlab-org/gitlab` project will be synced to
the `gitlab-org/gitlab-foss` project.
## Pre-clone step
The `gitlab-org/gitlab` project on GitLab.com uses a [pre-clone step](https://gitlab.com/gitlab-org/gitlab/issues/39134)
......
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