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: ...@@ -163,7 +163,7 @@ frontend-fixtures:
frontend-fixtures-as-if-foss: frontend-fixtures-as-if-foss:
extends: extends:
- .frontend-fixtures-base - .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs-no-foss - .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss - .as-if-foss
.frontend-job-base: .frontend-job-base:
...@@ -206,7 +206,7 @@ karma: ...@@ -206,7 +206,7 @@ karma:
karma-as-if-foss: karma-as-if-foss:
extends: extends:
- .karma-base - .karma-base
- .frontend:rules:default-frontend-jobs-no-foss - .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss - .as-if-foss
needs: ["frontend-fixtures-as-if-foss"] needs: ["frontend-fixtures-as-if-foss"]
...@@ -241,7 +241,7 @@ jest: ...@@ -241,7 +241,7 @@ jest:
jest-as-if-foss: jest-as-if-foss:
extends: extends:
- .jest-base - .jest-base
- .frontend:rules:default-frontend-jobs-no-foss - .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss - .as-if-foss
needs: ["frontend-fixtures-as-if-foss"] needs: ["frontend-fixtures-as-if-foss"]
cache: cache:
......
...@@ -23,7 +23,7 @@ qa:internal: ...@@ -23,7 +23,7 @@ qa:internal:
qa:internal-as-if-foss: qa:internal-as-if-foss:
extends: extends:
- .qa-job-base - .qa-job-base
- .qa:rules:ee-only - .qa:rules:as-if-foss
- .as-if-foss - .as-if-foss
script: script:
- bundle exec rspec - bundle exec rspec
...@@ -38,7 +38,7 @@ qa:selectors: ...@@ -38,7 +38,7 @@ qa:selectors:
qa:selectors-as-if-foss: qa:selectors-as-if-foss:
extends: extends:
- qa:selectors - qa:selectors
- .qa:rules:ee-only - .qa:rules:as-if-foss
- .as-if-foss - .as-if-foss
.package-and-qa-base: .package-and-qa-base:
......
...@@ -252,7 +252,8 @@ rspec:coverage: ...@@ -252,7 +252,8 @@ rspec:coverage:
.rspec-base-pg11-as-if-foss: .rspec-base-pg11-as-if-foss:
extends: extends:
- .rspec-base-ee - .rspec-base
- .rails:rules:as-if-foss
- .as-if-foss - .as-if-foss
- .use-pg11 - .use-pg11
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache as-if-foss"] needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache as-if-foss"]
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
.if-merge-request: &if-merge-request .if-merge-request: &if-merge-request
if: '$CI_MERGE_REQUEST_IID' 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-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"' if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" && $CI_PIPELINE_SOURCE == "schedule"'
...@@ -43,9 +49,6 @@ ...@@ -43,9 +49,6 @@
.if-dot-com-gitlab-org-merge-request: &if-dot-com-gitlab-org-merge-request .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: '$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-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' if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/security$)/ && $CI_COMMIT_TAG'
...@@ -59,6 +62,7 @@ ...@@ -59,6 +62,7 @@
# Changes patterns # # Changes patterns #
#################### ####################
.ci-patterns: &ci-patterns .ci-patterns: &ci-patterns
- ".gitlab-ci.yml"
- ".gitlab/ci/**/*" - ".gitlab/ci/**/*"
.yaml-patterns: &yaml-patterns .yaml-patterns: &yaml-patterns
...@@ -234,6 +238,7 @@ ...@@ -234,6 +238,7 @@
################## ##################
# Frontend rules # # Frontend rules #
################## ##################
# This job only runs on `master` since it pushes to the cache.
.frontend:rules:gitlab-assets-compile-pull-push-cache: .frontend:rules:gitlab-assets-compile-pull-push-cache:
rules: rules:
- <<: *if-not-canonical-namespace - <<: *if-not-canonical-namespace
...@@ -256,13 +261,14 @@ ...@@ -256,13 +261,14 @@
changes: *code-backstage-qa-patterns changes: *code-backstage-qa-patterns
when: on_success 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: .frontend:rules:compile-assets-pull-push-cache-as-if-foss:
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-master-refs - <<: *if-master-push
changes: *code-backstage-qa-patterns changes: *code-backstage-qa-patterns
when: on_success - <<: *if-master-schedule-2-hourly
.frontend:rules:compile-assets-pull-cache: .frontend:rules:compile-assets-pull-cache:
rules: rules:
...@@ -274,9 +280,14 @@ ...@@ -274,9 +280,14 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-default-refs - <<: *if-master-push
changes: *code-backstage-qa-patterns 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: .frontend:rules:default-frontend-jobs:
rules: rules:
...@@ -284,13 +295,18 @@ ...@@ -284,13 +295,18 @@
changes: *code-backstage-patterns changes: *code-backstage-patterns
when: on_success when: on_success
.frontend:rules:default-frontend-jobs-no-foss: .frontend:rules:default-frontend-jobs-as-if-foss:
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-default-refs - <<: *if-master-push
changes: *code-backstage-patterns 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: .frontend:rules:ee-mr-and-master-only:
rules: rules:
...@@ -348,13 +364,18 @@ ...@@ -348,13 +364,18 @@
changes: *code-qa-patterns changes: *code-qa-patterns
when: on_success when: on_success
.qa:rules:ee-only: .qa:rules:as-if-foss:
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-default-refs - <<: *if-master-push
changes: *code-qa-patterns 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: .qa:rules:package-and-qa:
rules: rules:
...@@ -391,6 +412,19 @@ ...@@ -391,6 +412,19 @@
- <<: *if-default-refs - <<: *if-default-refs
changes: *code-backstage-patterns 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: .rails:rules:ee-mr-and-master-only:
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
......
...@@ -516,6 +516,22 @@ for more information. ...@@ -516,6 +516,22 @@ for more information.
Consult the [Review Apps](testing_guide/review_apps.md) dedicated page 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 ## Pre-clone step
The `gitlab-org/gitlab` project on GitLab.com uses a [pre-clone step](https://gitlab.com/gitlab-org/gitlab/issues/39134) 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