gitlabhq/gitlabhq

View on GitHub
.gitlab/ci/global.gitlab-ci.yml

Summary

Maintainability
Test Coverage
.default-tags:
  tags:
    - gitlab-org

.default-retry:
  retry:
    max: 2  # This is confusing but this means "3 runs at max".
    when:
      - unknown_failure
      - api_failure
      - runner_system_failure

.default-before_script:
  before_script:
    - date
    - '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb'
    - export GOPATH=$CI_PROJECT_DIR/.go
    - mkdir -p $GOPATH
    - source scripts/utils.sh
    - source scripts/prepare_build.sh
    - date

# Jobs that only need to pull cache
.default-cache:
  cache:
    key: "debian-stretch-ruby-2.6.5-node-12.x"
    paths:
      - .go/pkg/mod
      - vendor/ruby
      - .yarn-cache/
      - vendor/gitaly-ruby
    policy: pull

.default-only:
  only:
    refs:
      - master
      - /^[\d-]+-stable(-ee)?$/
      - /^\d+-\d+-auto-deploy-\d+$/
      - /^security\//
      - merge_requests
      - tags

.only:variables-canonical-dot-com:
  only:
    variables:
      - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/)/  # Matches the gitlab-org group or its subgroups

.only:variables_refs-canonical-dot-com-schedules:
  extends: .only:variables-canonical-dot-com
  only:
    refs:
      - schedules

.except:refs-deploy:
  except:
    refs:
      - /^\d+-\d+-auto-deploy-\d+$/

.except:refs-master-tags-stable-deploy:
  except:
    refs:
      - master
      - tags
      - /^[\d-]+-stable(-ee)?$/
      - /^\d+-\d+-auto-deploy-\d+$/

.only:kubernetes:
  only:
    kubernetes: active

.only-review:
  extends:
    - .only:variables-canonical-dot-com
    - .only:kubernetes
    - .except:refs-master-tags-stable-deploy

.only-review-schedules:
  extends:
    - .only:variables_refs-canonical-dot-com-schedules
    - .only:kubernetes
    - .except:refs-deploy

.code-patterns: &code-patterns
  - ".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-patterns: &backstage-patterns
  - "Dangerfile"
  - "danger/**/*"
  - "{,ee/}fixtures/**/*"
  - "{,ee/}rubocop/**/*"
  - "{,ee/}spec/**/*"
  - "doc/README.md"  # Some RSpec test rely on this file

.qa-patterns: &qa-patterns
  - ".dockerignore"
  - "qa/**/*"

.docs-patterns: &docs-patterns
  - ".gitlab/route-map.yml"
  - "doc/**/*"
  - ".markdownlint.json"

.only:changes-code:
  only:
    changes: *code-patterns

.only:changes-qa:
  only:
    changes: *qa-patterns

.only:changes-docs:
  only:
    changes: *docs-patterns

.only:changes-code-backstage:
  only:
    changes:
      - ".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

.only:changes-code-qa:
  only:
    changes:
      - ".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
      # QA changes
      - ".dockerignore"
      - "qa/**/*"

.only:changes-code-backstage-qa:
  only:
    changes:
      - ".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/**/*"

.use-pg9:
  services:
    - name: postgres:9.6
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine

.use-pg10:
  image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33"
  services:
    - name: postgres:10.9
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine

.use-pg9-ee:
  services:
    - name: postgres:9.6
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine
    - name: elasticsearch:6.4.2

.use-pg10-ee:
  image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33"
  services:
    - name: postgres:10.9
      command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
    - name: redis:alpine
    - name: elasticsearch:6.4.2

.only-ee:
  only:
    variables:
      - $CI_PROJECT_NAME == "gitlab"
      - $CI_PROJECT_NAME == "gitlab-ee"  # Support former project name for forks/mirrors

.only-ee-as-if-foss:
  extends: .only-ee
  variables:
    FOSS_ONLY: '1'