diff options
author | Marcel Amirault <mamirault@gitlab.com> | 2022-08-02 06:44:20 +0300 |
---|---|---|
committer | Marcel Amirault <mamirault@gitlab.com> | 2022-08-02 06:44:20 +0300 |
commit | 55f8d41ce0b3de26d7d6ac32a7fae363f9900167 (patch) | |
tree | f687a1736b9d17ab192b8ef98a3169f95fffb7cd | |
parent | b500b236bf432ca91082edef760ebf553aa754d3 (diff) |
Combine caching and installs into one blockdocs-ssot-yarn-commands-pipeline
We always use a cache and an install in jobs
that use yarn, bundle, or both, so we should
combine these together to simplify the pipeline
config, and reduce duplication.
Removing this from the default block means we no
longer need to skip the before_script in other
jobs that use the defaults.
-rw-r--r-- | .gitlab/ci/deploy.gitlab-ci.yml | 3 | ||||
-rw-r--r-- | .gitlab/ci/rules.gitlab-ci.yml | 27 | ||||
-rw-r--r-- | .gitlab/ci/security.gitlab-ci.yml | 1 | ||||
-rw-r--r-- | .gitlab/ci/test.gitlab-ci.yml | 20 |
4 files changed, 20 insertions, 31 deletions
diff --git a/.gitlab/ci/deploy.gitlab-ci.yml b/.gitlab/ci/deploy.gitlab-ci.yml index f1b5e889..e1ba016e 100644 --- a/.gitlab/ci/deploy.gitlab-ci.yml +++ b/.gitlab/ci/deploy.gitlab-ci.yml @@ -5,10 +5,9 @@ .build_base: stage: build extends: - - .cache_gem_yarn - .retry + - .bundle_and_yarn script: - - yarn install --cache-folder .yarn-cache - bundle exec rake setup_git default - bundle exec nanoc compile -VV # Create _redirects for Pages redirects diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 334008f2..a0e614bc 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -6,22 +6,14 @@ default: image: registry.gitlab.com/gitlab-org/gitlab-docs/base:alpine-3.16-ruby-2.7.6-0bc327a4 tags: - gitlab-org - # Check Ruby, RubyGems, and Bundler versions and install gems + +.bundle: before_script: - ruby -v - gem -v - bundle -v - - bundle config set --local deployment true # Install dependencies into ./vendor/ruby + - bundle config set --local deployment true # Install dependencies into ./vendor/bundle - bundle install --jobs 4 - -.yarn: - before_script: - - yarn install --cache-folder .yarn-cache - -# -# Caching keys -# -.cache_gem: cache: key: files: @@ -29,7 +21,14 @@ default: paths: - vendor/bundle -.cache_gem_yarn: +.bundle_and_yarn: + before_script: + - ruby -v + - gem -v + - bundle -v + - bundle config set --local deployment true # Install dependencies into ./vendor/bundle + - bundle install --jobs 4 + - yarn install --frozen-lockfile --cache-folder .yarn-cache cache: key: files: @@ -39,7 +38,9 @@ default: - vendor/bundle - .yarn-cache/ -.cache_yarn: +.yarn: + before_script: + - yarn install --frozen-lockfile --cache-folder .yarn-cache cache: key: files: diff --git a/.gitlab/ci/security.gitlab-ci.yml b/.gitlab/ci/security.gitlab-ci.yml index 10da5487..1eaf720d 100644 --- a/.gitlab/ci/security.gitlab-ci.yml +++ b/.gitlab/ci/security.gitlab-ci.yml @@ -17,7 +17,6 @@ stage: security dependencies: [] needs: [] - before_script: [] # # Dependency scanning job overrides diff --git a/.gitlab/ci/test.gitlab-ci.yml b/.gitlab/ci/test.gitlab-ci.yml index 779c1c36..fe2ab189 100644 --- a/.gitlab/ci/test.gitlab-ci.yml +++ b/.gitlab/ci/test.gitlab-ci.yml @@ -9,7 +9,7 @@ test_global_nav_links: image: registry.gitlab.com/gitlab-org/gitlab-docs/lint-html:alpine-3.16-ruby-2.7.6-0bc327a4 extends: - .rules_site_tests - - .cache_gem + - .bundle stage: test script: # Only check files in top-level directories. This means a much faster and less repetitive check of global navigation links. @@ -26,7 +26,6 @@ check_duplicate_redirects: extends: - .rules_site_tests needs: [] - before_script: [] stage: test script: - grep -Ir " - from:" content/_data/redirects.yaml | sort | uniq -d | tee output.txt @@ -40,7 +39,6 @@ check_index_html: extends: - .rules_site_tests needs: [] - before_script: [] stage: test script: # Check for index.html in navigation.yaml and write the output in output.txt @@ -58,11 +56,10 @@ check_index_html: rspec: extends: - .rules_site_tests - - .cache_gem_yarn + - .bundle_and_yarn needs: [] stage: test script: - - yarn install --cache-folder .yarn-cache - make rspec-tests # @@ -71,7 +68,6 @@ rspec: jest: extends: - .rules_site_tests - - .cache_yarn - .yarn needs: [] stage: test @@ -84,7 +80,6 @@ jest: js_lint: extends: - .rules_site_tests - - .cache_yarn - .yarn needs: [] stage: test @@ -98,7 +93,6 @@ js_lint: stylelint: extends: - .rules_site_tests - - .cache_yarn - .yarn needs: [] stage: test @@ -115,7 +109,6 @@ yaml_lint: needs: [] stage: test image: sdesbure/yamllint:latest - before_script: [] script: - yamllint .gitlab-ci.yml content/_data @@ -125,7 +118,6 @@ yaml_lint: markdownlint: extends: - .rules_site_tests - - .cache_yarn - .yarn needs: [] stage: test @@ -137,7 +129,7 @@ markdownlint: # test_external_links: extends: - - .cache_gem + - .bundle - .rules_chores stage: test script: @@ -149,7 +141,7 @@ test_external_links: test_EOL_whitespace: extends: - .rules_chores - - .cache_gem + - .bundle stage: test image: registry.gitlab.com/gitlab-org/gitlab-docs/lint-html:alpine-3.16-ruby-2.7.6-0bc327a4 needs: [] @@ -166,7 +158,7 @@ test_EOL_whitespace: test_unlinked_images: extends: - .rules_chores - - .cache_gem + - .bundle stage: test image: registry.gitlab.com/gitlab-org/gitlab-docs/lint-html:alpine-3.16-ruby-2.7.6-0bc327a4 needs: [] @@ -195,7 +187,6 @@ lint_dockerfiles: - .rules_site_tests image: hadolint/hadolint:latest-alpine needs: [] - before_script: [] dependencies: [] script: - hadolint latest.Dockerfile .gitpod.Dockerfile **/*.Dockerfile @@ -206,4 +197,3 @@ lint_dockerfiles: eslint-sast: stage: security - before_script: [] |