Commit b1f5934b authored by Lin Jen-Shin's avatar Lin Jen-Shin Committed by Mike Greiling

Run FOSS system tests

* We also use `needs` to speed it up
* To simplify the dependencies, we also pull cache on master
parent 8d6485a1
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
- gitlab-org - gitlab-org
- docker - docker
gitlab:assets:compile: gitlab:assets:compile pull-push-cache:
extends: .gitlab:assets:compile-metadata extends: .gitlab:assets:compile-metadata
only: only:
refs: refs:
...@@ -63,9 +63,6 @@ gitlab:assets:compile: ...@@ -63,9 +63,6 @@ gitlab:assets:compile:
gitlab:assets:compile pull-cache: gitlab:assets:compile pull-cache:
extends: .gitlab:assets:compile-metadata extends: .gitlab:assets:compile-metadata
except:
refs:
- master
cache: cache:
policy: pull policy: pull
...@@ -89,14 +86,14 @@ gitlab:assets:compile pull-cache: ...@@ -89,14 +86,14 @@ gitlab:assets:compile pull-cache:
# we override the max_old_space_size to prevent OOM errors # we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584 NODE_OPTIONS: --max_old_space_size=3584
cache: cache:
key: "assets-compile:test:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:v6" key: "assets-compile:v7"
artifacts: artifacts:
expire_in: 7d expire_in: 7d
paths: paths:
- node_modules - node_modules
- public/assets - public/assets
compile-assets: compile-assets pull-push-cache:
extends: .compile-assets-metadata extends: .compile-assets-metadata
only: only:
refs: refs:
...@@ -104,13 +101,25 @@ compile-assets: ...@@ -104,13 +101,25 @@ compile-assets:
cache: cache:
policy: pull-push policy: pull-push
compile-assets pull-cache: compile-assets pull-push-cache foss:
extends: .compile-assets-metadata extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
except: only:
refs: refs:
- master - master
cache:
policy: pull-push
key: "assets-compile:v7:foss"
compile-assets pull-cache:
extends: .compile-assets-metadata
cache:
policy: pull
compile-assets pull-cache foss:
extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
cache: cache:
policy: pull policy: pull
key: "assets-compile:v7:foss"
.only-code-frontend-job-base: .only-code-frontend-job-base:
extends: extends:
...@@ -121,7 +130,9 @@ compile-assets pull-cache: ...@@ -121,7 +130,9 @@ compile-assets pull-cache:
- .default-before_script - .default-before_script
- .only-code-changes - .only-code-changes
- .use-pg9 - .use-pg9
dependencies: ["compile-assets", "compile-assets pull-cache", "setup-test-env"] stage: test
needs: ["setup-test-env", "compile-assets pull-cache"]
dependencies: ["setup-test-env", "compile-assets pull-cache"]
.karma-base: .karma-base:
extends: .only-code-frontend-job-base extends: .only-code-frontend-job-base
...@@ -195,6 +206,7 @@ jest-foss: ...@@ -195,6 +206,7 @@ jest-foss:
- .default-cache - .default-cache
- .default-only - .default-only
- .only-code-changes - .only-code-changes
stage: test
dependencies: [] dependencies: []
cache: cache:
key: "$CI_JOB_NAME" key: "$CI_JOB_NAME"
...@@ -227,7 +239,9 @@ webpack-dev-server: ...@@ -227,7 +239,9 @@ webpack-dev-server:
- .default-cache - .default-cache
- .default-only - .default-only
- .only-code-changes - .only-code-changes
dependencies: ["setup-test-env", "compile-assets", "compile-assets pull-cache"] stage: test
needs: ["setup-test-env", "compile-assets pull-cache"]
dependencies: ["setup-test-env", "compile-assets pull-cache"]
variables: variables:
WEBPACK_MEMORY_TEST: "true" WEBPACK_MEMORY_TEST: "true"
script: script:
......
...@@ -11,7 +11,7 @@ pages: ...@@ -11,7 +11,7 @@ pages:
variables: variables:
- $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org"
stage: pages stage: pages
dependencies: ["coverage", "karma", "gitlab:assets:compile"] dependencies: ["coverage", "karma", "gitlab:assets:compile pull-cache"]
script: script:
- mv public/ .public/ - mv public/ .public/
- mkdir public/ - mkdir public/
......
...@@ -71,4 +71,4 @@ schedule:package-and-qa: ...@@ -71,4 +71,4 @@ schedule:package-and-qa:
- .package-and-qa-base - .package-and-qa-base
- .only-code-qa-changes - .only-code-qa-changes
- .only-canonical-schedules - .only-canonical-schedules
needs: ["build-qa-image", "gitlab:assets:compile"] needs: ["build-qa-image", "gitlab:assets:compile pull-cache"]
...@@ -53,6 +53,8 @@ setup-test-env: ...@@ -53,6 +53,8 @@ setup-test-env:
.rspec-base: .rspec-base:
extends: .only-code-rails-job-base extends: .only-code-rails-job-base
stage: test stage: test
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache"]
dependencies: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache"]
script: script:
- source scripts/rspec_helpers.sh - source scripts/rspec_helpers.sh
- rspec_paralellized_job "--tag ~quarantine --tag ~geo" - rspec_paralellized_job "--tag ~quarantine --tag ~geo"
...@@ -69,6 +71,11 @@ setup-test-env: ...@@ -69,6 +71,11 @@ setup-test-env:
reports: reports:
junit: junit_rspec.xml junit: junit_rspec.xml
.rspec-base-foss:
extends: [".rspec-base", ".only-ee-as-if-foss"]
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache foss"]
dependencies: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache foss"]
.rspec-base-pg9: .rspec-base-pg9:
extends: extends:
- .rspec-base - .rspec-base
...@@ -76,9 +83,8 @@ setup-test-env: ...@@ -76,9 +83,8 @@ setup-test-env:
.rspec-base-pg9-foss: .rspec-base-pg9-foss:
extends: extends:
- .rspec-base - .rspec-base-foss
- .use-pg9 - .use-pg9
- .only-ee-as-if-foss
.rspec-base-pg10: .rspec-base-pg10:
extends: extends:
...@@ -106,10 +112,9 @@ rspec system pg9: ...@@ -106,10 +112,9 @@ rspec system pg9:
extends: .rspec-base-pg9 extends: .rspec-base-pg9
parallel: 24 parallel: 24
# TODO: This requires FOSS assets rspec system pg9-foss:
# rspec system pg9-foss: extends: .rspec-base-pg9-foss
# extends: .rspec-base-pg9-foss parallel: 24
# parallel: 24
rspec unit pg10: rspec unit pg10:
extends: .rspec-base-pg10 extends: .rspec-base-pg10
...@@ -229,7 +234,9 @@ rspec fast_spec_helper: ...@@ -229,7 +234,9 @@ rspec fast_spec_helper:
static-analysis: static-analysis:
extends: .only-code-qa-rails-job-base extends: .only-code-qa-rails-job-base
dependencies: ["setup-test-env", "compile-assets", "compile-assets pull-cache"] stage: test
needs: ["setup-test-env", "compile-assets pull-cache"]
dependencies: ["setup-test-env", "compile-assets pull-cache"]
variables: variables:
SETUP_DB: "false" SETUP_DB: "false"
script: script:
...@@ -252,16 +259,16 @@ downtime_check: ...@@ -252,16 +259,16 @@ downtime_check:
variables: variables:
- $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ - $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/
stage: test stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"] needs: ["setup-test-env"]
dependencies: ["setup-test-env"]
.db-job-base: .db-job-base:
extends: extends:
- .only-code-rails-job-base - .only-code-rails-job-base
- .use-pg9 - .use-pg9
stage: test stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"] needs: ["setup-test-env"]
dependencies: ["setup-test-env"]
# DB migration, rollback, and seed jobs # DB migration, rollback, and seed jobs
db:migrate:reset: db:migrate:reset:
......
...@@ -81,7 +81,7 @@ schedule:review-build-cng: ...@@ -81,7 +81,7 @@ schedule:review-build-cng:
extends: extends:
- .review-build-cng-base - .review-build-cng-base
- .only-review-schedules - .only-review-schedules
needs: ["gitlab:assets:compile"] needs: ["gitlab:assets:compile pull-cache"]
.review-deploy-base: .review-deploy-base:
extends: extends:
......
...@@ -127,7 +127,7 @@ execute jobs out of order for the following jobs: ...@@ -127,7 +127,7 @@ execute jobs out of order for the following jobs:
```mermaid ```mermaid
graph RL; graph RL;
A[setup-test-env]; A[setup-test-env];
B["gitlab:assets:compile<br/>(master only)"]; B["gitlab:assets:compile pull-push-cache<br/>(master only)"];
C[gitlab:assets:compile pull-cache]; C[gitlab:assets:compile pull-cache];
D["cache gems<br/>(master and tags only)"]; D["cache gems<br/>(master and tags only)"];
E[review-build-cng]; E[review-build-cng];
...@@ -136,7 +136,7 @@ graph RL; ...@@ -136,7 +136,7 @@ graph RL;
G2["schedule:review-deploy<br/>(master only)"]; G2["schedule:review-deploy<br/>(master only)"];
H[karma]; H[karma];
I[jest]; I[jest];
J["compile-assets<br/>(master only)"]; J["compile-assets pull-push-cache<br/>(master only)"];
K[compile-assets pull-cache]; K[compile-assets pull-cache];
L[webpack-dev-server]; L[webpack-dev-server];
M[coverage]; M[coverage];
...@@ -145,39 +145,41 @@ graph RL; ...@@ -145,39 +145,41 @@ graph RL;
P["schedule:package-and-qa<br/>(master schedule only)"]; P["schedule:package-and-qa<br/>(master schedule only)"];
Q[package-and-qa]; Q[package-and-qa];
R[package-and-qa-manual]; R[package-and-qa-manual];
S["RSpec<br/>(e.g. rspec unit pg9)"]
T[retrieve-tests-metadata];
subgraph "`prepare` stage" subgraph "`prepare` stage"
A A
F F
J
K K
J
T
end end
subgraph "`test` stage" subgraph "`test` stage"
B --> |needs| A; B --> |needs| A;
C --> |needs| A; C --> |needs| A;
D --> |needs| A; D --> |needs| A;
H -.-> |depends on| A; H -.-> |needs and depends on| A;
H -.-> |depends on| J; H -.-> |needs and depends on| K;
H -.-> |depends on| K; I -.-> |needs and depends on| A;
I -.-> |depends on| A; I -.-> |needs and depends on| K;
I -.-> |depends on| J; L -.-> |needs and depends on| A;
I -.-> |depends on| K; L -.-> |needs and depends on| K;
L -.-> |depends on| A; O -.-> |needs and depends on| A;
L -.-> |depends on| J; O -.-> |needs and depends on| K;
L -.-> |depends on| K; S -.-> |needs and depends on| A;
S -.-> |needs and depends on| K;
S -.-> |needs and depends on| T;
downtime_check --> |needs and depends on| A; downtime_check --> |needs and depends on| A;
db:* --> |needs| A; db:* --> |needs| A;
gitlab:setup --> |needs| A; gitlab:setup --> |needs| A;
O -.-> |depends on| A;
O -.-> |depends on| B;
O -.-> |depends on| C;
downtime_check --> |needs and depends on| A; downtime_check --> |needs and depends on| A;
end end
subgraph "`review-prepare` stage" subgraph "`review-prepare` stage"
E --> |needs| C; E --> |needs| C;
X["schedule:review-build-cng<br/>(master schedule only)"] --> |needs| B; X["schedule:review-build-cng<br/>(master schedule only)"] --> |needs| C;
end end
subgraph "`review` stage" subgraph "`review` stage"
...@@ -190,7 +192,7 @@ subgraph "`qa` stage" ...@@ -190,7 +192,7 @@ subgraph "`qa` stage"
Q --> |needs| F; Q --> |needs| F;
R --> |needs| C; R --> |needs| C;
R --> |needs| F; R --> |needs| F;
P --> |needs| B; P --> |needs| C;
P --> |needs| F; P --> |needs| F;
review-qa-smoke -.-> |needs and depends on| G; review-qa-smoke -.-> |needs and depends on| G;
review-qa-all -.-> |needs and depends on| G; review-qa-all -.-> |needs and depends on| G;
...@@ -209,7 +211,7 @@ subgraph "`post-test` stage" ...@@ -209,7 +211,7 @@ subgraph "`post-test` stage"
end end
subgraph "`pages` stage" subgraph "`pages` stage"
N -.-> |depends on| B; N -.-> |depends on| C;
N -.-> |depends on| H; N -.-> |depends on| H;
N -.-> |depends on| M; N -.-> |depends on| M;
end end
......
...@@ -175,7 +175,7 @@ describe 'Environment' do ...@@ -175,7 +175,7 @@ describe 'Environment' do
# #
# In EE we have to stub EE::Environment since it overwrites # In EE we have to stub EE::Environment since it overwrites
# the "terminals" method. # the "terminals" method.
allow_any_instance_of(defined?(EE) ? EE::Environment : Environment) allow_any_instance_of(Gitlab.ee? ? EE::Environment : Environment)
.to receive(:terminals) { nil } .to receive(:terminals) { nil }
visit terminal_project_environment_path(project, environment) visit terminal_project_environment_path(project, environment)
......
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