Commit 60035658 authored by Rémy Coutable's avatar Rémy Coutable

Use 'rules' for the assets-compiling jobs

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 04dc526a
# Make sure to update all the similar conditions in other CI config files if you modify these conditions # Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default: &if-default .if-not-canonical-namespace: &if-not-canonical-namespace
if: '$CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG' if: '$CI_PROJECT_NAMESPACE !~ /^gitlab(-org)?($|\/)/'
# Make sure to update all the similar conditions in other CI config files if you modify these conditions # Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default-ee: &if-default-ee .if-not-ee: &if-not-ee
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG) && $CI_PROJECT_NAME =~ /^gitlab(-ee)?$/' if: '$CI_PROJECT_NAME !~ /^gitlab(-ee)?$/'
# Make sure to update all the similar conditions in other CI config files if you modify these conditions # Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-master: &if-master .if-master-refs: &if-master-refs
if: '$CI_COMMIT_REF_NAME == "master"' if: '$CI_COMMIT_REF_NAME == "master"'
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default-refs: &if-default-refs
if: '$CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG'
# Make sure to update all the similar patterns in other CI config files if you modify these patterns # Make sure to update all the similar patterns in other CI config files if you modify these patterns
.code-backstage-patterns: &code-backstage-patterns .code-backstage-patterns: &code-backstage-patterns
- ".gitlab/ci/**/*" - ".gitlab/ci/**/*"
...@@ -33,6 +37,32 @@ ...@@ -33,6 +37,32 @@
- "{,ee/}spec/**/*" - "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file - "doc/README.md" # Some RSpec test rely on this file
# Make sure to update all the similar patterns in other CI config files if you modify these patterns
.code-backstage-patterns-qa: &code-backstage-patterns-qa
- ".gitlab/ci/**/*"
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
- ".csscomb.json"
- "Dockerfile.assets"
- "*_VERSION"
- "Gemfile{,.lock}"
- "Rakefile"
- "{babel.config,jest.config}.js"
- "config.ru"
- "{package.json,yarn.lock}"
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
- "doc/api/graphql/reference/*" # Files in this folder are auto-generated
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file
# QA changes
- ".dockerignore"
- "qa/**/*"
.assets-compile-cache: .assets-compile-cache:
cache: cache:
paths: paths:
...@@ -46,10 +76,8 @@ ...@@ -46,10 +76,8 @@
extends: extends:
- .default-tags - .default-tags
- .default-retry - .default-retry
- .default-only
- .default-before_script - .default-before_script
- .assets-compile-cache - .assets-compile-cache
- .only:changes-code-backstage-qa
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1 image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1
stage: prepare stage: prepare
services: services:
...@@ -80,24 +108,29 @@ ...@@ -80,24 +108,29 @@
- time scripts/build_assets_image - time scripts/build_assets_image
- scripts/clean-old-cached-assets - scripts/clean-old-cached-assets
- rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here - rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here
only:
variables:
- $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/)/ # Matches the gitlab-org group and its subgroups
- $CI_SERVER_HOST == "dev.gitlab.org"
tags: tags:
- gitlab-org - gitlab-org
- docker - docker
gitlab:assets:compile pull-push-cache: gitlab:assets:compile pull-push-cache:
extends: .gitlab:assets:compile-metadata extends: .gitlab:assets:compile-metadata
only: rules:
refs: - <<: *if-not-canonical-namespace
- master when: never
- <<: *if-master-refs
changes: *code-backstage-patterns-qa
when: on_success
cache: cache:
policy: pull-push policy: pull-push
gitlab:assets:compile pull-cache: gitlab:assets:compile pull-cache:
extends: .gitlab:assets:compile-metadata extends: .gitlab:assets:compile-metadata
rules:
- <<: *if-not-canonical-namespace
when: never
- <<: *if-default-refs
changes: *code-backstage-patterns-qa
when: on_success
cache: cache:
policy: pull policy: pull
...@@ -105,10 +138,8 @@ gitlab:assets:compile pull-cache: ...@@ -105,10 +138,8 @@ gitlab:assets:compile pull-cache:
extends: extends:
- .default-tags - .default-tags
- .default-retry - .default-retry
- .default-only
- .default-before_script - .default-before_script
- .assets-compile-cache - .assets-compile-cache
- .only:changes-code-backstage-qa
stage: prepare stage: prepare
script: script:
- node --version - node --version
...@@ -130,28 +161,46 @@ gitlab:assets:compile pull-cache: ...@@ -130,28 +161,46 @@ gitlab:assets:compile pull-cache:
compile-assets pull-push-cache: compile-assets pull-push-cache:
extends: .compile-assets-metadata extends: .compile-assets-metadata
only: rules:
refs: - <<: *if-master-refs
- master changes: *code-backstage-patterns-qa
when: on_success
cache: cache:
policy: pull-push policy: pull-push
compile-assets pull-push-cache foss: compile-assets pull-push-cache foss:
extends: [".compile-assets-metadata", ".only-ee-as-if-foss"] extends:
only: - .compile-assets-metadata
refs: - .as-if-foss
- master rules:
- <<: *if-not-ee
when: never
- <<: *if-master-refs
changes: *code-backstage-patterns-qa
when: on_success
cache: cache:
policy: pull-push policy: pull-push
key: "assets-compile:v8:foss" key: "assets-compile:v8:foss"
compile-assets pull-cache: compile-assets pull-cache:
extends: .compile-assets-metadata extends: .compile-assets-metadata
rules:
- <<: *if-default-refs
changes: *code-backstage-patterns-qa
when: on_success
cache: cache:
policy: pull policy: pull
compile-assets pull-cache foss: compile-assets pull-cache foss:
extends: [".compile-assets-metadata", ".only-ee-as-if-foss"] extends:
- .compile-assets-metadata
- .as-if-foss
rules:
- <<: *if-not-ee
when: never
- <<: *if-default-refs
changes: *code-backstage-patterns-qa
when: on_success
cache: cache:
policy: pull policy: pull
key: "assets-compile:v8:foss" key: "assets-compile:v8:foss"
...@@ -240,7 +289,7 @@ jest-foss: ...@@ -240,7 +289,7 @@ jest-foss:
- .default-cache - .default-cache
stage: test stage: test
rules: rules:
- <<: *if-master - <<: *if-master-refs
when: on_success when: on_success
dependencies: [] dependencies: []
cache: cache:
...@@ -274,7 +323,7 @@ webpack-dev-server: ...@@ -274,7 +323,7 @@ webpack-dev-server:
- .default-cache - .default-cache
stage: test stage: test
rules: rules:
- <<: *if-default - <<: *if-default-refs
changes: *code-backstage-patterns changes: *code-backstage-patterns
when: on_success when: on_success
needs: ["setup-test-env", "compile-assets pull-cache"] needs: ["setup-test-env", "compile-assets pull-cache"]
......
...@@ -230,7 +230,11 @@ ...@@ -230,7 +230,11 @@
- $CI_PROJECT_NAME == "gitlab" - $CI_PROJECT_NAME == "gitlab"
- $CI_PROJECT_NAME == "gitlab-ee" # Support former project name for forks/mirrors - $CI_PROJECT_NAME == "gitlab-ee" # Support former project name for forks/mirrors
.only-ee-as-if-foss: .as-if-foss:
extends: .only-ee
variables: variables:
FOSS_ONLY: '1' FOSS_ONLY: '1'
.only-ee-as-if-foss:
extends:
- .only-ee
- .as-if-foss
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