diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 15:09:37 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 15:09:37 +0000 |
commit | 2c89e169769ead722394a79ed67fcd08e96863dd (patch) | |
tree | 0dadb576846c484475b895f75fab41f71cdb952e /.gitlab | |
parent | bd497e352ebd279536ae11855871162e82a3f88c (diff) | |
download | gitlab-ce-2c89e169769ead722394a79ed67fcd08e96863dd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to '.gitlab')
-rw-r--r-- | .gitlab/ci/frontend.gitlab-ci.yml | 8 | ||||
-rw-r--r-- | .gitlab/ci/global.gitlab-ci.yml | 2 | ||||
-rw-r--r-- | .gitlab/ci/rails.gitlab-ci.yml | 2 | ||||
-rw-r--r-- | .gitlab/ci/review.gitlab-ci.yml | 205 | ||||
-rw-r--r-- | .gitlab/ci/setup.gitlab-ci.yml | 114 | ||||
-rw-r--r-- | .gitlab/ci/test-metadata.gitlab-ci.yml | 76 |
6 files changed, 244 insertions, 163 deletions
diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index c8ad888dc08..26e0b4fdf08 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -93,7 +93,7 @@ DOCKER_DRIVER: overlay2 DOCKER_HOST: tcp://docker:2375 cache: - key: "assets-compile:production:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:tmp_cache_webpack:v7" + key: "assets-compile:production:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:tmp_cache_webpack:v9" artifacts: name: webpack-report expire_in: 31d @@ -152,7 +152,7 @@ gitlab:assets:compile pull-cache: # we override the max_old_space_size to prevent OOM errors NODE_OPTIONS: --max_old_space_size=3584 cache: - key: "assets-compile:v8" + key: "assets-compile:v9" artifacts: expire_in: 7d paths: @@ -180,7 +180,7 @@ compile-assets pull-push-cache foss: when: on_success cache: policy: pull-push - key: "assets-compile:v8:foss" + key: "assets-compile:v9:foss" compile-assets pull-cache: extends: .compile-assets-metadata @@ -203,7 +203,7 @@ compile-assets pull-cache foss: when: on_success cache: policy: pull - key: "assets-compile:v8:foss" + key: "assets-compile:v9:foss" .frontend-job-base: extends: diff --git a/.gitlab/ci/global.gitlab-ci.yml b/.gitlab/ci/global.gitlab-ci.yml index f5b6a353079..c18453b778c 100644 --- a/.gitlab/ci/global.gitlab-ci.yml +++ b/.gitlab/ci/global.gitlab-ci.yml @@ -25,7 +25,7 @@ # Jobs that only need to pull cache .default-cache: cache: - key: "debian-stretch-ruby-2.6.5-node-12.x" + key: "debian-stretch-ruby-2.6.5-pg9.6-node-12.x" paths: - .go/pkg/mod - vendor/ruby diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 1490338086d..48f5d0e3983 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -143,7 +143,7 @@ static-analysis: script: - scripts/static-analysis cache: - key: "debian-stretch-ruby-2.6-and-rubocop" + key: "debian-stretch-ruby-2.6-pg9.6-rubocop" paths: - vendor/ruby - tmp/rubocop_cache diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml index 2e42aa46ac0..5d2c33d06b4 100644 --- a/.gitlab/ci/review.gitlab-ci.yml +++ b/.gitlab/ci/review.gitlab-ci.yml @@ -25,6 +25,39 @@ - ".dockerignore" - "qa/**/*" +.review:rules:mr-and-schedule: + rules: + - <<: *if-canonical-gitlab-merge-request + changes: *code-qa-patterns + when: on_success + - <<: *if-canonical-dot-com-gitlab-org-group-schedule + when: on_success + +.review:rules:mr-only-auto: + rules: + - <<: *if-canonical-gitlab-merge-request + changes: *code-qa-patterns + when: on_success + +.review:rules:mr-only-manual: + rules: + - <<: *if-canonical-gitlab-merge-request + changes: *code-qa-patterns + when: manual + +.review:rules:review-cleanup: + rules: + - <<: *if-canonical-gitlab-merge-request + changes: *code-qa-patterns + when: manual + - <<: *if-canonical-dot-com-gitlab-org-group-schedule + when: on_success + +.review:rules:danger: + rules: + - if: '$DANGER_GITLAB_API_TOKEN && $CI_MERGE_REQUEST_IID' + when: on_success + .review-docker: extends: - .default-tags @@ -41,14 +74,10 @@ GITLAB_EDITION: "ce" build-qa-image: - extends: .review-docker + extends: + - .review-docker + - .review:rules:mr-and-schedule stage: prepare - rules: - - <<: *if-canonical-gitlab-merge-request - changes: *code-qa-patterns - when: on_success - - <<: *if-canonical-dot-com-gitlab-org-group-schedule - when: on_success script: - '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"' - export QA_MASTER_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:master" @@ -58,11 +87,11 @@ build-qa-image: - time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./ - time docker push ${QA_IMAGE} -.base-review-cleanup: +review-cleanup: extends: - .default-tags - .default-retry - - .default-only + - .review:rules:review-cleanup stage: prepare image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base allow_failure: true @@ -75,45 +104,23 @@ build-qa-image: script: - ruby -rrubygems scripts/review_apps/automated_cleanup.rb -schedule:review-cleanup: - extends: - - .base-review-cleanup - - .only-review-schedules - -manual:review-cleanup: - extends: - - .base-review-cleanup - - .only:changes-code-qa - when: manual - -.review-build-cng-base: +review-build-cng: extends: - .default-tags - .default-retry - - .default-only + - .review:rules:mr-and-schedule image: ruby:2.6-alpine stage: review-prepare before_script: - source scripts/utils.sh - install_api_client_dependencies_with_apk - install_gitlab_gem - dependencies: [] + needs: + - job: gitlab:assets:compile pull-cache + artifacts: false script: - BUILD_TRIGGER_TOKEN=$REVIEW_APPS_BUILD_TRIGGER_TOKEN ./scripts/trigger-build cng -review-build-cng: - extends: - - .review-build-cng-base - - .only-review - - .only:changes-code-qa - needs: ["gitlab:assets:compile pull-cache"] - -schedule:review-build-cng: - extends: - - .review-build-cng-base - - .only-review-schedules - needs: ["gitlab:assets:compile pull-cache"] - .review-workflow-base: extends: - .default-tags @@ -130,8 +137,10 @@ schedule:review-build-cng: url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN} on_stop: review-stop -.review-deploy-base: - extends: .review-workflow-base +review-deploy: + extends: + - .review-workflow-base + - .review:rules:mr-and-schedule stage: review allow_failure: true before_script: @@ -140,7 +149,7 @@ schedule:review-build-cng: - export GITALY_VERSION=$(<GITALY_SERVER_VERSION) - export GITLAB_WORKHORSE_VERSION=$(<GITLAB_WORKHORSE_VERSION) - echo "${CI_ENVIRONMENT_URL}" > review_app_url.txt - - source scripts/utils.sh + - source ./scripts/utils.sh - install_api_client_dependencies_with_apk - source scripts/review_apps/review-apps.sh script: @@ -156,19 +165,7 @@ schedule:review-build-cng: expire_in: 2 days when: always -review-deploy: - extends: .review-deploy-base - rules: - - <<: *if-canonical-gitlab-merge-request - changes: *code-qa-patterns - when: on_success - -schedule:review-deploy: - extends: - - .review-deploy-base - - .only-review-schedules - -.base-review-stop: +.review-stop-base: extends: .review-workflow-base environment: action: stop @@ -183,22 +180,18 @@ schedule:review-deploy: - source ./scripts/review_apps/review-apps.sh review-stop-failed-deployment: - extends: .base-review-stop + extends: + - .review-stop-base + - .review:rules:mr-only-auto stage: prepare - rules: - - <<: *if-canonical-gitlab-merge-request - changes: *code-qa-patterns - when: on_success script: - delete_failed_release review-stop: - extends: .base-review-stop + extends: + - .review-stop-base + - .review:rules:mr-only-manual stage: review - rules: - - <<: *if-canonical-gitlab-merge-request - changes: *code-qa-patterns - when: manual allow_failure: true script: - delete_release @@ -206,8 +199,9 @@ review-stop: .review-qa-base: extends: .review-docker stage: qa - needs: ["review-deploy"] - dependencies: ["review-deploy"] + needs: + - job: review-deploy + artifacts: true allow_failure: true variables: QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa" @@ -235,29 +229,30 @@ review-stop: when: always review-qa-smoke: - extends: .review-qa-base - rules: - - <<: *if-canonical-gitlab-merge-request - changes: *code-qa-patterns - when: on_success + extends: + - .review-qa-base + - .review:rules:mr-only-auto script: - gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" review-qa-all: - extends: .review-qa-base - rules: - - <<: *if-canonical-gitlab-merge-request - changes: *code-qa-patterns - when: manual + extends: + - .review-qa-base + - .review:rules:mr-only-manual parallel: 5 script: - export KNAPSACK_REPORT_PATH=knapsack/master_report.json - export KNAPSACK_TEST_FILE_PATTERN=qa/specs/features/**/*_spec.rb - gitlab-qa Test::Instance::Any "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" -- --format RspecJunitFormatter --out tmp/rspec-${CI_JOB_ID}.xml --format html --out tmp/rspec.htm --color --format documentation -.review-performance-base: - extends: .review-docker +review-performance: + extends: + - .review-docker + - .review:rules:mr-and-schedule stage: qa + needs: + - job: review-deploy + artifacts: true allow_failure: true before_script: - export CI_ENVIRONMENT_URL="$(cat review_app_url.txt)" @@ -275,58 +270,17 @@ review-qa-all: reports: performance: performance.json -review-performance: - extends: .review-performance-base - rules: - - <<: *if-canonical-gitlab-merge-request - changes: *code-qa-patterns - when: on_success - needs: ["review-deploy"] - dependencies: ["review-deploy"] - before_script: - - export CI_ENVIRONMENT_URL="$(cat review_app_url.txt)" - - echo "${CI_ENVIRONMENT_URL}" - - mkdir -p gitlab-exporter - - wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/master/index.js - - mkdir -p sitespeed-results - script: - - docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results "${CI_ENVIRONMENT_URL}" - after_script: - - mv sitespeed-results/data/performance.json performance.json - artifacts: - paths: - - sitespeed-results/ - reports: - performance: performance.json - -schedule:review-performance: - extends: - - .review-performance-base - - .only-review-schedules - needs: ["schedule:review-deploy"] - dependencies: ["schedule:review-deploy"] - parallel-spec-reports: extends: - .default-tags - - .default-only - - .only-review - - .only:changes-code-qa + - .review:rules:mr-only-manual image: ruby:2.6-alpine stage: post-qa dependencies: ["review-qa-all"] + allow_failure: true variables: NEW_PARALLEL_SPECS_REPORT: qa/report-new.html BASE_ARTIFACT_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/file/qa/" - allow_failure: true - when: manual - artifacts: - when: always - paths: - - qa/report-new.html - - qa/gitlab-qa-run-* - reports: - junit: qa/gitlab-qa-run-*/**/rspec-*.xml script: - apk add --update build-base libxml2-dev libxslt-dev && rm -rf /var/cache/apk/* - gem install nokogiri --no-document @@ -335,20 +289,23 @@ parallel-spec-reports: - cd - - '[[ -f $NEW_PARALLEL_SPECS_REPORT ]] || echo "{}" > ${NEW_PARALLEL_SPECS_REPORT}' - scripts/merge-html-reports ${NEW_PARALLEL_SPECS_REPORT} ${BASE_ARTIFACT_URL}${ARTIFACT_DIRS} qa/gitlab-qa-run-*/**/rspec.htm + artifacts: + when: always + paths: + - qa/report-new.html + - qa/gitlab-qa-run-* + reports: + junit: qa/gitlab-qa-run-*/**/rspec-*.xml danger-review: extends: - .default-tags - .default-retry - .default-cache - - .default-only - - .except:refs-master-tags-stable-deploy + - .review:rules:danger image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger stage: test dependencies: [] - only: - variables: - - $DANGER_GITLAB_API_TOKEN script: - git version - node --version diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index 24267584393..73ec0a559fc 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -1,3 +1,90 @@ +# Make sure to update all the similar conditions in other CI config files if you modify these conditions +.if-not-canonical-namespace: &if-not-canonical-namespace + if: '$CI_PROJECT_NAMESPACE !~ /^gitlab(-org)?($|\/)/' + +# Make sure to update all the similar conditions in other CI config files if you modify these conditions +.if-not-foss: &if-not-foss + if: '$CI_PROJECT_NAME != "gitlab-foss" && $CI_PROJECT_NAME != "gitlab-ce" && $CI_PROJECT_NAME != "gitlabhq"' + +# Make sure to update all the similar conditions in other CI config files if you modify these conditions +.if-master-or-tag: &if-master-or-tag + if: '$CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_TAG' + +# 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 +.code-backstage-patterns: &code-backstage-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 changes + - "Dangerfile" + - "danger/**/*" + - "{,ee/}fixtures/**/*" + - "{,ee/}rubocop/**/*" + - "{,ee/}spec/**/*" + - "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-qa-patterns: &code-backstage-qa-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 changes + - "Dangerfile" + - "danger/**/*" + - "{,ee/}fixtures/**/*" + - "{,ee/}rubocop/**/*" + - "{,ee/}spec/**/*" + - "doc/README.md" # Some RSpec test rely on this file + # QA changes + - ".dockerignore" + - "qa/**/*" + +.setup:rules:cache-gems: + rules: + - <<: *if-not-canonical-namespace + when: never + - <<: *if-master-or-tag + changes: *code-backstage-qa-patterns + when: on_success + +.setup:rules:gitlab_git_test: + rules: + - <<: *if-default-refs + changes: *code-backstage-patterns + when: on_success + +.setup:rules:no_ee_check: + rules: + - <<: *if-not-foss + when: never + - <<: *if-default-refs + changes: *code-backstage-patterns + when: on_success + # Insurance in case a gem needed by one of our releases gets yanked from # rubygems.org in the future. cache gems: @@ -6,11 +93,11 @@ cache gems: - .default-retry - .default-cache - .default-before_script - - .only:variables-canonical-dot-com - - .only:changes-code-backstage-qa + - .setup:rules:cache-gems stage: test - dependencies: ["setup-test-env"] - needs: ["setup-test-env"] + needs: + - job: setup-test-env + artifacts: true variables: SETUP_DB: "false" script: @@ -18,30 +105,23 @@ cache gems: artifacts: paths: - vendor/cache - only: - refs: - - master - - tags .minimal-job: extends: - .default-tags - .default-retry - - .default-only - - .only:changes-code-backstage dependencies: [] gitlab_git_test: - extends: .minimal-job + extends: + - .minimal-job + - .setup:rules:gitlab_git_test script: - spec/support/prepare-gitlab-git-test-for-commit --check-for-changes no_ee_check: - extends: .minimal-job + extends: + - .minimal-job + - .setup:rules:no_ee_check script: - scripts/no-ee-check - only: - variables: - - $CI_PROJECT_NAME == "gitlab-foss" - - $CI_PROJECT_NAME == "gitlab-ce" # Support former project name for forks/mirrors - - $CI_PROJECT_NAME == "gitlabhq" # Support former project name for dev diff --git a/.gitlab/ci/test-metadata.gitlab-ci.yml b/.gitlab/ci/test-metadata.gitlab-ci.yml index 4ec0dc70ae6..2457498f84d 100644 --- a/.gitlab/ci/test-metadata.gitlab-ci.yml +++ b/.gitlab/ci/test-metadata.gitlab-ci.yml @@ -1,7 +1,57 @@ +# 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 conditions in other CI config files if you modify these conditions +.if-merge-request: &if-merge-request + if: '$CI_MERGE_REQUEST_IID' + +# Make sure to update all the similar conditions in other CI config files if you modify these conditions +.if-canonical-dot-com-gitlab-schedule: &if-canonical-dot-com-gitlab-schedule + if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab" && $CI_PIPELINE_SOURCE == "schedule"' + +# Make sure to update all the similar patterns in other CI config files if you modify these patterns +.code-backstage-patterns: &code-backstage-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 changes + - "Dangerfile" + - "danger/**/*" + - "{,ee/}fixtures/**/*" + - "{,ee/}rubocop/**/*" + - "{,ee/}spec/**/*" + - "doc/README.md" # Some RSpec test rely on this file + +.test-metadata:rules:retrieve-tests-metadata: + rules: + - <<: *if-default-refs + changes: *code-backstage-patterns + when: on_success + +.test-metadata:rules:update-tests-metadata: + rules: + - <<: *if-canonical-dot-com-gitlab-schedule + changes: *code-backstage-patterns + when: on_success + +.test-metadata:rules:flaky-examples-check: + rules: + - <<: *if-merge-request + changes: *code-backstage-patterns + when: on_success + .tests-metadata-state: - extends: - - .default-only - - .only:changes-code-backstage variables: TESTS_METADATA_S3_BUCKET: "gitlab-ce-cache" before_script: @@ -19,7 +69,9 @@ - rspec_profiling/ retrieve-tests-metadata: - extends: .tests-metadata-state + extends: + - .tests-metadata-state + - .test-metadata:rules:retrieve-tests-metadata stage: prepare cache: policy: pull @@ -28,7 +80,9 @@ retrieve-tests-metadata: - retrieve_tests_metadata update-tests-metadata: - extends: .tests-metadata-state + extends: + - .tests-metadata-state + - .test-metadata:rules:update-tests-metadata stage: post-test cache: policy: push @@ -36,27 +90,17 @@ update-tests-metadata: - retry gem install fog-aws mime-types activesupport rspec_profiling postgres-copy --no-document - source scripts/rspec_helpers.sh - update_tests_metadata - only: - refs: - - schedules - variables: - # Only update the Knapsack metadata on GitLab.com/gitlab-org/gitlab - - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab" flaky-examples-check: extends: - .default-tags - .default-retry - - .default-only - - .only:changes-code-backstage + - .test-metadata:rules:flaky-examples-check image: ruby:2.6-alpine stage: post-test variables: NEW_FLAKY_SPECS_REPORT: rspec_flaky/report-new.json allow_failure: true - only: - refs: - - merge_requests artifacts: expire_in: 30d paths: |