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

ci: Introduce dedicated cache for the 'setup-test-env' job

This job can take advantage of the Go cache (i.e. '.go/pkg/mod/'), but
other "Rails" jobs don't need this folder which currently contains 48554
files.

This should speed up the cache download for the "Rails" jobs.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 97a635c6
...@@ -16,15 +16,23 @@ ...@@ -16,15 +16,23 @@
- source scripts/utils.sh - source scripts/utils.sh
- source scripts/prepare_build.sh - source scripts/prepare_build.sh
.rails-cache: .setup-test-env-cache:
cache: cache:
key: "rails-v3" key: "setup-test-env-v1"
paths: paths:
- vendor/ruby/ - vendor/ruby/
- vendor/gitaly-ruby/ - vendor/gitaly-ruby/
- .go/pkg/mod/ - .go/pkg/mod/
policy: pull policy: pull
.rails-cache:
cache:
key: "rails-v4"
paths:
- vendor/ruby/
- vendor/gitaly-ruby/
policy: pull
.static-analysis-cache: .static-analysis-cache:
cache: cache:
key: "static-analysis-v2" key: "static-analysis-v2"
......
...@@ -141,6 +141,7 @@ ...@@ -141,6 +141,7 @@
setup-test-env: setup-test-env:
extends: extends:
- .rails-job-base - .rails-job-base
- .setup-test-env-cache
- .rails:rules:default-refs-code-backstage-qa - .rails:rules:default-refs-code-backstage-qa
- .use-pg11 - .use-pg11
stage: prepare stage: prepare
...@@ -180,14 +181,20 @@ setup-test-env: ...@@ -180,14 +181,20 @@ setup-test-env:
- tmp/tests/second_storage/ - tmp/tests/second_storage/
when: always when: always
update-rails-cache: update-setup-test-env-cache:
extends: extends:
- setup-test-env - setup-test-env
- .shared:rules:update-cache - .shared:rules:update-cache
artifacts: {} # This job's purpose is only to update the cache. artifacts:
paths: [] # This job's purpose is only to update the cache.
cache: cache:
policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up.
update-rails-cache:
extends:
- update-setup-test-env-cache
- .rails-cache
.coverage-base: .coverage-base:
extends: extends:
- .default-retry - .default-retry
......
...@@ -493,6 +493,7 @@ request, be sure to start the `dont-interrupt-me` job before pushing. ...@@ -493,6 +493,7 @@ request, be sure to start the `dont-interrupt-me` job before pushing.
1. We currently have several different caches defined in 1. We currently have several different caches defined in
[`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/global.gitlab-ci.yml), [`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/global.gitlab-ci.yml),
with fixed keys: with fixed keys:
- `.setup-test-env-cache`.
- `.rails-cache`. - `.rails-cache`.
- `.static-analysis-cache`. - `.static-analysis-cache`.
- `.coverage-cache` - `.coverage-cache`
...@@ -500,6 +501,7 @@ request, be sure to start the `dont-interrupt-me` job before pushing. ...@@ -500,6 +501,7 @@ request, be sure to start the `dont-interrupt-me` job before pushing.
- `.yarn-cache`. - `.yarn-cache`.
- `.assets-compile-cache` (the key includes `${NODE_ENV}` so it's actually two different caches). - `.assets-compile-cache` (the key includes `${NODE_ENV}` so it's actually two different caches).
1. Only 6 specific jobs, running in 2-hourly scheduled pipelines, are pushing (i.e. updating) to the caches: 1. Only 6 specific jobs, running in 2-hourly scheduled pipelines, are pushing (i.e. updating) to the caches:
- `update-setup-test-env-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml).
- `update-rails-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml). - `update-rails-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml).
- `update-static-analysis-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml). - `update-static-analysis-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml).
- `update-coverage-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml). - `update-coverage-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml).
...@@ -642,6 +644,7 @@ that are scoped to a single [configuration keyword](../ci/yaml/README.md#job-key ...@@ -642,6 +644,7 @@ that are scoped to a single [configuration keyword](../ci/yaml/README.md#job-key
|------------------|-------------| |------------------|-------------|
| `.default-retry` | Allows a job to [retry](../ci/yaml/README.md#retry) upon `unknown_failure`, `api_failure`, `runner_system_failure`, `job_execution_timeout`, or `stuck_or_timeout_failure`. | | `.default-retry` | Allows a job to [retry](../ci/yaml/README.md#retry) upon `unknown_failure`, `api_failure`, `runner_system_failure`, `job_execution_timeout`, or `stuck_or_timeout_failure`. |
| `.default-before_script` | Allows a job to use a default `before_script` definition suitable for Ruby/Rails tasks that may need a database running (e.g. tests). | | `.default-before_script` | Allows a job to use a default `before_script` definition suitable for Ruby/Rails tasks that may need a database running (e.g. tests). |
| `.setup-test-env-cache` | Allows a job to use a default `cache` definition suitable for setuping test environment for subsequent Ruby/Rails tasks. |
| `.rails-cache` | Allows a job to use a default `cache` definition suitable for Ruby/Rails tasks. | | `.rails-cache` | Allows a job to use a default `cache` definition suitable for Ruby/Rails tasks. |
| `.static-analysis-cache` | Allows a job to use a default `cache` definition suitable for static analysis tasks. | | `.static-analysis-cache` | Allows a job to use a default `cache` definition suitable for static analysis tasks. |
| `.coverage-cache` | Allows a job to use a default `cache` definition suitable for coverage tasks. | | `.coverage-cache` | Allows a job to use a default `cache` definition suitable for coverage tasks. |
......
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