diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 14:16:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 14:16:34 +0000 |
commit | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (patch) | |
tree | 2b256ff8dfe63dafe7f42b0d995f9e74fd1dc48b | |
parent | bd860c22f6a4b9473cbddd34a53eead8235a7ea1 (diff) | |
download | gitlab-ce-4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
53 files changed, 995 insertions, 517 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d573a4c214..6c10c4853c4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,6 @@ image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33" stages: - - build - prepare - quick-test - test diff --git a/.gitlab/ci/cng.gitlab-ci.yml b/.gitlab/ci/cng.gitlab-ci.yml index 3ba3b221df0..35859a1ab33 100644 --- a/.gitlab/ci/cng.gitlab-ci.yml +++ b/.gitlab/ci/cng.gitlab-ci.yml @@ -11,5 +11,6 @@ cloud-native-image: - CNG_PROJECT_PATH="gitlab-org/build/CNG" BUILD_TRIGGER_TOKEN=$CI_JOB_TOKEN ./scripts/trigger-build cng only: refs: - - tags@gitlab-org/gitlab-foss - - tags@gitlab-org/gitlab + - tags + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" diff --git a/.gitlab/ci/docs.gitlab-ci.yml b/.gitlab/ci/docs.gitlab-ci.yml index 22e752ae0b0..87023da3c24 100644 --- a/.gitlab/ci/docs.gitlab-ci.yml +++ b/.gitlab/ci/docs.gitlab-ci.yml @@ -2,6 +2,12 @@ extends: - .default-tags - .default-retry + - .only-docs-changes + only: + refs: + - merge_requests + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" image: ruby:2.6-alpine stage: review dependencies: [] @@ -19,55 +25,32 @@ - apk add --update openssl - wget $CI_PROJECT_URL/raw/$CI_COMMIT_SHA/scripts/trigger-build-docs - chmod 755 trigger-build-docs - -# Trigger a manual docs build in gitlab-docs only on non docs-only branches. -# Useful to preview the docs changes live. -review-docs-deploy-manual: - extends: - - .review-docs - - .except-docs-qa - script: - gem install gitlab --no-document - - ./trigger-build-docs deploy - when: manual - only: - - branches@gitlab-org/gitlab-foss - - branches@gitlab-org/gitlab # Always trigger a docs build in gitlab-docs only on docs-only branches. # Useful to preview the docs changes live. review-docs-deploy: - extends: - - .review-docs - - .except-qa + extends: .review-docs script: - - gem install gitlab --no-document - ./trigger-build-docs deploy - only: - - /(^docs[\/-].+|.+-docs$)/@gitlab-org/gitlab-foss - - /(^docs[\/-].+|.+-docs$)/@gitlab-org/gitlab + when: manual # Cleanup remote environment of gitlab-docs review-docs-cleanup: - extends: - - .review-docs - - .except-qa + extends: .review-docs environment: name: review-docs/$CI_COMMIT_REF_SLUG action: stop script: - - gem install gitlab --no-document - ./trigger-build-docs cleanup when: manual - only: - - branches@gitlab-org/gitlab-foss - - branches@gitlab-org/gitlab docs lint: extends: - .default-tags - .default-retry - - .except-qa + - .default-only + - .only-docs-changes image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs-lint" stage: test dependencies: [] diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index a61601597c3..f72396e4edf 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -9,9 +9,10 @@ extends: - .default-tags - .default-retry - - .assets-compile-cache + - .default-only - .default-before_script - - .except-docs + - .assets-compile-cache + - .only-code-qa-changes image: dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-git-2.22-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-18.06.1 stage: test dependencies: ["setup-test-env"] @@ -45,10 +46,9 @@ - scripts/clean-old-cached-assets - rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here only: - - /.+/@gitlab-org/gitlab-foss - - /.+/@gitlab-org/gitlab - - /.+/@gitlab/gitlabhq - - /.+/@gitlab/gitlab-ee + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" + - $CI_SERVER_HOST == "dev.gitlab.org" tags: - gitlab-org - docker @@ -57,8 +57,7 @@ gitlab:assets:compile: extends: .gitlab:assets:compile-metadata only: refs: - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab + - master cache: policy: pull-push @@ -66,9 +65,7 @@ gitlab:assets:compile pull-cache: extends: .gitlab:assets:compile-metadata except: refs: - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab - - /(^docs[\/-].+|.+-docs$)/ + - master cache: policy: pull @@ -76,8 +73,10 @@ gitlab:assets:compile pull-cache: extends: - .default-tags - .default-retry - - .assets-compile-cache + - .default-only - .default-before_script + - .assets-compile-cache + - .only-code-qa-changes - .use-pg stage: prepare script: @@ -98,12 +97,10 @@ gitlab:assets:compile pull-cache: - public/assets compile-assets: - extends: - - .compile-assets-metadata + extends: .compile-assets-metadata only: refs: - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab + - master cache: policy: pull-push @@ -111,21 +108,23 @@ compile-assets pull-cache: extends: .compile-assets-metadata except: refs: - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab - - /(^docs[\/-].+|.+-docs$)/ + - master cache: policy: pull -karma: +.only-code-frontend-job-base: extends: - .default-tags - .default-retry - .default-cache + - .default-only - .default-before_script + - .only-code-changes - .use-pg - - .except-docs dependencies: ["compile-assets", "compile-assets pull-cache", "setup-test-env"] + +karma: + extends: .only-code-frontend-job-base variables: # we override the max_old_space_size to prevent OOM errors NODE_OPTIONS: --max_old_space_size=3584 @@ -148,14 +147,7 @@ karma: junit: junit_karma.xml jest: - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .use-pg - - .except-docs-qa - dependencies: ["compile-assets", "compile-assets pull-cache", "setup-test-env"] + extends: .only-code-frontend-job-base script: - scripts/gitaly-test-spawn - date @@ -178,27 +170,26 @@ jest: - tmp/jest/jest/ policy: pull-push -.qa: +.qa-job-base: extends: - .default-tags - .default-retry - .default-cache - - .except-docs + - .default-only + - .only-code-qa-changes dependencies: [] stage: test - variables: - SETUP_DB: "false" before_script: - cd qa/ - bundle install qa:internal: - extends: .qa + extends: .qa-job-base script: - bundle exec rspec qa:selectors: - extends: .qa + extends: .qa-job-base script: - bundle exec bin/qa Test::Sanity::Selectors @@ -207,7 +198,8 @@ qa:selectors: - .default-tags - .default-retry - .default-cache - - .except-docs + - .default-only + - .only-code-changes dependencies: [] cache: key: "$CI_JOB_NAME" @@ -238,10 +230,9 @@ webpack-dev-server: - .default-tags - .default-retry - .default-cache - - .except-docs-qa - dependencies: ["compile-assets", "compile-assets pull-cache", "setup-test-env"] + - .only-code-changes + dependencies: ["setup-test-env", "compile-assets", "compile-assets pull-cache"] variables: - SETUP_DB: "false" WEBPACK_MEMORY_TEST: "true" script: - node --version diff --git a/.gitlab/ci/global.gitlab-ci.yml b/.gitlab/ci/global.gitlab-ci.yml index 8287390c80e..94d7d2cdaa4 100644 --- a/.gitlab/ci/global.gitlab-ci.yml +++ b/.gitlab/ci/global.gitlab-ci.yml @@ -27,40 +27,83 @@ - vendor/gitaly-ruby policy: pull -.except-docs: - except: +.default-only: + only: refs: - - /(^docs[\/-].+|.+-docs$)/ + - master + - /^[\d-]+-stable(-ee)?$/ + - /^\d+-\d+-auto-deploy-\d+$/ + - merge_requests + - tags -.except-qa: - except: - refs: - - /(^qa[\/-].*|.*-qa$)/ +.only-code-changes: + 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" + - "Dangerfile" + - "Dockerfile.assets" + - "*_VERSION" + - "Gemfile{,.lock}" + - "Rakefile" + - "{babel.config,jest.config}.js" + - "config.ru" + - "{package.json,yarn.lock}" + - "{app,bin,config,danger,db,ee,fixtures,haml_lint,lib,public,rubocop,scripts,spec,symbol,vendor}/**/*" + - "doc/README.md" # Some RSpec test rely on this file -.except-docs-qa: - except: - refs: - - /(^docs[\/-].+|.+-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ +.only-qa-changes: + only: + changes: + - ".dockerignore" + - "qa/**/*" -.except-docs-qa-geo: - except: - refs: - - /(^docs[\/-].+|.+-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ - - /(^geo[\/-].*|.*-geo$)/ +.only-docs-changes: + only: + changes: + - ".gitlab/route-map.yml" + - "doc/**/*" + - ".markdownlint.json" -.review-only: +.only-code-qa-changes: only: - refs: - - branches@gitlab-org/gitlab-foss - - branches@gitlab-org/gitlab + 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" + - "Dangerfile" + - "Dockerfile.assets" + - "*_VERSION" + - "Gemfile{,.lock}" + - "Rakefile" + - "{babel.config,jest.config}.js" + - "config.ru" + - "{package.json,yarn.lock}" + - "{app,bin,config,danger,db,ee,fixtures,haml_lint,lib,public,rubocop,scripts,spec,symbol,vendor}/**/*" + - "doc/README.md" # Some RSpec test rely on this file + - ".dockerignore" + - "qa/**/*" + +.only-review: + only: + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" kubernetes: active except: refs: - master - /^\d+-\d+-auto-deploy-\d+$/ - - /(^docs[\/-].+|.+-docs$)/ + +.only-review-schedules: + only: + refs: + - schedules + variables: + - $REVIEW_APP_CLEANUP && $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" + kubernetes: active .use-pg: services: @@ -74,3 +117,9 @@ - name: postgres:10.9 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] - name: redis:alpine + +.only-ee: + only: + variables: + - $CI_PROJECT_NAME == "gitlab-ee" + - $CI_PROJECT_NAME == "gitlab" # New name of gitlab-ee after the single codebase migration diff --git a/.gitlab/ci/memory.gitlab-ci.yml b/.gitlab/ci/memory.gitlab-ci.yml index 1936933cca4..d990c7eefa2 100644 --- a/.gitlab/ci/memory.gitlab-ci.yml +++ b/.gitlab/ci/memory.gitlab-ci.yml @@ -1,10 +1,14 @@ -memory-static: +.only-code-memory-job-base: extends: - .default-tags - .default-retry - .default-cache + - .default-only - .default-before_script - - .except-docs + - .only-code-changes + +memory-static: + extends: .only-code-memory-job-base variables: SETUP_DB: "false" script: @@ -31,12 +35,8 @@ memory-static: # All tests are run without a webserver (directly using Rack::Mock by default). memory-on-boot: extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script + - .only-code-memory-job-base - .use-pg-10 - - .except-docs-qa variables: NODE_ENV: "production" RAILS_ENV: "production" diff --git a/.gitlab/ci/pages.gitlab-ci.yml b/.gitlab/ci/pages.gitlab-ci.yml index cf77ec24090..47f4117e34a 100644 --- a/.gitlab/ci/pages.gitlab-ci.yml +++ b/.gitlab/ci/pages.gitlab-ci.yml @@ -3,11 +3,12 @@ pages: - .default-tags - .default-retry - .default-cache - - .except-docs + - .default-only only: refs: - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab + - master + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" stage: pages dependencies: ["coverage", "karma", "gitlab:assets:compile"] script: diff --git a/.gitlab/ci/qa.gitlab-ci.yml b/.gitlab/ci/qa.gitlab-ci.yml index a868316c353..e7362f913a9 100644 --- a/.gitlab/ci/qa.gitlab-ci.yml +++ b/.gitlab/ci/qa.gitlab-ci.yml @@ -1,4 +1,5 @@ .package-and-qa-base: + extends: .default-only image: ruby:2.6-alpine stage: qa dependencies: [] @@ -10,17 +11,16 @@ - install_gitlab_gem - ./scripts/trigger-build omnibus only: - refs: - - branches@gitlab-org/gitlab-foss - - branches@gitlab-org/gitlab + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" package-and-qa-manual: - extends: .package-and-qa-base + extends: + - .package-and-qa-base + - .only-code-changes except: refs: - master - - /(^docs[\/-].+|.+-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ when: manual needs: ["build-qa-image", "gitlab:assets:compile pull-cache"] @@ -34,10 +34,11 @@ package-and-qa-manual:master: needs: ["build-qa-image", "gitlab:assets:compile"] package-and-qa: - extends: .package-and-qa-base - only: + extends: + - .package-and-qa-base + - .only-qa-changes + except: refs: - - /(^qa[\/-].*|.*-qa$)/@gitlab-org/gitlab-foss - - /(^qa[\/-].*|.*-qa$)/@gitlab-org/gitlab + - master needs: ["build-qa-image", "gitlab:assets:compile pull-cache"] allow_failure: true diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 2363c0e5f8a..e9222c4b719 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -1,36 +1,40 @@ -.only-schedules-master: +.only-master: only: refs: - - schedules@gitlab-org/gitlab-foss - - schedules@gitlab-org/gitlab - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab - - master@gitlab/gitlabhq - - master@gitlab/gitlab-ee - -.only-gitlab-ee: - only: - - branches@gitlab-org/gitlab - - tags@gitlab-org/gitlab + - master .rake-exec: extends: - .default-tags - .default-retry - .default-cache + - .default-only - .default-before_script variables: SETUP_DB: "false" script: - bundle exec rake $CI_JOB_NAME -.rspec-base: +.only-code-rails-job-base: + extends: + - .default-tags + - .default-retry + - .default-cache + - .default-only + - .default-before_script + - .only-code-changes + +.only-code-qa-rails-job-base: extends: - .default-tags - .default-retry - .default-cache + - .default-only - .default-before_script - - .except-docs-qa + - .only-code-qa-changes + +.rspec-base: + extends: .only-code-rails-job-base stage: test script: - JOB_NAME=( $CI_JOB_NAME ) @@ -79,12 +83,8 @@ setup-test-env: extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script + - .only-code-qa-rails-job-base - .use-pg - - .except-docs stage: prepare script: - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' @@ -111,19 +111,19 @@ rspec system pg: rspec unit pg-10: extends: - .rspec-base-pg-10 - - .only-schedules-master + - .only-master parallel: 20 rspec integration pg-10: extends: - .rspec-base-pg-10 - - .only-schedules-master + - .only-master parallel: 6 rspec system pg-10: extends: - .rspec-base-pg-10 - - .only-schedules-master + - .only-master parallel: 24 rspec-fast-spec-helper: @@ -133,9 +133,8 @@ rspec-fast-spec-helper: rspec quarantine pg: extends: - - .default-before_script - .rspec-base-pg - - .only-schedules-master + - .only-master script: - export NO_KNAPSACK=1 CACHE_CLASSES=true - scripts/gitaly-test-spawn @@ -143,12 +142,7 @@ rspec quarantine pg: allow_failure: true static-analysis: - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .except-docs + extends: .only-code-qa-rails-job-base dependencies: ["setup-test-env", "compile-assets", "compile-assets pull-cache"] variables: SETUP_DB: "false" @@ -162,81 +156,48 @@ static-analysis: policy: pull-push downtime_check: - extends: .rake-exec + extends: + - .rake-exec + - .only-code-changes except: refs: - master - tags - - /^[\d-]+-stable(-ee)?$/ - - /(^docs[\/-].+|.+-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ + variables: + - $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ stage: test dependencies: ["setup-test-env"] needs: ["setup-test-env"] -ee_compat_check: - extends: .rake-exec - dependencies: [] - except: - refs: - - master - - tags - - branches@gitlab-org/gitlab - - branches@gitlab/gitlab-ee - - /^[\d-]+-stable(-ee)?$/ - - /(^docs[\/-].+|.+-docs$)/ - - /^security-/ - artifacts: - name: "${CI_JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT_SHA}" - when: always - expire_in: 10d - paths: - - ee_compat_check/patches/*.patch - -# DB migration, rollback, and seed jobs -db:migrate:reset: +.db-job-base: extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script + - .only-code-rails-job-base - .use-pg - - .except-docs-qa stage: test dependencies: ["setup-test-env"] needs: ["setup-test-env"] + +# DB migration, rollback, and seed jobs +db:migrate:reset: + extends: .db-job-base script: - bundle exec rake db:migrate:reset db:check-schema: - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .use-pg - - .except-docs-qa - stage: test - dependencies: ["setup-test-env"] - needs: ["setup-test-env"] + extends: .db-job-base script: - source scripts/schema_changed.sh db:migrate-from-v11.11.0: - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .use-pg - - .except-docs-qa - stage: test - dependencies: ["setup-test-env"] - needs: ["setup-test-env"] + extends: .db-job-base variables: SETUP_DB: "false" script: - - git fetch https://gitlab.com/gitlab-org/gitlab.git v11.11.0-ee + - export PROJECT_TO_CHECKOUT="gitlab-foss" + - export TAG_TO_CHECKOUT="v11.11.0" + - '[[ ! -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab"' + - '[[ ! -d "ee/" ]] || export TAG_TO_CHECKOUT="v11.11.0-ee"' + - git fetch https://gitlab.com/gitlab-org/$PROJECT_TO_CHECKOUT.git $TAG_TO_CHECKOUT - git checkout -f FETCH_HEAD - sed -i "s/gem 'oj', '~> 2.17.4'//" Gemfile - sed -i "s/gem 'bootsnap', '~> 1.0.0'/gem 'bootsnap'/" Gemfile @@ -254,31 +215,13 @@ db:migrate-from-v11.11.0: - bundle exec rake db:migrate db:rollback: - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .use-pg - - .except-docs-qa - stage: test - dependencies: ["setup-test-env"] - needs: ["setup-test-env"] + extends: .db-job-base script: - bundle exec rake db:migrate VERSION=20180101160629 - bundle exec rake db:migrate SKIP_SCHEMA_VERSION_CHECK=true gitlab:setup: - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .use-pg - - .except-docs-qa - stage: test - dependencies: ["setup-test-env"] - needs: ["setup-test-env"] + extends: .db-job-base variables: SETUP_DB: "false" script: @@ -295,14 +238,7 @@ gitlab:setup: - log/development.log coverage: - # Don't include dedicated-no-docs-no-db-pull-cache-job here since we need to - # download artifacts from all the rspec jobs instead of from setup-test-env only - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .except-docs-qa + extends: .only-code-rails-job-base cache: policy: pull variables: @@ -324,7 +260,7 @@ coverage: .rspec-base-ee: extends: - .rspec-base - - .only-gitlab-ee + - .only-ee script: - JOB_NAME=( $CI_JOB_NAME ) - TEST_TOOL=${JOB_NAME[0]} @@ -362,10 +298,9 @@ rspec system pg ee: extends: .rspec-base-pg-ee parallel: 5 -.rspec-base-pg-geo: - extends: - - .rspec-base - - .only-gitlab-ee +.rspec-base-geo: + extends: .rspec-base-ee + parallel: 3 script: - JOB_NAME=( $CI_JOB_NAME ) - TEST_TOOL=${JOB_NAME[0]} @@ -382,33 +317,37 @@ rspec system pg ee: rspec geo pg ee: extends: - - .rspec-base-pg-geo + - .rspec-base-geo - .use-pg - - .except-docs-qa-geo - parallel: 3 + except: + variables: + - $CI_COMMIT_REF_NAME =~ /(^geo[\/-].*|.*-geo$)/ rspec geo pg-10 ee: extends: - - .rspec-base-pg-geo + - .rspec-base-geo - .use-pg-10 - - .except-docs-qa-geo - parallel: 3 + except: + variables: + - $CI_COMMIT_REF_NAME =~ /(^geo[\/-].*|.*-geo$)/ quick-rspec geo pg ee: extends: - - .rspec-base-pg-geo + - .rspec-base-geo - .use-pg stage: quick-test only: - - /(^geo[\/-].*|.*-geo$)/ + variables: + - $CI_COMMIT_REF_NAME =~ /(^geo[\/-].*|.*-geo$)/ quick-rspec geo pg-10 ee: extends: - - .rspec-base-pg-geo + - .rspec-base-geo - .use-pg-10 stage: quick-test only: - - /(^geo[\/-].*|.*-geo$)/ + variables: + - $CI_COMMIT_REF_NAME =~ /(^geo[\/-].*|.*-geo$)/ rspec quarantine pg ee: extends: rspec quarantine pg @@ -417,35 +356,10 @@ rspec quarantine pg ee: - scripts/gitaly-test-spawn - bin/rspec --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml --tag quarantine -- ee/spec/ -migration:upgrade-pg-ce-to-ee: - extends: - - .default-tags - - .default-retry - - .default-cache - - .default-before_script - - .use-pg - - .except-docs-qa - dependencies: ["setup-test-env"] - variables: - SETUP_DB: "false" - script: - - ruby -r./scripts/ee_specific_check/ee_specific_check -e'EESpecificCheck.fetch_remote_ce_branch' - - git checkout -f FETCH_HEAD - - . scripts/utils.sh - - . scripts/prepare_build.sh - - date - - setup_db - - date - - git checkout -f $CI_COMMIT_SHA - - date - - . scripts/prepare_build.sh - - date - - bundle exec rake db:migrate - db:rollback geo: extends: - db:rollback - - .only-gitlab-ee + - .only-ee script: - bundle exec rake geo:db:migrate VERSION=20170627195211 - bundle exec rake geo:db:migrate diff --git a/.gitlab/ci/reports.gitlab-ci.yml b/.gitlab/ci/reports.gitlab-ci.yml index 5622cd232ca..38da73034d5 100644 --- a/.gitlab/ci/reports.gitlab-ci.yml +++ b/.gitlab/ci/reports.gitlab-ci.yml @@ -1,39 +1,236 @@ -include: - - template: Code-Quality.gitlab-ci.yml - - template: Security/SAST.gitlab-ci.yml - - template: Security/Dependency-Scanning.gitlab-ci.yml - - template: Security/DAST.gitlab-ci.yml +# include: +# - template: Code-Quality.gitlab-ci.yml +# - template: Security/SAST.gitlab-ci.yml +# - template: Security/Dependency-Scanning.gitlab-ci.yml +# - template: Security/DAST.gitlab-ci.yml -.reports: +# We need to duplicate this job's definition because it seems it's impossible to +# override an included `only.refs`. +# See https://gitlab.com/gitlab-org/gitlab/issues/31371. +code_quality: extends: - .default-retry - - .except-docs - -code_quality: - extends: .reports + - .default-only + - .only-code-changes + stage: test + image: docker:stable + allow_failure: true + services: + - docker:stable-dind + variables: + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + script: + - | + if ! docker info &>/dev/null; then + if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then + export DOCKER_HOST='tcp://localhost:2375' + fi + fi + - docker run + --env SOURCE_CODE="$PWD" + --volume "$PWD":/code + --volume /var/run/docker.sock:/var/run/docker.sock + "registry.gitlab.com/gitlab-org/security-products/codequality:12-0-stable" /code + artifacts: + reports: + codequality: gl-code-quality-report.json + expire_in: 1 week + dependencies: [] + except: + variables: + - $CODE_QUALITY_DISABLED +# We need to duplicate this job's definition because it seems it's impossible to +# override an included `only.refs`. +# See https://gitlab.com/gitlab-org/gitlab/issues/31371. sast: - extends: .reports + extends: + - .default-retry + - .default-only + - .only-code-changes + stage: test + image: docker:stable variables: + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" SAST_BRAKEMAN_LEVEL: 2 - SAST_EXCLUDED_PATHS: qa,spec,doc + SAST_EXCLUDED_PATHS: qa,spec,doc,ee/spec + allow_failure: true + services: + - docker:stable-dind + script: + - export SAST_VERSION=${SP_VERSION:-$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')} + - | + if ! docker info &>/dev/null; then + if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then + export DOCKER_HOST='tcp://localhost:2375' + fi + fi + - | # this is required to avoid undesirable reset of Docker image ENV variables being set on build stage + function propagate_env_vars() { + CURRENT_ENV=$(printenv) + + for VAR_NAME; do + echo $CURRENT_ENV | grep "${VAR_NAME}=" > /dev/null && echo "--env $VAR_NAME " + done + } + - | + docker run \ + $(propagate_env_vars \ + SAST_BANDIT_EXCLUDED_PATHS \ + SAST_ANALYZER_IMAGES \ + SAST_ANALYZER_IMAGE_PREFIX \ + SAST_ANALYZER_IMAGE_TAG \ + SAST_DEFAULT_ANALYZERS \ + SAST_PULL_ANALYZER_IMAGES \ + SAST_BRAKEMAN_LEVEL \ + SAST_FLAWFINDER_LEVEL \ + SAST_GITLEAKS_ENTROPY_LEVEL \ + SAST_GOSEC_LEVEL \ + SAST_EXCLUDED_PATHS \ + SAST_DOCKER_CLIENT_NEGOTIATION_TIMEOUT \ + SAST_PULL_ANALYZER_IMAGE_TIMEOUT \ + SAST_RUN_ANALYZER_TIMEOUT \ + SAST_JAVA_VERSION \ + ANT_HOME \ + ANT_PATH \ + GRADLE_PATH \ + JAVA_OPTS \ + JAVA_PATH \ + JAVA_8_VERSION \ + JAVA_11_VERSION \ + MAVEN_CLI_OPTS \ + MAVEN_PATH \ + MAVEN_REPO_PATH \ + SBT_PATH \ + FAIL_NEVER \ + ) \ + --volume "$PWD:/code" \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + "registry.gitlab.com/gitlab-org/security-products/sast:$SAST_VERSION" /app/bin/run /code artifacts: expire_in: 7 days paths: - gl-sast-report.json + reports: + sast: gl-sast-report.json + dependencies: [] + only: + variables: + - $GITLAB_FEATURES =~ /\bsast\b/ + except: + variables: + - $SAST_DISABLED +# We need to duplicate this job's definition because it seems it's impossible to +# override an included `only.refs`. +# See https://gitlab.com/gitlab-org/gitlab/issues/31371. dependency_scanning: - extends: .reports + extends: + - .default-retry + - .default-only + - .only-code-changes + stage: test + image: docker:stable + variables: + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + allow_failure: true + services: + - docker:stable-dind + script: + - export DS_VERSION=${SP_VERSION:-$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')} + - | + if ! docker info &>/dev/null; then + if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then + export DOCKER_HOST='tcp://localhost:2375' + fi + fi + - | # this is required to avoid undesirable reset of Docker image ENV variables being set on build stage + function propagate_env_vars() { + CURRENT_ENV=$(printenv) + for VAR_NAME; do + echo $CURRENT_ENV | grep "${VAR_NAME}=" > /dev/null && echo "--env $VAR_NAME " + done + } + - | + docker run \ + $(propagate_env_vars \ + DS_ANALYZER_IMAGES \ + DS_ANALYZER_IMAGE_PREFIX \ + DS_ANALYZER_IMAGE_TAG \ + DS_DEFAULT_ANALYZERS \ + DS_EXCLUDED_PATHS \ + DEP_SCAN_DISABLE_REMOTE_CHECKS \ + DS_DOCKER_CLIENT_NEGOTIATION_TIMEOUT \ + DS_PULL_ANALYZER_IMAGE_TIMEOUT \ + DS_RUN_ANALYZER_TIMEOUT \ + DS_PYTHON_VERSION \ + DS_PIP_DEPENDENCY_PATH \ + PIP_INDEX_URL \ + PIP_EXTRA_INDEX_URL \ + ) \ + --volume "$PWD:/code" \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + "registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$DS_VERSION" /code + artifacts: + reports: + dependency_scanning: gl-dependency-scanning-report.json + dependencies: [] + only: + variables: + - $GITLAB_FEATURES =~ /\bdependency_scanning\b/ + except: + variables: + - $DEPENDENCY_SCANNING_DISABLED + +# We need to duplicate this job's definition because it seems it's impossible to +# override an included `only.refs`. +# See https://gitlab.com/gitlab-org/gitlab/issues/31371. dast: extends: - - .reports - - .review-only + - .default-retry + - .default-only + - .only-code-qa-changes + - .only-review stage: qa dependencies: ["review-deploy"] before_script: - export DAST_WEBSITE="$(cat review_app_url.txt)" + image: + name: "registry.gitlab.com/gitlab-org/security-products/dast:$CI_SERVER_VERSION_MAJOR-$CI_SERVER_VERSION_MINOR-stable" + variables: + # URL to scan: + # DAST_WEBSITE: https://example.com/ + # + # Time limit for target availability (scan is attempted even when timeout): + # DAST_TARGET_AVAILABILITY_TIMEOUT: 60 + # + # Set these variables to scan with an authenticated user: + # DAST_AUTH_URL: https://example.com/sign-in + # DAST_USERNAME: john.doe@example.com + # DAST_PASSWORD: john-doe-password + # DAST_USERNAME_FIELD: session[user] # the name of username field at the sign-in HTML form + # DAST_PASSWORD_FIELD: session[password] # the name of password field at the sign-in HTML form + # DAST_AUTH_EXCLUDE_URLS: http://example.com/sign-out,http://example.com/sign-out-2 # optional: URLs to skip during the authenticated scan; comma-separated, no spaces in between + # + # Perform ZAP Full Scan, which includes both passive and active scanning: + # DAST_FULL_SCAN_ENABLED: "true" + allow_failure: true + script: + - export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)} + - /analyze -t $DAST_WEBSITE artifacts: expire_in: 7 days paths: - gl-dast-report.json + reports: + dast: gl-dast-report.json + only: + variables: + - $GITLAB_FEATURES =~ /\bdast\b/ + except: + variables: + - $DAST_DISABLED diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml index f35d3ce19a4..c7b79dac9dd 100644 --- a/.gitlab/ci/review.gitlab-ci.yml +++ b/.gitlab/ci/review.gitlab-ci.yml @@ -1,21 +1,10 @@ -.review-schedules-only: - only: - refs: - - schedules@gitlab-org/gitlab-foss - - schedules@gitlab-org/gitlab - kubernetes: active - variables: - - $REVIEW_APP_CLEANUP - except: - refs: - - tags - - /(^docs[\/-].+|.+-docs$)/ - .review-base: extends: - .default-tags - .default-retry - - .review-only + - .default-only + - .only-review + - .only-code-qa-changes image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base dependencies: [] before_script: @@ -25,6 +14,7 @@ extends: - .default-tags - .default-retry + - .default-only image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine services: - docker:19.03.0-dind @@ -39,12 +29,11 @@ build-qa-image: extends: - .review-docker - - .except-docs + - .only-code-qa-changes only: - refs: - - branches@gitlab-org/gitlab-foss - - branches@gitlab-org/gitlab - stage: test + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" + stage: prepare script: - '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"' - export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}" @@ -53,6 +42,9 @@ build-qa-image: - time docker push ${QA_IMAGE} .review-build-cng-base: + extends: + - .default-only + - .only-code-qa-changes image: ruby:2.6-alpine stage: review-prepare before_script: @@ -66,13 +58,13 @@ build-qa-image: review-build-cng: extends: - .review-build-cng-base - - .review-only + - .only-review needs: ["gitlab:assets:compile pull-cache"] schedule:review-build-cng: extends: - .review-build-cng-base - - .review-schedules-only + - .only-review-schedules needs: ["gitlab:assets:compile"] .review-deploy-base: @@ -118,7 +110,7 @@ review-deploy: schedule:review-deploy: extends: - .review-deploy-base - - .review-schedules-only + - .only-review-schedules needs: ["schedule:review-build-cng"] review-stop: @@ -153,7 +145,8 @@ review-cleanup-failed-deployment: .review-qa-base: extends: - .review-docker - - .review-only + - .only-review + - .only-code-qa-changes stage: qa variables: QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa" @@ -200,7 +193,9 @@ review-qa-all: parallel-spec-reports: extends: - .default-tags - - .except-docs + - .default-only + - .only-code-qa-changes + - .only-review image: ruby:2.6-alpine stage: post-test dependencies: ["review-qa-all"] @@ -247,14 +242,14 @@ review-performance: schedule:review-performance: extends: - review-performance - - .review-schedules-only + - .only-review-schedules dependencies: ["schedule:review-deploy"] schedule:review-cleanup: extends: - .review-base - - .review-schedules-only - stage: build + - .only-review-schedules + stage: prepare allow_failure: true environment: name: review/auto-cleanup @@ -270,6 +265,7 @@ danger-review: - .default-tags - .default-retry - .default-cache + - .default-only image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger stage: test dependencies: [] @@ -279,10 +275,9 @@ danger-review: except: refs: - master - - /^\d+-\d+-auto-deploy-\d+$/ - - /^[\d-]+-stable(-ee)?$/ - - /^ce-to-ee-.*/ - - /.*-stable(-ee)?-prepare-.*/ + variables: + - $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ + - $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ script: - git version - node --version diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index d29907b3683..e673eb9c7f3 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -6,7 +6,6 @@ cache gems: - .default-retry - .default-cache - .default-before_script - - .except-docs stage: test dependencies: ["setup-test-env"] needs: ["setup-test-env"] @@ -19,15 +18,17 @@ cache gems: - vendor/cache only: refs: - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab + - master - tags + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" .minimal-job: extends: - .default-tags - .default-retry - - .except-docs-qa + - .default-only + - .only-code-changes dependencies: [] gitlab_git_test: @@ -40,5 +41,6 @@ no_ee_check: script: - scripts/no-ee-check only: - refs: - - branches@gitlab-org/gitlab-foss + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAME == "gitlab-foss" + - $CI_SERVER_HOST == "dev.gitlab.org" && $CI_PROJECT_NAME == "gitlabhq" diff --git a/.gitlab/ci/test-metadata.gitlab-ci.yml b/.gitlab/ci/test-metadata.gitlab-ci.yml index 14c230deb47..fe3cde2bb16 100644 --- a/.gitlab/ci/test-metadata.gitlab-ci.yml +++ b/.gitlab/ci/test-metadata.gitlab-ci.yml @@ -1,4 +1,5 @@ .tests-metadata-state: + extends: .default-only variables: TESTS_METADATA_S3_BUCKET: "gitlab-ce-cache" before_script: @@ -13,7 +14,7 @@ retrieve-tests-metadata: extends: - .tests-metadata-state - - .except-docs-qa + - .only-code-changes stage: prepare cache: key: tests_metadata @@ -26,8 +27,8 @@ retrieve-tests-metadata: - mkdir -p rspec_profiling/ - wget -O $FLAKY_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$FLAKY_RSPEC_SUITE_REPORT_PATH || rm $FLAKY_RSPEC_SUITE_REPORT_PATH - '[[ -f $FLAKY_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_SUITE_REPORT_PATH}' - - wget -O $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH || rm $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH - - '[[ -f $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH}' + - '[[ ! -d "ee/" ]] || wget -O $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH || rm $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH' + - '[[ ! -d "ee/" ]] || [[ -f $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH}' update-tests-metadata: extends: .tests-metadata-state @@ -43,9 +44,9 @@ update-tests-metadata: - echo "{}" > ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec_*_pg_node_*.json - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH' - - echo "{}" > ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH} - - scripts/merge-reports ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec_*_pg_ee_*node_*.json - - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH' + - '[[ ! -d "ee/" ]] || echo "{}" > ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH}' + - '[[ ! -d "ee/" ]] || scripts/merge-reports ${EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec_*_pg_ee_*node_*.json' + - '[[ ! -d "ee/" ]] || [[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH' - rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json - scripts/merge-reports ${FLAKY_RSPEC_SUITE_REPORT_PATH} rspec_flaky/all_*_*.json - FLAKY_RSPEC_GENERATE_REPORT=1 scripts/prune-old-flaky-specs ${FLAKY_RSPEC_SUITE_REPORT_PATH} @@ -54,15 +55,17 @@ update-tests-metadata: - scripts/insert-rspec-profiling-data only: refs: - - master@gitlab-org/gitlab-foss - - master@gitlab-org/gitlab - - master@gitlab/gitlabhq - - master@gitlab/gitlab-ee + - master + variables: + - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org" + - $CI_SERVER_HOST == "dev.gitlab.org" flaky-examples-check: extends: - .default-tags - .default-retry + - .default-only + - .only-code-changes image: ruby:2.6-alpine stage: post-test variables: @@ -70,12 +73,7 @@ flaky-examples-check: allow_failure: true only: refs: - - branches - except: - refs: - - master - - /(^docs[\/-].+|.+-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ + - merge_requests artifacts: expire_in: 30d paths: diff --git a/.gitlab/ci/yaml.gitlab-ci.yml b/.gitlab/ci/yaml.gitlab-ci.yml index dd61cb3f035..323f94b6d04 100644 --- a/.gitlab/ci/yaml.gitlab-ci.yml +++ b/.gitlab/ci/yaml.gitlab-ci.yml @@ -4,7 +4,10 @@ lint-ci-gitlab: extends: - .default-tags - .default-retry - - .except-docs + - .default-only + only: + changes: + - "**/*.yml" image: sdesbure/yamllint:latest dependencies: [] script: diff --git a/app/assets/javascripts/jobs/components/log/duration_badge.vue b/app/assets/javascripts/jobs/components/log/duration_badge.vue new file mode 100644 index 00000000000..83f62703d27 --- /dev/null +++ b/app/assets/javascripts/jobs/components/log/duration_badge.vue @@ -0,0 +1,13 @@ +<script> +export default { + props: { + duration: { + type: String, + required: true, + }, + }, +}; +</script> +<template> + <div class="duration rounded align-self-start px-2 ml-2 flex-shrink-0">{{ duration }}</div> +</template> diff --git a/app/assets/javascripts/jobs/components/log/line.vue b/app/assets/javascripts/jobs/components/log/line.vue index 86d0fcc3b74..336ae623f0f 100644 --- a/app/assets/javascripts/jobs/components/log/line.vue +++ b/app/assets/javascripts/jobs/components/log/line.vue @@ -21,7 +21,7 @@ export default { <template> <div class="line"> <line-number :line-number="line.lineNumber" :path="path" /> - <span v-for="(content, i) in line.content" :key="i" class="line-text" :class="content.style">{{ + <span v-for="(content, i) in line.content" :key="i" :class="content.style">{{ content.text }}</span> </div> diff --git a/app/assets/javascripts/jobs/components/log/line_header.vue b/app/assets/javascripts/jobs/components/log/line_header.vue index 4ec212d2333..af8de9ec0fa 100644 --- a/app/assets/javascripts/jobs/components/log/line_header.vue +++ b/app/assets/javascripts/jobs/components/log/line_header.vue @@ -1,11 +1,13 @@ <script> import Icon from '~/vue_shared/components/icon.vue'; import LineNumber from './line_number.vue'; +import DurationBadge from './duration_badge.vue'; export default { components: { Icon, LineNumber, + DurationBadge, }, props: { line: { @@ -20,6 +22,11 @@ export default { type: String, required: true, }, + duration: { + type: String, + required: false, + default: '', + }, }, computed: { iconName() { @@ -35,11 +42,16 @@ export default { </script> <template> - <div class="line collapsible-line" role="button" @click="handleOnClick"> - <icon :name="iconName" class="arrow" /> + <div + class="line collapsible-line d-flex justify-content-between" + role="button" + @click="handleOnClick" + > + <icon :name="iconName" class="arrow position-absolute" /> <line-number :line-number="line.lineNumber" :path="path" /> <span v-for="(content, i) in line.content" :key="i" class="line-text" :class="content.style">{{ content.text }}</span> + <duration-badge v-if="duration" :duration="duration" /> </div> </template> diff --git a/app/assets/javascripts/jobs/components/log/line_number.vue b/app/assets/javascripts/jobs/components/log/line_number.vue index e06836e2e97..6c76bef13d3 100644 --- a/app/assets/javascripts/jobs/components/log/line_number.vue +++ b/app/assets/javascripts/jobs/components/log/line_number.vue @@ -46,7 +46,10 @@ export default { }; </script> <template> - <gl-link :id="lineNumberId" class="line-number" :href="buildLineNumber">{{ - parsedLineNumber - }}</gl-link> + <gl-link + :id="lineNumberId" + class="d-inline-block text-right position-absolute line-number" + :href="buildLineNumber" + >{{ parsedLineNumber }}</gl-link + > </template> diff --git a/app/assets/javascripts/jobs/components/log/log.vue b/app/assets/javascripts/jobs/components/log/log.vue index 5db866afe5a..429796aeb4e 100644 --- a/app/assets/javascripts/jobs/components/log/log.vue +++ b/app/assets/javascripts/jobs/components/log/log.vue @@ -9,7 +9,7 @@ export default { LogLineHeader, }, computed: { - ...mapState(['traceEndpoint', 'trace']), + ...mapState(['traceEndpoint', 'trace', 'isTraceComplete']), }, methods: { ...mapActions(['toggleCollapsibleLine']), @@ -20,12 +20,13 @@ export default { }; </script> <template> - <code class="job-log"> + <code class="job-log d-block"> <template v-for="(section, index) in trace"> <template v-if="section.isHeader"> <log-line-header :key="`collapsible-${index}`" :line="section.line" + :duration="section.section_duration" :path="traceEndpoint" :is-closed="section.isClosed" @toggleLine="handleOnClickCollapsibleLine(section)" @@ -41,5 +42,11 @@ export default { </template> <log-line v-else :key="section.offset" :line="section" :path="traceEndpoint" /> </template> + + <div v-if="!isTraceComplete" class="js-log-animation loader-animation pt-3 pl-3"> + <div class="dot"></div> + <div class="dot"></div> + <div class="dot"></div> + </div> </code> </template> diff --git a/app/assets/javascripts/jobs/store/utils.js b/app/assets/javascripts/jobs/store/utils.js index f6a87b9a212..261ec90cd12 100644 --- a/app/assets/javascripts/jobs/store/utils.js +++ b/app/assets/javascripts/jobs/store/utils.js @@ -1,10 +1,21 @@ /** + * Adds the line number property + * @param Object line + * @param Number lineNumber + */ +export const parseLine = (line = {}, lineNumber) => ({ + ...line, + lineNumber, +}); + +/** * Parses the job log content into a structure usable by the template * * For collaspible lines (section_header = true): * - creates a new array to hold the lines that are collpasible, * - adds a isClosed property to handle toggle * - adds a isHeader property to handle template logic + * - adds the section_duration * For each line: * - adds the index as lineNumber * @@ -14,27 +25,21 @@ export const logLinesParser = (lines = [], lineNumberStart) => lines.reduce((acc, line, index) => { const lineNumber = lineNumberStart ? lineNumberStart + index : index; + const last = acc[acc.length - 1]; + if (line.section_header) { acc.push({ isClosed: true, isHeader: true, - line: { - ...line, - lineNumber, - }, - + line: parseLine(line, lineNumber), lines: [], }); - } else if (acc.length && acc[acc.length - 1].isHeader) { - acc[acc.length - 1].lines.push({ - ...line, - lineNumber, - }); - } else { - acc.push({ - ...line, - lineNumber, - }); + } else if (acc.length && last.isHeader && !line.section_duration && line.content.length) { + last.lines.push(parseLine(line, lineNumber)); + } else if (acc.length && last.isHeader && line.section_duration) { + last.section_duration = line.section_duration; + } else if (line.content.length) { + acc.push(parseLine(line, lineNumber)); } return acc; diff --git a/app/assets/javascripts/test_utils/simulate_drag.js b/app/assets/javascripts/test_utils/simulate_drag.js index c9bf234fcce..f4090de3f1e 100644 --- a/app/assets/javascripts/test_utils/simulate_drag.js +++ b/app/assets/javascripts/test_utils/simulate_drag.js @@ -2,8 +2,8 @@ function simulateEvent(el, type, options = {}) { let event; if (!el) return null; - if (/^mouse/.test(type)) { - event = el.ownerDocument.createEvent('MouseEvents'); + if (/^(pointer|mouse)/.test(type)) { + event = el.ownerDocument.createEvent('MouseEvent'); event.initMouseEvent( type, true, @@ -125,7 +125,7 @@ export default function simulateDrag(options) { const startTime = new Date().getTime(); const duration = options.duration || 1000; - simulateEvent(fromEl, 'mousedown', { + simulateEvent(fromEl, 'pointerdown', { button: 0, clientX: fromRect.cx, clientY: fromRect.cy, @@ -146,7 +146,7 @@ export default function simulateDrag(options) { const y = fromRect.cy + (toRect.cy - fromRect.cy) * progress; const overEl = fromEl.ownerDocument.elementFromPoint(x, y); - simulateEvent(overEl, 'mousemove', { + simulateEvent(overEl, 'pointermove', { clientX: x, clientY: y, }); diff --git a/app/assets/stylesheets/framework/job_log.scss b/app/assets/stylesheets/framework/job_log.scss new file mode 100644 index 00000000000..5c2491c8233 --- /dev/null +++ b/app/assets/stylesheets/framework/job_log.scss @@ -0,0 +1,49 @@ +.job-log { + font-family: $monospace-font; + padding: $gl-padding-8 $input-horizontal-padding; + margin: 0 0 $gl-padding-8; + font-size: 13px; + word-break: break-all; + word-wrap: break-word; + color: $gl-text-color-inverted; + border-radius: $border-radius-small; + min-height: 42px; + background-color: $builds-trace-bg; +} + +.line { + padding: 1px $gl-padding 1px $job-log-line-padding; +} + +.line-number { + color: $gl-text-color-inverted; + padding: 0 $gl-padding-8; + min-width: $job-line-number-width; + margin-left: -$job-line-number-width; + padding-right: 1em; + + &:hover, + &:active, + &:visited { + text-decoration: underline; + color: $gl-text-color-inverted; + } +} + +.collapsible-line { + &:hover { + background-color: rgba($white-light, 0.2); + } + + .arrow { + margin-left: -$job-arrow-margin; + } +} + +.duration { + background: $gl-gray-400; +} + +.loader-animation { + @include build-loader-animation; +} diff --git a/app/assets/stylesheets/framework/sortable.scss b/app/assets/stylesheets/framework/sortable.scss index 8c070200135..25868061d04 100644 --- a/app/assets/stylesheets/framework/sortable.scss +++ b/app/assets/stylesheets/framework/sortable.scss @@ -90,3 +90,21 @@ padding: 0; } } + +.is-dragging { + // Important because plugin sets inline CSS + opacity: 1 !important; + + * { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + // !important to make sure no style can override this when dragging + cursor: grabbing !important; + } + + &.no-drop * { + cursor: no-drop !important; + } +} diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index faa0a9909d5..e77527ac130 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -606,6 +606,9 @@ $blame-blue: #254e77; */ $builds-trace-bg: #111; $job-log-highlight-height: 18px; +$job-log-line-padding: 62px; +$job-line-number-width: 40px; +$job-arrow-margin: 50px; /* * Commit Page diff --git a/app/assets/stylesheets/pages/boards.scss b/app/assets/stylesheets/pages/boards.scss index e77a2d1e333..4bf0abccd00 100644 --- a/app/assets/stylesheets/pages/boards.scss +++ b/app/assets/stylesheets/pages/boards.scss @@ -2,20 +2,6 @@ cursor: grab; } -.is-dragging { - // Important because plugin sets inline CSS - opacity: 1 !important; - - * { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - // !important to make sure no style can override this when dragging - cursor: grabbing !important; - } -} - .is-ghost { opacity: 0.3; pointer-events: none; diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index c80beceae52..801e9e7204c 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -889,11 +889,7 @@ pre.light-well { @include basic-list-stats; display: flex; align-items: center; - padding: $gl-padding 0; - - @include media-breakpoint-up(lg) { - padding: $gl-padding 0; - } + padding: $gl-padding-12 0; &.no-description { @include media-breakpoint-up(sm) { @@ -909,7 +905,7 @@ pre.light-well { } h2 { - font-size: $gl-font-size-large; + font-size: $gl-font-size; font-weight: $gl-font-weight-bold; margin-bottom: 0; @@ -951,6 +947,7 @@ pre.light-well { .description { line-height: 1.5; + color: $gl-text-color-secondary; } @include media-breakpoint-down(md) { @@ -1096,7 +1093,6 @@ pre.light-well { &:not(.explore) { .forks { display: none; - } } diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb index 9e1204738c1..bac3c99e3e5 100644 --- a/app/helpers/version_check_helper.rb +++ b/app/helpers/version_check_helper.rb @@ -19,7 +19,7 @@ module VersionCheckHelper end def source_code_project - 'gitlab-ce' + 'gitlab-foss' end end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 71c4501f57b..2393540b04c 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -88,7 +88,11 @@ module Ci validates :coverage, numericality: true, allow_blank: true validates :ref, presence: true - scope :not_interruptible, -> { joins(:metadata).where(ci_builds_metadata: { interruptible: false }) } + scope :not_interruptible, -> do + joins(:metadata).where('ci_builds_metadata.id NOT IN (?)', + Ci::BuildMetadata.scoped_build.with_interruptible.select(:id)) + end + scope :unstarted, ->() { where(runner_id: nil) } scope :ignore_failures, ->() { where(allow_failure: false) } scope :with_artifacts_archive, ->() do diff --git a/app/models/ci/build_metadata.rb b/app/models/ci/build_metadata.rb index 89cdd8c64f8..3097e40dd3b 100644 --- a/app/models/ci/build_metadata.rb +++ b/app/models/ci/build_metadata.rb @@ -25,6 +25,9 @@ module Ci chronic_duration_attr_reader :timeout_human_readable, :timeout + scope :scoped_build, -> { where('ci_builds_metadata.build_id = ci_builds.id') } + scope :with_interruptible, -> { where(interruptible: true) } + enum timeout_source: { unknown_timeout_source: 1, project_timeout_source: 2, diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 3278a87c576..539576147f3 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -95,7 +95,7 @@ module Ci # rubocop: disable CodeReuse/ActiveRecord def auto_cancelable_pipelines # TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23464 - if Feature.enabled?(:ci_support_interruptible_pipelines, project, default_enabled: false) + if Feature.enabled?(:ci_support_interruptible_pipelines, project, default_enabled: true) project.ci_pipelines .where(ref: pipeline.ref) .where.not(id: pipeline.id) diff --git a/app/views/shared/projects/_project.html.haml b/app/views/shared/projects/_project.html.haml index 573ed36d7f4..bcce7cb52fb 100644 --- a/app/views/shared/projects/_project.html.haml +++ b/app/views/shared/projects/_project.html.haml @@ -60,6 +60,11 @@ .controls.d-flex.flex-sm-column.align-items-center.align-items-sm-end.flex-wrap.flex-shrink-0.text-secondary{ class: css_controls_class } .icon-container.d-flex.align-items-center + - if pipeline_status && can?(current_user, :read_cross_project) && project.pipeline_status.has_status? && can?(current_user, :read_build, project) + - pipeline_path = pipelines_project_commit_path(project.pipeline_status.project, project.pipeline_status.sha, ref: project.pipeline_status.ref) + %span.icon-wrapper.pipeline-status + = render 'ci/status/icon', status: project.commit.last_pipeline.detailed_status(current_user), tooltip_placement: 'top', path: pipeline_path + - if project.archived %span.d-flex.icon-wrapper.badge.badge-warning archived - if stars @@ -86,10 +91,6 @@ title: _('Issues'), data: { container: 'body', placement: 'top' } do = sprite_icon('issues', size: 14, css_class: 'append-right-4') = number_with_delimiter(project.open_issues_count) - - if pipeline_status && can?(current_user, :read_cross_project) && project.pipeline_status.has_status? && can?(current_user, :read_build, project) - - pipeline_path = pipelines_project_commit_path(project.pipeline_status.project, project.pipeline_status.sha, ref: project.pipeline_status.ref) - %span.icon-wrapper.pipeline-status - = render 'ci/status/icon', status: project.commit.last_pipeline.detailed_status(current_user), tooltip_placement: 'top', path: pipeline_path .updated-note %span = _('Updated') diff --git a/bin/changelog b/bin/changelog index ec068d06507..45b6295e331 100755 --- a/bin/changelog +++ b/bin/changelog @@ -15,7 +15,8 @@ Options = Struct.new( :force, :merge_request, :title, - :type + :type, + :ee ) INVALID_TYPE = -1 @@ -85,6 +86,10 @@ class ChangelogOptionParser options.type = parse_type(value) end + opts.on('-e', '--ee', 'Generate a changelog entry for GitLab EE') do |value| + options.ee = value + end + opts.on('-h', '--help', 'Print help message') do $stdout.puts opts raise Done.new @@ -249,7 +254,7 @@ class ChangelogEntry end def ee? - @ee ||= File.exist?(File.expand_path('../CHANGELOG-EE.md', __dir__)) + options.ee end def branch_name diff --git a/danger/changelog/Dangerfile b/danger/changelog/Dangerfile index 2d1ca64a9e8..f83dc556964 100644 --- a/danger/changelog/Dangerfile +++ b/danger/changelog/Dangerfile @@ -12,6 +12,12 @@ You can create one with: bin/changelog -m %<mr_iid>s "%<mr_title>s" ``` +If you want to create a changelog entry for GitLab EE, run the following instead: + +``` +bin/changelog --ee -m %<mr_iid>s "%<mr_title>s" +``` + Note: Merge requests with %<labels>s do not trigger this check. MSG diff --git a/danger/only_documentation/Dangerfile b/danger/only_documentation/Dangerfile deleted file mode 100644 index ce7ede26d9a..00000000000 --- a/danger/only_documentation/Dangerfile +++ /dev/null @@ -1,24 +0,0 @@ -# rubocop:disable Style/SignalException -# frozen_string_literal: true - -has_only_docs_changes = helper.all_changed_files.all? { |file| file.start_with?('doc/', '.gitlab/ci/docs.gitlab-ci.yml', '.markdownlint.json') || file.end_with?('.md') } -is_docs_only_branch = gitlab.branch_for_head =~ /(^docs[\/-].*|.*-docs$)/ - -if is_docs_only_branch && !has_only_docs_changes - fail "It seems like your branch name has a `docs` prefix or suffix. "\ - "The CI won't run the full pipeline, but you also have changed non-docs files. "\ - "Please recreate this MR with a new branch name." -end - -if has_only_docs_changes && !is_docs_only_branch - markdown(<<~MARKDOWN) - - ## Documentation only changes - - Hey! Seems your merge request contains only docs changes. - Tired of waiting 2 hours for the pipeline to finish? - Next time, prepend `docs-` to [your branch name](https://docs.gitlab.com/ee/development/documentation/#branch-naming) - and the pipeline will finish before you say GitLab (x300)! - - MARKDOWN -end diff --git a/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb b/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb new file mode 100644 index 00000000000..ad8979045e5 --- /dev/null +++ b/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ModifyConcurrentIndexToBuildsMetadata < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_builds_metadata, [:build_id], + where: "interruptible = true", + name: "index_ci_builds_metadata_on_build_id_and_interruptible" + remove_concurrent_index_by_name(:ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_interruptible_false') + end + + def down + remove_concurrent_index_by_name(:ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_interruptible') + add_concurrent_index :ci_builds_metadata, [:build_id], + where: "interruptible = false", + name: "index_ci_builds_metadata_on_build_id_and_interruptible_false" + end +end diff --git a/db/schema.rb b/db/schema.rb index 8310d15fa9a..b821951180a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_09_12_061145) do +ActiveRecord::Schema.define(version: 2019_09_14_223900) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -648,7 +648,7 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do t.jsonb "config_options" t.jsonb "config_variables" t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id", unique: true - t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id_and_interruptible_false", where: "(interruptible = false)" + t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id_and_interruptible", where: "(interruptible = true)" t.index ["project_id"], name: "index_ci_builds_metadata_on_project_id" end diff --git a/doc/administration/geo/replication/docker_registry.md b/doc/administration/geo/replication/docker_registry.md index 537f8f57420..12cd39c0213 100644 --- a/doc/administration/geo/replication/docker_registry.md +++ b/doc/administration/geo/replication/docker_registry.md @@ -63,6 +63,11 @@ We need to make Docker Registry send notification events to the notification secret in `registry.notification_secret` section of `/etc/gitlab/gitlab.rb` file. + NOTE: **Note:** + If you use GitLab HA, you will also have to specify + the notification secret in `registry.notification_secret` section of + `/etc/gitlab/gitlab.rb` file for every web node. + 1. Reconfigure the **primary** node for the change to take effect: ```sh @@ -94,10 +99,8 @@ generate a short-lived JWT that is pull-only-capable to access the 1. Edit `/etc/gitlab/gitlab.rb`: ```ruby - gitlab_rails['registry_replication'] = { - enabled: true, - primary_api_url: 'http://primary.example.com:5000/' # internal address to the primary registry, will be used by GitLab to directly communicate with primary registry API - } + gitlab_rails['geo_registry_replication_enabled'] = true + gitlab_rails['geo_registry_replication_primary_api_url'] = 'http://primary.example.com:5000/' # internal address to the primary registry, will be used by GitLab to directly communicate with primary registry API ``` 1. Reconfigure the **secondary** node for the change to take effect: diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 83ac38f3aa3..aa188facebd 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -2104,7 +2104,7 @@ staging: > [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23464) in GitLab 12.3. -`interruptible` is used to indicate that a job should be canceled if made redundant by a newer run of the same job. Defaults to `true`. +`interruptible` is used to indicate that a job should be canceled if made redundant by a newer run of the same job. Defaults to `false`. This value will only be used if the [automatic cancellation of redundant pipelines feature](../../user/project/pipelines/settings.md#auto-cancel-pending-pipelines) is enabled. diff --git a/doc/development/README.md b/doc/development/README.md index bbe73570f49..e8bebc79124 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -18,6 +18,7 @@ description: 'Learn how to contribute to GitLab.' - [Generate a changelog entry with `bin/changelog`](changelog.md) - [Code review guidelines](code_review.md) for reviewing code and having code reviewed - [Database review guidelines](database_review.md) for reviewing database-related changes and complex SQL queries +- [Pipelines for the GitLab project](pipelines.md) - [Automatic CE->EE merge](automatic_ce_ee_merge.md) - [Guidelines for implementing Enterprise Edition features](ee_features.md) - [Security process for developers](https://gitlab.com/gitlab-org/release/docs/blob/master/general/security/developer.md#security-releases-critical-non-critical-as-a-developer) diff --git a/doc/development/changelog.md b/doc/development/changelog.md index 5667f58b0c3..afc18885a80 100644 --- a/doc/development/changelog.md +++ b/doc/development/changelog.md @@ -102,6 +102,13 @@ Its simplest usage is to provide the value for `title`: bin/changelog 'Hey DZ, I added a feature to GitLab!' ``` +If you want to generate a changelog entry for GitLab EE, you will need to pass +the `--ee` option: + +```text +bin/changelog --ee 'Hey DZ, I added a feature to GitLab!' +``` + At this point the script would ask you to select the category of the change (mapped to the `type` field in the entry): ```text @@ -131,9 +138,6 @@ author: type: ``` -If you're working on the GitLab EE repository, the entry will be added to -`ee/changelogs/unreleased/` instead. - ### Arguments | Argument | Shorthand | Purpose | diff --git a/doc/development/documentation/index.md b/doc/development/documentation/index.md index c158ec63cdd..87892722d5e 100644 --- a/doc/development/documentation/index.md +++ b/doc/development/documentation/index.md @@ -152,20 +152,6 @@ disqus_identifier: 'https://docs.gitlab.com/my-old-location/README.html' Note: it is necessary to include the file name in the `disqus_identifier` URL, even if it's `index.html` or `README.html`. -## Branch naming - -If your contribution contains **only** documentation changes, you can speed up -the CI process by following these branch naming conventions: - -| Branch name | Valid example | -|:----------------------|:-----------------------------| -| Starting with `docs/` | `docs/update-api-issues` | -| Starting with `docs-` | `docs-update-api-issues` | -| Ending in `-docs` | `123-update-api-issues-docs` | - -If your branch name matches any of the above, it will run only the docs -tests. If not, the whole application test suite will run (including docs tests). - ## Merge requests for GitLab documentation Before getting started, make sure you read the introductory section @@ -173,7 +159,6 @@ Before getting started, make sure you read the introductory section [documentation workflow](workflow.md). - Use the current [merge request description template](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/merge_request_templates/Documentation.md) -- Use the correct [branch name](#branch-naming) - Label the MR `Documentation` - Assign the correct milestone (see note below) @@ -283,10 +268,6 @@ Several [rspec tests](https://gitlab.com/gitlab-org/gitlab/blob/master/spec/feat are run to ensure GitLab documentation renders and works correctly. In particular, that [main docs landing page](../../README.md) will work correctly from `/help`. For example, [GitLab.com's `/help`](https://gitlab.com/help). -CAUTION: **Caution:** -Because the rspec tests only run in a full pipeline, and not a special [docs-only pipeline](#branch-naming), it is possible -to merge changes that will break `master` from a merge request with a successful docs-only pipeline run. - ## Docs site architecture See the [Docs site architecture](site_architecture/index.md) page to learn @@ -309,14 +290,9 @@ The live preview is currently enabled for the following projects: - <https://gitlab.com/gitlab-org/gitlab> - <https://gitlab.com/gitlab-org/gitlab-runner> -If your branch contains only documentation changes, you can use -[special branch names](#branch-naming) to avoid long-running pipelines. - -For [docs-only changes](#branch-naming), the review app is run automatically. -For all other branches, you can use the manual `review-docs-deploy-manual` job -in your merge request. You will need at least Maintainer permissions to be able -to run it. In the mini pipeline graph, you should see a `>>` icon. Clicking it will -reveal the `review-docs-deploy-manual` job. Click the play button to start the job. +If your merge request has docs changes, you can use the manual `review-docs-deploy` job +to deploy the docs review app for your merge request. +You will need at least Maintainer permissions to be able to run it. ![Manual trigger a docs build](img/manual_build_docs.png) diff --git a/doc/development/pipelines.md b/doc/development/pipelines.md new file mode 100644 index 00000000000..448fb0f9f5a --- /dev/null +++ b/doc/development/pipelines.md @@ -0,0 +1,216 @@ +# Pipelines for the GitLab project + +Pipelines for `gitlab-org/gitlab` and `gitlab-org/gitlab-foss` (as well as the +`dev` instance's mirrors) are configured in the usual +[`.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab-ci.yml) +which itself includes files under +[`.gitlab/ci/`](https://gitlab.com/gitlab-org/gitlab/tree/master/.gitlab/ci) +for easier maintenance. + +We're striving to [dogfood](https://about.gitlab.com/handbook/engineering/#dogfooding) +GitLab [CI/CD features and best-practices](../ci/yaml/README.md) +as much as possible. + +## Stages + +The current stages are: + +- `prepare`: This stage includes jobs that prepare artifacts that are needed by + jobs in subsequent stages. +- `quick-test`: This stage includes test jobs that should run first and fail the + pipeline early (currently used to run Geo tests when the branch name starts + with `geo-`, `geo/`, or ends with `-geo`). +- `test`: This stage includes most of the tests, DB/migration jobs, and static analysis jobs. +- `review-prepare`: This stage includes a job that build the CNG images that are + later used by the (Helm) Review App deployment (see + [Review Apps](testing_guide/review_apps.md) for details). +- `review`: This stage includes jobs that deploy the GitLab and Docs Review Apps. +- `qa`: This stage includes jobs that perform QA tasks against the Review App + that is deployed in the previous stage. +- `post-test`: This stage includes jobs that build reports or gather data from + the previous stages' jobs (e.g. coverage, Knapsack metadata etc.). +- `pages`: This stage includes a job that deploys the various reports as + GitLab pages (e.g. <https://gitlab-org.gitlab.io/gitlab/coverage-ruby/>, + <https://gitlab-org.gitlab.io/gitlab/coverage-javascript/>, + <https://gitlab-org.gitlab.io/gitlab/webpack-report/>). + +## Default image + +The default image is currently +`dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33`. +It includes Ruby 2.6.3, Go 1.11, Git 2.22, Chrome 73, Node 12, Yarn 1.16, +PostgreSQL 9.6, and Graphics Magick 1.3.33. + +The images used in our pipelines are configured in the +[`gitlab-org/gitlab-build-images`](https://gitlab.com/gitlab-org/gitlab-build-images) +project, which is push-mirrored to <https://dev.gitlab.org/gitlab/gitlab-build-images> +for redundancy. + +The current version of the build images can be found in the +["Used by GitLab CE/EE section"](https://gitlab.com/gitlab-org/gitlab-build-images/blob/master/.gitlab-ci.yml). + +## Default variables + +In addition to the [predefined variables](../ci/variables/predefined_variables.md), +each pipeline includes the following [variables](../ci/variables/README.md): + +- `RAILS_ENV: "test"` +- `NODE_ENV: "test"` +- `SIMPLECOV: "true"` +- `GIT_DEPTH: "20"` +- `GIT_SUBMODULE_STRATEGY: "none"` +- `GET_SOURCES_ATTEMPTS: "3"` +- `KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/${CI_PROJECT_NAME}/rspec_report-master.json` +- `EE_KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/${CI_PROJECT_NAME}/rspec_report-master-ee.json` +- `FLAKY_RSPEC_SUITE_REPORT_PATH: rspec_flaky/report-suite.json` +- `BUILD_ASSETS_IMAGE: "false"` +- `ES_JAVA_OPTS: "-Xms256m -Xmx256m"` +- `ELASTIC_URL: "http://elastic:changeme@docker.elastic.co-elasticsearch-elasticsearch:9200"` + +## Common job definitions + +Most of the jobs [extend from a few CI definitions](../ci/yaml/README.md#extends) +that are scoped to a single +[configuration parameter](../ci/yaml/README.md#configuration-parameters). + +These common definitions are: + +- `.default-tags`: Ensures a job has the `gitlab-org` tag to ensure it's using + our dedicated runners. +- `.default-retry`: Allows a job to retry upon `unknown_failure`, `api_failure`, + `runner_system_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-cache`: Allows a job to use a default `cache` definition suitable for + Ruby/Rails and frontend tasks. +- `.default-only`: Restricts the cases where a job is created. This currently + includes `master`, `/^[\d-]+-stable(-ee)?$/` (stable branches), + `/^\d+-\d+-auto-deploy-\d+$/` (security branches), `merge_requests`, `tags`. + Note that jobs won't be created for branches with this default configuration. +- `.only-review`: Only creates a job for the `gitlab-org` namespace and if + Kubernetes integration is available. Also, prevents a job from being created + for `master` and auto-deploy branches. +- `.only-review-schedules`: Same as `.only-review` but also restrict a job to + only run for [schedules](../user/project/pipelines/schedules.md). +- `.use-pg`: Allows a job to use the `postgres:9.6.14` and `redis:alpine` services. +- `.use-pg-10`: Allows a job to use the `postgres:10.9` and `redis:alpine` services. +- `.only-ee`: Only creates a job for the `gitlab` project. + +## Changes detection + +If a job extends from `.default-only` (and most of the jobs should), it can restrict +the cases where it should be created +[based on the changes](../ci/yaml/README.md#onlychangesexceptchanges) +from a commit or MR by extending from the following CI definitions: + +- `.only-code-changes`: Allows a job to only be created upon code-related changes. +- `.only-qa-changes`: Allows a job to only be created upon QA-related changes. +- `.only-docs-changes`: Allows a job to only be created upon docs-related changes. +- `.only-code-qa-changes`: Allows a job to only be created upon code-related or QA-related changes. + +**See <https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/global.gitlab-ci.yml> +for the list of exact patterns.** + +## Directed acyclic graph + +We're using the [`needs:`](../ci/yaml/README.md#needs) keyword to +execute jobs out of order for the following jobs: + +```mermaid +graph RL; + A[setup-test-env]; + B["gitlab:assets:compile<br/>(master only)"]; + C[gitlab:assets:compile pull-cache]; + D["cache gems<br/>(master and tags only)"]; + E[review-build-cng]; + F[build-qa-image]; + G[review-deploy]; + G2["schedule:review-deploy<br/>(master only)"]; + H[karma]; + I[jest]; + J["compile-assets<br/>(master only)"]; + K[compile-assets pull-cache]; + L[webpack-dev-server]; + M[coverage]; + N[pages]; + O[static-analysis]; + P["package-and-qa-manual:master<br/>(master schedule only)"]; + Q[package-and-qa]; + R[package-and-qa-manual]; + +subgraph "`prepare` stage" + A + F + J + K + end + +subgraph "`test` stage" + B --> |needs| A; + C --> |needs| A; + D --> |needs| A; + H -.-> |depends on| A; + H -.-> |depends on| J; + H -.-> |depends on| K; + I -.-> |depends on| A; + I -.-> |depends on| J; + I -.-> |depends on| K; + L -.-> |depends on| A; + L -.-> |depends on| J; + L -.-> |depends on| K; + downtime_check --> |needs and depends on| A; + db:* --> |needs| A; + gitlab:setup --> |needs| A; + O -.-> |depends on| A; + O -.-> |depends on| B; + O -.-> |depends on| C; + downtime_check --> |needs and depends on| A; + end + +subgraph "`review-prepare` stage" + E --> |needs| C; + X["schedule:review-build-cng<br/>(master schedule only)"] --> |needs| B; + end + +subgraph "`review` stage" + G --> |needs| E; + G2 --> |needs| E; + end + +subgraph "`qa` stage" + Q --> |needs| C; + Q --> |needs| F; + R --> |needs| C; + R --> |needs| F; + P --> |needs| B; + P --> |needs| F; + review-qa-smoke -.-> |depends on| G; + review-qa-all -.-> |depends on| G; + review-qa-performance -.-> |depends on| G; + X2["schedule:review-performance<br/>(master only)"] -.-> |depends on| G2; + dast -.-> |depends on| G; + end + +subgraph "`post-test` stage" + M + end + +subgraph "`pages` stage" + N -.-> |depends on| B; + N -.-> |depends on| H; + N -.-> |depends on| M; + end +``` + +## Test jobs + +Consult [GitLab tests in the Continuous Integration (CI) context](testing_guide/ci.md) +for more information. + +## Review app jobs + +Consult the [Review Apps](testing_guide/review_apps.md) dedicated page for more information. + +--- + +[Return to Development documentation](README.md) diff --git a/doc/development/testing_guide/end_to_end/index.md b/doc/development/testing_guide/end_to_end/index.md index f6a2f642274..c00be77ce8c 100644 --- a/doc/development/testing_guide/end_to_end/index.md +++ b/doc/development/testing_guide/end_to_end/index.md @@ -7,24 +7,6 @@ as expected across the entire software stack and architecture, including integration of all micro-services and components that are supposed to work together. -## Branch naming - -If your contribution contains **only** changes under the -[`qa/` folder](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/qa), you can -speed up the CI process by following some branch naming conventions. You have -three choices: - -| Branch name | Valid example | -|:----------------------|:-----------------------------| -| Starting with `qa/` | `qa/new-oauth-login-test` | -| Starting with `qa-` | `qa-new-oauth-login-test` | -| Ending in `-qa` | `123-new-oauth-login-test-qa` | - -If your branch name matches any of the above, it will run only the QA-related -jobs. -If it does not, the whole application test suite will run (including QA-related -jobs). - ## How do we test GitLab? We use [Omnibus GitLab][omnibus-gitlab] to build GitLab packages and then we diff --git a/lib/gitlab_danger.rb b/lib/gitlab_danger.rb index cf297c142dc..499ae6111d7 100644 --- a/lib/gitlab_danger.rb +++ b/lib/gitlab_danger.rb @@ -21,7 +21,6 @@ class GitlabDanger single_codebase gitlab_ui_wg ce_ee_vue_templates - only_documentation ].freeze MESSAGE_PREFIX = '==>'.freeze diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 77231c350f9..bdd4805997c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4656,9 +4656,6 @@ msgstr "" msgid "Days" msgstr "" -msgid "Days to merge" -msgstr "" - msgid "Debug" msgstr "" @@ -5845,6 +5842,9 @@ msgstr "" msgid "Epics Roadmap" msgstr "" +msgid "Epics and Issues" +msgstr "" + msgid "Epics let you manage your portfolio of projects more efficiently and with less effort" msgstr "" @@ -5896,6 +5896,9 @@ msgstr "" msgid "Epics|Something went wrong while fetching group epics." msgstr "" +msgid "Epics|Something went wrong while ordering item." +msgstr "" + msgid "Epics|Something went wrong while removing issue from epic." msgstr "" @@ -11461,6 +11464,9 @@ msgstr "" msgid "ProductivityAnalytics|Ascending" msgstr "" +msgid "ProductivityAnalytics|Days to merge" +msgstr "" + msgid "ProductivityAnalytics|Descending" msgstr "" @@ -16376,9 +16382,6 @@ msgstr "" msgid "TransferProject|Transfer failed, please contact an admin." msgstr "" -msgid "Tree" -msgstr "" - msgid "Tree view" msgstr "" diff --git a/package.json b/package.json index 181f2c8f1a5..c468f7875ae 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "select2": "3.5.2-browserify", "sha1": "^1.1.1", "smooshpack": "^0.0.54", - "sortablejs": "^1.7.0", + "sortablejs": "^1.10.0", "sql.js": "^0.4.0", "stickyfilljs": "^2.0.5", "style-loader": "^0.23.1", @@ -137,6 +137,7 @@ "vue-router": "^3.0.2", "vue-template-compiler": "^2.6.10", "vue-virtual-scroll-list": "^1.3.1", + "vuedraggable": "^2.23.0", "vuex": "^3.1.0", "webpack": "^4.29.0", "webpack-bundle-analyzer": "^3.3.2", diff --git a/spec/bin/changelog_spec.rb b/spec/bin/changelog_spec.rb index c3a5abf2b7a..ce7f7648c0c 100644 --- a/spec/bin/changelog_spec.rb +++ b/spec/bin/changelog_spec.rb @@ -69,6 +69,14 @@ describe 'bin/changelog' do end end + it 'parses --ee and -e' do + %w[--ee -e].each do |flag| + options = described_class.parse(%W[foo #{flag} security]) + + expect(options.ee).to eq true + end + end + it 'parses -h' do expect do expect { described_class.parse(%w[foo -h bar]) }.to output.to_stdout diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js index 1b96f95b5a5..7b484ccfa07 100644 --- a/spec/frontend/jobs/store/utils_spec.js +++ b/spec/frontend/jobs/store/utils_spec.js @@ -28,6 +28,12 @@ describe('Jobs Store Utils', () => { content: [{ text: 'Pulling docker image postgres:9.6.14 ...', style: 'term-fg-l-green' }], sections: ['prepare-executor'], }, + { + offset: 1005, + content: [], + sections: ['prepare-executor'], + section_duration: '10:00', + }, ]; let result; @@ -58,6 +64,16 @@ describe('Jobs Store Utils', () => { expect(result[1].lines[1].content).toEqual(mockData[3].content); }); }); + + describe('section duration', () => { + it('adds the section information to the header section', () => { + expect(result[1].section_duration).toEqual(mockData[4].section_duration); + }); + + it('does not add section duration as a line', () => { + expect(result[1].lines.includes(mockData[4])).toEqual(false); + }); + }); }); describe('updateIncrementalTrace', () => { diff --git a/spec/javascripts/jobs/components/log/duration_badge_spec.js b/spec/javascripts/jobs/components/log/duration_badge_spec.js new file mode 100644 index 00000000000..2ac34e78909 --- /dev/null +++ b/spec/javascripts/jobs/components/log/duration_badge_spec.js @@ -0,0 +1,31 @@ +import { shallowMount } from '@vue/test-utils'; +import DurationBadge from '~/jobs/components/log/duration_badge.vue'; + +describe('Job Log Duration Badge', () => { + let wrapper; + + const data = { + duration: '00:30:01', + }; + + const createComponent = (props = {}) => { + wrapper = shallowMount(DurationBadge, { + sync: false, + propsData: { + ...props, + }, + }); + }; + + beforeEach(() => { + createComponent(data); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('renders provided duration', () => { + expect(wrapper.text()).toBe(data.duration); + }); +}); diff --git a/spec/javascripts/jobs/components/log/line_header_spec.js b/spec/javascripts/jobs/components/log/line_header_spec.js index 4efd412a6cd..2d2f92fad9d 100644 --- a/spec/javascripts/jobs/components/log/line_header_spec.js +++ b/spec/javascripts/jobs/components/log/line_header_spec.js @@ -1,6 +1,7 @@ import { mount } from '@vue/test-utils'; import LineHeader from '~/jobs/components/log/line_header.vue'; import LineNumber from '~/jobs/components/log/line_number.vue'; +import DurationBadge from '~/jobs/components/log/duration_badge.vue'; describe('Job Log Header Line', () => { let wrapper; @@ -81,4 +82,14 @@ describe('Job Log Header Line', () => { expect(wrapper.emitted().toggleLine.length).toBe(1); }); }); + + describe('with duration', () => { + beforeEach(() => { + createComponent(Object.assign({}, data, { duration: '00:10' })); + }); + + it('renders the duration badge', () => { + expect(wrapper.contains(DurationBadge)).toBe(true); + }); + }); }); diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 6eafe122697..1a5fdac1c95 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -287,51 +287,21 @@ describe Ci::CreatePipelineService do expect(pipeline.builds.find_by(name: 'rspec').interruptible).to be_falsy end end - - context 'not defined, but an environment is' do - before do - config = YAML.dump(rspec: { script: 'echo', environment: { name: "review/$CI_COMMIT_REF_NAME" } }) - stub_ci_pipeline_yaml_file(config) - end - - it 'is not cancelable' do - pipeline = execute_service - - expect(pipeline.builds.find_by(name: 'rspec').interruptible).to be_nil - end - end - - context 'overriding the environment definition' do - before do - config = YAML.dump(rspec: { script: 'echo', environment: { name: "review/$CI_COMMIT_REF_NAME" }, interruptible: true }) - stub_ci_pipeline_yaml_file(config) - end - - it 'is cancelable' do - pipeline = execute_service - - expect(pipeline.builds.find_by(name: 'rspec').interruptible).to be_truthy - end - end end context 'interruptible builds' do before do - Feature.enable(:ci_support_interruptible_pipelines) stub_ci_pipeline_yaml_file(YAML.dump(config)) end - after do - Feature.disable(:ci_support_interruptible_pipelines) - end - let(:config) do { stages: %w[stage1 stage2 stage3 stage4], build_1_1: { stage: 'stage1', - script: 'echo' + script: 'echo', + interruptible: true }, build_1_2: { stage: 'stage1', @@ -342,7 +312,8 @@ describe Ci::CreatePipelineService do stage: 'stage2', script: 'echo', when: 'delayed', - start_in: '10 minutes' + start_in: '10 minutes', + interruptible: true }, build_3_1: { stage: 'stage3', @@ -364,9 +335,9 @@ describe Ci::CreatePipelineService do .pluck(:name, 'ci_builds_metadata.interruptible') expect(interruptible_status).to contain_exactly( - ['build_1_1', nil], + ['build_1_1', true], ['build_1_2', true], - ['build_2_1', nil], + ['build_2_1', true], ['build_3_1', false], ['build_4_1', nil] ) diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb index f25e05dca7f..474a294ce0d 100644 --- a/spec/views/help/index.html.haml_spec.rb +++ b/spec/views/help/index.html.haml_spec.rb @@ -31,7 +31,7 @@ describe 'help/index' do render expect(rendered).to match '8.0.2' - expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/-/tags/v8.0.2}) + expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/-/tags/v8.0.2}) end it 'shows a link to the commit for pre-releases' do @@ -40,7 +40,7 @@ describe 'help/index' do render expect(rendered).to match '8.0.2' - expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/commits/abcdefg}) + expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/commits/abcdefg}) end end end diff --git a/yarn.lock b/yarn.lock index 59e4703e73d..0186f8aad61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11122,10 +11122,15 @@ sort-keys@^2.0.0: dependencies: is-plain-obj "^1.0.0" -sortablejs@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.7.0.tgz#80a2b2370abd568e1cec8c271131ef30a904fa28" - integrity sha1-gKKyNwq9Vo4c7IwnETHvMKkE+ig= +sortablejs@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.10.0.tgz#0ebc054acff2486569194a2f975b2b145dd5e7d6" + integrity sha512-+e0YakK1BxgEZpf9l9UiFaiQ8ZOBn1p/4qkkXr8QDVmYyCrUDTyDRRGm0AgW4E4cD0wtgxJ6yzIRkSPUwqhuhg== + +sortablejs@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.9.0.tgz#2d1e74ae6bac2cb4ad0622908f340848969eb88d" + integrity sha512-Ot6bYJ6PoqPmpsqQYXjn1+RKrY2NWQvQt/o4jfd/UYwVWndyO5EPO8YHbnm5HIykf8ENsm4JUrdAvolPT86yYA== source-list-map@^2.0.0: version "2.0.0" @@ -12793,6 +12798,13 @@ vue@^2.6.10: resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== +vuedraggable@^2.23.0: + version "2.23.0" + resolved "https://registry.yarnpkg.com/vuedraggable/-/vuedraggable-2.23.0.tgz#1f4a5a601675a5dbf0d96ee61aebfffa43445262" + integrity sha512-RgdH16k43WNoxyRcv/OarB/DZh9SY5TYthk9TS4YiHXpelD1DytEG0phLAXiXx5EhsmdH8ltSWxklGa4g1WTCw== + dependencies: + sortablejs "^1.9.0" + vuex@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.1.0.tgz#634b81515cf0cfe976bd1ffe9601755e51f843b9" |