diff --git a/.gitignore b/.gitignore index 0696dd217a..627c806787 100644 --- a/.gitignore +++ b/.gitignore @@ -59,8 +59,6 @@ eslint-report.html /public/uploads.* /public/uploads/ /shared/artifacts/ -/spec/javascripts/fixtures/blob/pdf/ -/spec/javascripts/fixtures/blob/balsamiq/ /rails_best_practices_output.html /tags /tmp/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4eb17656ed..44beccd966 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,4 @@ -image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-golang-1.11-git-2.18-chrome-73.0-node-10.x-yarn-1.12-postgresql-9.6-graphicsmagick-1.3.29" - -include: - - local: /lib/gitlab/ci/templates/Code-Quality.gitlab-ci.yml - -.dedicated-runner: &dedicated-runner - retry: 1 - tags: - - gitlab-org - -.default-cache: &default-cache - key: "debian-stretch-ruby-2.5.3-node-10.x" - paths: - - vendor/ruby - - .yarn-cache/ - - vendor/gitaly-ruby - -.push-cache: &push-cache - cache: - <<: *default-cache - policy: push - -.pull-cache: &pull-cache - cache: - <<: *default-cache - policy: pull +image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-golang-1.11-git-2.21-chrome-73.0-node-10.x-yarn-1.12-postgresql-9.6-graphicsmagick-1.3.29" variables: MYSQL_ALLOW_EMPTY_PASSWORD: "1" @@ -53,1092 +28,21 @@ stages: - prepare - merge - test + - review + - qa - post-test - pages - post-cleanup -# Predefined scopes -.tests-metadata-state: &tests-metadata-state - <<: *dedicated-runner - variables: - TESTS_METADATA_S3_BUCKET: "gitlab-ce-cache" - before_script: - - source scripts/utils.sh - artifacts: - expire_in: 31d - paths: - - knapsack/ - - rspec_flaky/ - - rspec_profiling/ - -.use-pg: &use-pg - services: - - postgres:9.6 - - redis:alpine - -.use-mysql: &use-mysql - services: - - mysql:5.7 - - redis:alpine - -# Skip all jobs except the ones that begin with 'docs/'. -# Used for commits including ONLY documentation changes. -# https://docs.gitlab.com/ce/development/documentation/#testing -.except-docs: &except-docs - except: - - /(^docs[\/-].*|.*-docs$)/ - -.except-qa: &except-qa - except: - - /(^qa[\/-].*|.*-qa$)/ - -.except-docs-and-qa: &except-docs-and-qa - except: - - /(^docs[\/-].*|.*-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ - -# Jobs that only need to pull cache -.dedicated-no-docs-pull-cache-job: &dedicated-no-docs-pull-cache-job - <<: *dedicated-runner - <<: *except-docs - <<: *pull-cache - dependencies: - - setup-test-env - stage: test - -# Jobs that do not need a DB -.dedicated-no-docs-no-db-pull-cache-job: &dedicated-no-docs-no-db-pull-cache-job - <<: *dedicated-no-docs-pull-cache-job - variables: - SETUP_DB: "false" - -.dedicated-no-docs-and-no-qa-pull-cache-job: &dedicated-no-docs-and-no-qa-pull-cache-job - <<: *dedicated-no-docs-pull-cache-job - <<: *except-docs-and-qa - -.single-script-job: &single-script-job - image: ruby:2.5-alpine - stage: test - cache: {} - dependencies: [] - variables: &single-script-job-variables - GIT_STRATEGY: none - before_script: - # We don't clone the repo by using GIT_STRATEGY: none and only download the - # single script we need here so it's much faster than cloning. - - export SCRIPT_NAME="${SCRIPT_NAME:-$CI_JOB_NAME}" - - apk add --update openssl - - wget $CI_PROJECT_URL/raw/$CI_COMMIT_SHA/scripts/$SCRIPT_NAME - - chmod 755 $(basename $SCRIPT_NAME) - -.rake-exec: &rake-exec - <<: *dedicated-no-docs-no-db-pull-cache-job - script: - - bundle exec rake $CI_JOB_NAME - -.rspec-metadata: &rspec-metadata - <<: *dedicated-runner - <<: *except-docs-and-qa - <<: *pull-cache - stage: test - script: - - JOB_NAME=( $CI_JOB_NAME ) - - TEST_TOOL=${JOB_NAME[0]} - - export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${TEST_TOOL}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json - - export KNAPSACK_GENERATE_REPORT=true - - export SUITE_FLAKY_RSPEC_REPORT_PATH=${FLAKY_RSPEC_SUITE_REPORT_PATH} - - export FLAKY_RSPEC_REPORT_PATH=rspec_flaky/all_${TEST_TOOL}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json - - export NEW_FLAKY_RSPEC_REPORT_PATH=rspec_flaky/new_${TEST_TOOL}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json - - export FLAKY_RSPEC_GENERATE_REPORT=true - - export CACHE_CLASSES=true - - cp ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} ${KNAPSACK_REPORT_PATH} - - '[[ -f $FLAKY_RSPEC_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_REPORT_PATH}' - - '[[ -f $NEW_FLAKY_RSPEC_REPORT_PATH ]] || echo "{}" > ${NEW_FLAKY_RSPEC_REPORT_PATH}' - - scripts/gitaly-test-spawn - - knapsack rspec "--color --format documentation --format RspecJunitFormatter --out junit_rspec.xml" - artifacts: - expire_in: 31d - when: always - paths: - - coverage/ - - knapsack/ - - rspec_flaky/ - - rspec_profiling/ - - tmp/capybara/ - reports: - junit: junit_rspec.xml - -.rspec-metadata-pg: &rspec-metadata-pg - <<: *rspec-metadata - <<: *use-pg - -.rspec-metadata-mysql: &rspec-metadata-mysql - <<: *rspec-metadata - <<: *use-mysql - -.only-canonical-masters: &only-canonical-masters - only: - - master@gitlab-org/gitlab-ce - - master@gitlab-org/gitlab-ee - - master@gitlab/gitlabhq - - master@gitlab/gitlab-ee - -.gitlab-setup: &gitlab-setup - <<: *dedicated-no-docs-and-no-qa-pull-cache-job - <<: *use-pg - variables: - SETUP_DB: "false" - script: - # Manually clone gitlab-test and only seed this project in - # db/fixtures/development/04_project.rb thanks to SIZE=1 below - - git clone https://gitlab.com/gitlab-org/gitlab-test.git - /home/git/repositories/gitlab-org/gitlab-test.git - - scripts/gitaly-test-spawn - - force=yes SIZE=1 FIXTURE_PATH="db/fixtures/development" bundle exec rake gitlab:setup - artifacts: - when: on_failure - expire_in: 1d - paths: - - log/development.log - -# DB migration, rollback, and seed jobs -.db-migrate-reset: &db-migrate-reset - <<: *dedicated-no-docs-and-no-qa-pull-cache-job - script: - - bundle exec rake db:migrate:reset - -.migration-paths: &migration-paths - <<: *dedicated-no-docs-and-no-qa-pull-cache-job - variables: - SETUP_DB: "false" - script: - - git fetch https://gitlab.com/gitlab-org/gitlab-ce.git v9.3.0 - - git checkout -f FETCH_HEAD - - sed -i "s/gem 'oj', '~> 2.17.4'//" Gemfile - - bundle update google-protobuf grpc - - bundle install $BUNDLE_INSTALL_FLAGS - - date - - cp config/gitlab.yml.example config/gitlab.yml - - bundle exec rake db:drop db:create db:schema:load db:seed_fu - - date - - git checkout -f $CI_COMMIT_SHA - - bundle install $BUNDLE_INSTALL_FLAGS - - date - - . scripts/prepare_build.sh - - date - - bundle exec rake db:migrate - -## -# Trigger a package build in omnibus-gitlab repository -# -package-and-qa: - image: ruby:2.5-alpine - stage: test - before_script: [] - dependencies: [] - cache: {} - variables: - GIT_DEPTH: "1" - API_TOKEN: "${GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN}" - retry: 0 - script: - - apk add --update openssl curl jq - - gem install gitlab --no-document - - source ./scripts/review_apps/review-apps.sh - - wait_for_job_to_be_done "gitlab:assets:compile" - - ./scripts/trigger-build omnibus - when: manual - only: - - /.+/@gitlab-org/gitlab-ce - - /.+/@gitlab-org/gitlab-ee - -# Review docs base -.review-docs: &review-docs - <<: *dedicated-runner - <<: *single-script-job - variables: - <<: *single-script-job-variables - SCRIPT_NAME: trigger-build-docs - environment: - name: review-docs/$CI_COMMIT_REF_SLUG - # DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are CI variables - # Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693 - url: http://$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX - on_stop: review-docs-cleanup - -# 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: - <<: *review-docs - stage: build - script: - - gem install gitlab --no-document - - ./$SCRIPT_NAME deploy - when: manual - only: - - branches@gitlab-org/gitlab-ce - - branches@gitlab-org/gitlab-ee - <<: *except-docs-and-qa - -# Always trigger a docs build in gitlab-docs only on docs-only branches. -# Useful to preview the docs changes live. -review-docs-deploy: - <<: *review-docs - stage: post-test - script: - - gem install gitlab --no-document - - ./$SCRIPT_NAME deploy - only: - - /(^docs[\/-].*|.*-docs$)/@gitlab-org/gitlab-ce - - /(^docs[\/-].*|.*-docs$)/@gitlab-org/gitlab-ee - <<: *except-qa - -# Cleanup remote environment of gitlab-docs -review-docs-cleanup: - <<: *review-docs - stage: post-cleanup - environment: - name: review-docs/$CI_COMMIT_REF_SLUG - action: stop - script: - - gem install gitlab --no-document - - ./$SCRIPT_NAME cleanup - when: manual - only: - - branches@gitlab-org/gitlab-ce - - branches@gitlab-org/gitlab-ee - -## -# Trigger a docker image build in CNG (Cloud Native GitLab) repository -# -cloud-native-image: - image: ruby:2.5-alpine - before_script: [] - dependencies: [] - stage: post-test - allow_failure: true - variables: - GIT_DEPTH: "1" - cache: {} - when: manual - script: - - gem install gitlab --no-document - - CNG_PROJECT_PATH="gitlab-org/build/CNG" BUILD_TRIGGER_TOKEN=$CI_JOB_TOKEN ./scripts/trigger-build cng - only: - - tags@gitlab-org/gitlab-ce - - tags@gitlab-org/gitlab-ee - -# Retrieve knapsack and rspec_flaky reports -retrieve-tests-metadata: - <<: *tests-metadata-state - <<: *except-docs-and-qa - stage: prepare - cache: - key: tests_metadata - policy: pull - script: - - mkdir -p knapsack/${CI_PROJECT_NAME}/ - - wget -O $KNAPSACK_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$KNAPSACK_RSPEC_SUITE_REPORT_PATH || rm $KNAPSACK_RSPEC_SUITE_REPORT_PATH - - '[[ -f $KNAPSACK_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${KNAPSACK_RSPEC_SUITE_REPORT_PATH}' - - mkdir -p rspec_flaky/ - - 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}' - -update-tests-metadata: - <<: *tests-metadata-state - <<: *only-canonical-masters - stage: post-test - cache: - key: tests_metadata - paths: - - knapsack/ - - rspec_flaky/ - policy: push - script: - - retry gem install fog-aws mime-types activesupport rspec_profiling postgres-copy --no-document - - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec-pg_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} - - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH' - - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $FLAKY_RSPEC_SUITE_REPORT_PATH' - - rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json - - rm -f rspec_flaky/all_*.json rspec_flaky/new_*.json - - scripts/insert-rspec-profiling-data - -flaky-examples-check: - <<: *dedicated-runner - image: ruby:2.5-alpine - services: [] - before_script: [] - variables: - SETUP_DB: "false" - USE_BUNDLE_INSTALL: "false" - NEW_FLAKY_SPECS_REPORT: rspec_flaky/report-new.json - stage: post-test - allow_failure: true - retry: 0 - only: - - branches - except: - - master - - /(^docs[\/-].*|.*-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ - artifacts: - expire_in: 30d - paths: - - rspec_flaky/ - script: - - '[[ -f $NEW_FLAKY_SPECS_REPORT ]] || echo "{}" > ${NEW_FLAKY_SPECS_REPORT}' - - scripts/merge-reports ${NEW_FLAKY_SPECS_REPORT} rspec_flaky/new_*_*.json - - scripts/detect-new-flaky-examples $NEW_FLAKY_SPECS_REPORT - -.assets-compile-cache: &assets-compile-cache - cache: - key: "assets-compile:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:v5" - paths: - - vendor/ruby/ - - .yarn-cache/ - - tmp/cache/assets/sprockets - -compile-assets: - <<: *dedicated-runner - <<: *except-docs - <<: *use-pg - stage: prepare - script: - - node --version - - yarn install --frozen-lockfile --cache-folder .yarn-cache - - free -m - - bundle exec rake gitlab:assets:compile - - scripts/clean-old-cached-assets - variables: - # we override the max_old_space_size to prevent OOM errors - NODE_OPTIONS: --max_old_space_size=3584 - artifacts: - expire_in: 7d - paths: - - node_modules - - public/assets - <<: *assets-compile-cache - -setup-test-env: - <<: *dedicated-runner - <<: *except-docs - <<: *use-pg - stage: prepare - cache: - <<: *default-cache - script: - - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' - - scripts/gitaly-test-build # Do not use 'bundle exec' here - artifacts: - expire_in: 7d - paths: - - tmp/tests - - config/secrets.yml - - vendor/gitaly-ruby - -# GitLab Review apps -.review-only: &review-only - only: - refs: - - branches@gitlab-org/gitlab-ce - - branches@gitlab-org/gitlab-ee - kubernetes: active - except: - refs: - - master - - /(^docs[\/-].*|.*-docs$)/ - -.review-schedules-only: &review-schedules-only - only: - refs: - - schedules@gitlab-org/gitlab-ce - - schedules@gitlab-org/gitlab-ee - kubernetes: active - except: - refs: - - tags - - /(^docs[\/-].*|.*-docs$)/ - -.review-base: &review-base - <<: *dedicated-no-docs-no-db-pull-cache-job - <<: *review-only - image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base - stage: test - cache: {} - dependencies: [] - environment: &review-environment - name: review/${CI_COMMIT_REF_NAME} - url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN} - before_script: [] - -.review-docker: &review-docker - <<: *review-base - image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine - services: - - docker:stable-dind - tags: - - gitlab-org - - docker - variables: &review-docker-variables - GIT_DEPTH: "1" - DOCKER_DRIVER: overlay2 - DOCKER_HOST: tcp://docker:2375 - LATEST_QA_IMAGE: "gitlab/${CI_PROJECT_NAME}-qa:nightly" - QA_IMAGE: "${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/${CI_PROJECT_NAME}-qa:${CI_COMMIT_REF_SLUG}" - -build-qa-image: - <<: *review-docker - variables: - <<: *review-docker-variables - GIT_DEPTH: "20" - stage: prepare - script: - - time docker build --cache-from ${LATEST_QA_IMAGE} --tag ${QA_IMAGE} ./qa/ - - echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY} - - time docker push ${QA_IMAGE} - -danger-review: - <<: *pull-cache - image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger - stage: test - dependencies: [] - before_script: [] - only: - variables: - - $DANGER_GITLAB_API_TOKEN - except: - refs: - - master - variables: - - $CI_COMMIT_REF_NAME =~ /^ce-to-ee-.*/ - - $CI_COMMIT_REF_NAME =~ /.*-stable(-ee)?-prepare-.*/ - script: - - git version - - node --version - - yarn install --frozen-lockfile --cache-folder .yarn-cache - - danger --fail-on-errors=true - -rspec-pg: - <<: *rspec-metadata-pg - parallel: 50 - -rspec-mysql: - <<: *rspec-metadata-mysql - parallel: 50 - -.rspec-quarantine: &rspec-quarantine - retry: 0 - script: - - export CACHE_CLASSES=true - - scripts/gitaly-test-spawn - - bin/rspec --color --format documentation --tag quarantine spec/ - -rspec-pg-quarantine: - <<: *rspec-metadata-pg - <<: *rspec-quarantine - allow_failure: true - -rspec-mysql-quarantine: - <<: *rspec-metadata-mysql - <<: *rspec-quarantine - allow_failure: true - -static-analysis: - <<: *dedicated-no-docs-no-db-pull-cache-job - dependencies: - - compile-assets - - setup-test-env - script: - - scripts/static-analysis - cache: - key: "debian-stretch-ruby-2.5.3-node-10.x-and-rubocop" - paths: - - vendor/ruby - - .yarn-cache/ - - tmp/rubocop_cache - -# Documentation checks: -# - Check validity of relative links -# - Make sure cURL examples in API docs use the full switches -docs lint: - <<: *dedicated-runner - <<: *except-qa - image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs-lint" - stage: test - cache: {} - dependencies: [] - before_script: [] - script: - - scripts/lint-doc.sh - - scripts/lint-changelog-yaml - - mv doc/ /tmp/gitlab-docs/content/$DOCS_GITLAB_REPO_SUFFIX - - cd /tmp/gitlab-docs - # Build HTML from Markdown - - bundle exec nanoc - # Check the internal links - - bundle exec nanoc check internal_links - -downtime_check: - <<: *rake-exec - except: - - master - - tags - - /^[\d-]+-stable(-ee)?$/ - - /(^docs[\/-].*|.*-docs$)/ - - /(^qa[\/-].*|.*-qa$)/ - -ee_compat_check: - <<: *rake-exec - dependencies: [] - except: - - master - - tags - - /[\d-]+-stable(-ee)?/ - - /^security-/ - - branches@gitlab-org/gitlab-ee - - branches@gitlab/gitlab-ee - retry: 0 - artifacts: - name: "${CI_JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT_SHA}" - when: always - expire_in: 10d - paths: - - ee_compat_check/patches/*.patch - -db:migrate:reset-pg: - <<: *db-migrate-reset - <<: *use-pg - -db:migrate:reset-mysql: - <<: *db-migrate-reset - <<: *use-mysql - -db:check-schema-pg: - <<: *db-migrate-reset - <<: *use-pg - script: - - source scripts/schema_changed.sh - -migration:path-pg: - <<: *migration-paths - <<: *use-pg - -migration:path-mysql: - <<: *migration-paths - <<: *use-mysql - -.db-rollback: &db-rollback - <<: *dedicated-no-docs-and-no-qa-pull-cache-job - script: - - bundle exec rake db:migrate VERSION=20170523121229 - - bundle exec rake db:migrate - -db:rollback-pg: - <<: *db-rollback - <<: *use-pg - -db:rollback-mysql: - <<: *db-rollback - <<: *use-mysql - -gitlab:setup-pg: - <<: *gitlab-setup - <<: *use-pg - -gitlab:setup-mysql: - <<: *gitlab-setup - <<: *use-mysql - -# Frontend-related jobs -gitlab:assets:compile: - <<: *dedicated-no-docs-pull-cache-job - image: dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-git-2.18-chrome-73.0-node-8.x-yarn-1.12-graphicsmagick-1.3.29-docker-18.06.1 - dependencies: - - setup-test-env - services: - - docker:stable-dind - variables: - NODE_ENV: "production" - RAILS_ENV: "production" - SETUP_DB: "false" - SKIP_STORAGE_VALIDATION: "true" - WEBPACK_REPORT: "true" - # we override the max_old_space_size to prevent OOM errors - NODE_OPTIONS: --max_old_space_size=3584 - DOCKER_DRIVER: overlay2 - DOCKER_HOST: tcp://docker:2375 - script: - - node --version - - yarn install --frozen-lockfile --production --cache-folder .yarn-cache - - free -m - - bundle exec rake gitlab:assets:compile - - time scripts/build_assets_image - - scripts/clean-old-cached-assets - artifacts: - name: webpack-report - expire_in: 31d - paths: - - webpack-report/ - - public/assets/ - <<: *assets-compile-cache - only: - - /.+/@gitlab-org/gitlab-ce - - /.+/@gitlab-org/gitlab-ee - - /.+/@gitlab/gitlabhq - - /.+/@gitlab/gitlab-ee - tags: - - docker - - gitlab-org - -gitlab:ui:visual: - tags: - - gitlab-org - before_script: [] - allow_failure: true - dependencies: - - compile-assets - script: - # Remove node modules from GitLab that may conflict with gitlab-ui - - rm -r node_modules - - git clone https://gitlab.com/gitlab-org/gitlab-ui.git - - cp public/assets/application-*.css gitlab-ui/styles/application.css - - cd gitlab-ui - - yarn install - - CSS_URL=./application.css yarn test - only: - changes: - - app/assets/stylesheets/*.scss - - app/assets/stylesheets/**/*.scss - - app/assets/stylesheets/**/**/*.scss - except: - refs: - - /(^docs[\/-].*|.*-docs$)/ - - master - variables: - - $CI_COMMIT_MESSAGE =~ /\[skip visual\]/i - artifacts: - paths: - - tests/__image_snapshots__/ - -karma: - <<: *dedicated-no-docs-pull-cache-job - <<: *use-pg - dependencies: - - compile-assets - - setup-test-env - variables: - # we override the max_old_space_size to prevent OOM errors - NODE_OPTIONS: --max_old_space_size=3584 - script: - - export BABEL_ENV=coverage CHROME_LOG_FILE=chrome_debug.log - - date - - scripts/gitaly-test-spawn - - date - - bundle exec rake karma - coverage: '/^Statements *: (\d+\.\d+%)/' - artifacts: - name: coverage-javascript - expire_in: 31d - when: always - paths: - - chrome_debug.log - - coverage-javascript/ - reports: - junit: junit_karma.xml - -jest: - <<: *dedicated-no-docs-and-no-qa-pull-cache-job - <<: *use-pg - dependencies: - - compile-assets - - setup-test-env - script: - - scripts/gitaly-test-spawn - - date - - bundle exec rake karma:fixtures - - date - - yarn jest --ci --coverage - artifacts: - name: coverage-frontend - expire_in: 31d - when: always - paths: - - coverage-frontend/ - - junit_jest.xml - reports: - junit: junit_jest.xml - cache: - key: jest - paths: - - tmp/jest/jest/ - -code_quality: - <<: *dedicated-no-docs-no-db-pull-cache-job - # gitlab-org runners set `privileged: false` but we need to have it set to true - # since we're using Docker in Docker - tags: [] - before_script: [] - cache: {} - dependencies: [] - variables: - SETUP_DB: "false" - -sast: - <<: *dedicated-no-docs-no-db-pull-cache-job - image: docker:stable - variables: - SAST_CONFIDENCE_LEVEL: 2 - DOCKER_DRIVER: overlay2 - allow_failure: true - tags: [] - before_script: [] - cache: {} - dependencies: [] - services: - - docker:stable-dind - script: - - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - - docker run - --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}" - --volume "$PWD:/code" - --volume /var/run/docker.sock:/var/run/docker.sock - "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code - artifacts: - reports: - sast: gl-sast-report.json - -dependency_scanning: - <<: *dedicated-no-docs-no-db-pull-cache-job - image: docker:stable - variables: - DOCKER_DRIVER: overlay2 - allow_failure: true - tags: [] - before_script: [] - cache: {} - dependencies: [] - services: - - docker:stable-dind - script: - - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - - docker run - --env DEP_SCAN_DISABLE_REMOTE_CHECKS="${DEP_SCAN_DISABLE_REMOTE_CHECKS:-false}" - --volume "$PWD:/code" - --volume /var/run/docker.sock:/var/run/docker.sock - "registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code - artifacts: - reports: - dependency_scanning: gl-dependency-scanning-report.json - -qa:internal: - <<: *dedicated-no-docs-no-db-pull-cache-job - services: [] - script: - - cd qa/ - - bundle install - - bundle exec rspec - -qa:selectors: - <<: *dedicated-no-docs-no-db-pull-cache-job - services: [] - script: - - cd qa/ - - bundle install - - bundle exec bin/qa Test::Sanity::Selectors - -.qa-frontend-node: &qa-frontend-node - <<: *dedicated-no-docs-no-db-pull-cache-job - stage: test - cache: - key: "$CI_JOB_NAME" - paths: - - .yarn-cache/ - dependencies: [] - before_script: [] - script: - - date - - yarn install --frozen-lockfile --cache-folder .yarn-cache - - date - - yarn run webpack-prod - -qa-frontend-node:8: - <<: *qa-frontend-node - image: node:8-alpine - -qa-frontend-node:10: - <<: *qa-frontend-node - image: node:10-alpine - -qa-frontend-node:latest: - <<: *qa-frontend-node - image: node:alpine - allow_failure: true - -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 - <<: *dedicated-runner - <<: *except-docs-and-qa - <<: *pull-cache - variables: - SETUP_DB: "false" - stage: post-test - script: - - bundle exec scripts/merge-simplecov - coverage: '/LOC \((\d+\.\d+%)\) covered.$/' - artifacts: - name: coverage - expire_in: 31d - paths: - - coverage/index.html - - coverage/assets/ - -lint:javascript:report: - <<: *dedicated-no-docs-and-no-qa-pull-cache-job - stage: post-test - dependencies: [] - before_script: [] - script: - - date - - yarn run eslint-report || true # ignore exit code - artifacts: - name: eslint-report - expire_in: 31d - paths: - - eslint-report.html - -jsdoc: - <<: *dedicated-no-docs-pull-cache-job - stage: post-test - dependencies: - - compile-assets - before_script: [] - script: - - date - - yarn run jsdoc || true # ignore exit code - artifacts: - name: jsdoc - expire_in: 31d - paths: - - jsdoc/ - -pages: - <<: *dedicated-no-docs-no-db-pull-cache-job - before_script: [] - stage: pages - dependencies: - - coverage - - karma - - gitlab:assets:compile - - lint:javascript:report - - jsdoc - script: - - mv public/ .public/ - - mkdir public/ - - mv coverage/ public/coverage-ruby/ || true - - mv coverage-javascript/ public/coverage-javascript/ || true - - mv eslint-report.html public/ || true - - mv webpack-report/ public/webpack-report/ || true - - cp .public/assets/application-*.css public/application.css || true - - cp .public/assets/application-*.css.gz public/application.css.gz || true - - mv jsdoc/ public/jsdoc/ || true - artifacts: - paths: - - public - only: - - master@gitlab-org/gitlab-ce - - master@gitlab-org/gitlab-ee - -# Insurance in case a gem needed by one of our releases gets yanked from -# rubygems.org in the future. -cache gems: - <<: *dedicated-no-docs-no-db-pull-cache-job - script: - - bundle package --all --all-platforms - artifacts: - paths: - - vendor/cache - only: - - master@gitlab-org/gitlab-ce - - master@gitlab-org/gitlab-ee - - tags - -gitlab_git_test: - <<: *dedicated-runner - <<: *except-docs-and-qa - variables: - SETUP_DB: "false" - before_script: [] - dependencies: [] - cache: {} - script: - - spec/support/prepare-gitlab-git-test-for-commit --check-for-changes - -no_ee_check: - <<: *dedicated-runner - <<: *except-docs-and-qa - variables: - SETUP_DB: "false" - before_script: [] - dependencies: [] - cache: {} - script: - - scripts/no-ee-check - only: - - /.+/@gitlab-org/gitlab-ce - -# GitLab Review apps -.review-build-cng-base: &review-build-cng-base - image: ruby:2.5-alpine - stage: test - before_script: [] - dependencies: [] - cache: {} - variables: - API_TOKEN: "${GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN}" - script: - - apk add --update openssl curl jq - - gem install gitlab --no-document - - source ./scripts/review_apps/review-apps.sh - - wait_for_job_to_be_done "gitlab:assets:compile" - - BUILD_TRIGGER_TOKEN=$REVIEW_APPS_BUILD_TRIGGER_TOKEN ./scripts/trigger-build cng - -review-build-cng: - <<: *review-only - <<: *review-build-cng-base - -schedule:review-build-cng: - <<: *review-schedules-only - <<: *review-build-cng-base - -.review-deploy-base: &review-deploy-base - <<: *review-base - allow_failure: true - variables: - HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}" - DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}" - GITLAB_HELM_CHART_REF: "master" - API_TOKEN: "${GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN}" - environment: - <<: *review-environment - on_stop: review-stop - before_script: - - export GITLAB_SHELL_VERSION=$( ${FLAKY_RSPEC_REPORT_PATH}' + - '[[ -f $NEW_FLAKY_RSPEC_REPORT_PATH ]] || echo "{}" > ${NEW_FLAKY_RSPEC_REPORT_PATH}' + - scripts/gitaly-test-spawn + - knapsack rspec "--color --format documentation --format RspecJunitFormatter --out junit_rspec.xml" + artifacts: + expire_in: 31d + when: always + paths: + - coverage/ + - knapsack/ + - rspec_flaky/ + - rspec_profiling/ + - tmp/capybara/ + reports: + junit: junit_rspec.xml + except: + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ + +.rspec-metadata-pg: &rspec-metadata-pg + <<: *rspec-metadata + <<: *use-pg + +.rspec-metadata-pg-10: &rspec-metadata-pg-10 + <<: *rspec-metadata + <<: *use-pg-10 + image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-golang-1.11-git-2.21-chrome-73.0-node-10.x-yarn-1.12-postgresql-10-graphicsmagick-1.3.29" + +.rspec-metadata-mysql: &rspec-metadata-mysql + <<: *rspec-metadata + <<: *use-mysql + +# DB migration, rollback, and seed jobs +.db-migrate-reset: &db-migrate-reset + extends: .dedicated-no-docs-and-no-qa-pull-cache-job + script: + - bundle exec rake db:migrate:reset + dependencies: + - setup-test-env + +.migration-paths: &migration-paths + extends: .dedicated-no-docs-and-no-qa-pull-cache-job + variables: + SETUP_DB: "false" + script: + - git fetch https://gitlab.com/gitlab-org/gitlab-ce.git v9.3.0 + - git checkout -f FETCH_HEAD + - sed -i "s/gem 'oj', '~> 2.17.4'//" Gemfile + - bundle update google-protobuf grpc + - bundle install $BUNDLE_INSTALL_FLAGS + - date + - cp config/gitlab.yml.example config/gitlab.yml + - bundle exec rake db:drop db:create db:schema:load db:seed_fu + - date + - git checkout -f $CI_COMMIT_SHA + - bundle install $BUNDLE_INSTALL_FLAGS + - date + - . scripts/prepare_build.sh + - date + - bundle exec rake db:migrate + dependencies: + - setup-test-env + +setup-test-env: + extends: .dedicated-runner-default-cache + <<: *use-pg + stage: prepare + script: + - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' + - scripts/gitaly-test-build # Do not use 'bundle exec' here + artifacts: + expire_in: 7d + paths: + - tmp/tests + - config/secrets.yml + - vendor/gitaly-ruby + except: + - /(^docs[\/-].*|.*-docs$)/ + +rspec-pg: + <<: *rspec-metadata-pg + parallel: 50 + +rspec-pg-10: + <<: *rspec-metadata-pg-10 + <<: *only-schedules-master + parallel: 50 + +rspec-mysql: + <<: *rspec-metadata-mysql + <<: *only-schedules-master + parallel: 50 + +rspec-fast-spec-helper: + <<: *rspec-metadata-pg + script: + - bundle exec rspec spec/fast_spec_helper.rb + +.rspec-quarantine: &rspec-quarantine + <<: *only-schedules-master + script: + - export CACHE_CLASSES=true + - scripts/gitaly-test-spawn + - bin/rspec --color --format documentation --tag quarantine spec/ + +rspec-pg-quarantine: + <<: *rspec-metadata-pg + <<: *rspec-quarantine + allow_failure: true + +rspec-mysql-quarantine: + <<: *rspec-metadata-mysql + <<: *rspec-quarantine + allow_failure: true + +static-analysis: + extends: .dedicated-no-docs-no-db-pull-cache-job + dependencies: + - compile-assets + - setup-test-env + script: + - scripts/static-analysis + cache: + key: "debian-stretch-ruby-2.5.3-node-10.x-and-rubocop" + paths: + - vendor/ruby + - .yarn-cache/ + - tmp/rubocop_cache + policy: pull-push + +downtime_check: + <<: *rake-exec + except: + - master + - tags + - /^[\d-]+-stable(-ee)?$/ + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ + dependencies: + - setup-test-env + +ee_compat_check: + <<: *rake-exec + dependencies: [] + except: + - master + - tags + - /[\d-]+-stable(-ee)?/ + - /^security-/ + - branches@gitlab-org/gitlab-ee + - branches@gitlab/gitlab-ee + retry: 0 + artifacts: + name: "${CI_JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT_SHA}" + when: always + expire_in: 10d + paths: + - ee_compat_check/patches/*.patch + +db:migrate:reset-pg: + <<: *db-migrate-reset + <<: *use-pg + +db:migrate:reset-mysql: + <<: *db-migrate-reset + <<: *use-mysql + +db:check-schema-pg: + <<: *db-migrate-reset + <<: *use-pg + script: + - source scripts/schema_changed.sh + +migration:path-pg: + <<: *migration-paths + <<: *use-pg + +migration:path-mysql: + <<: *migration-paths + <<: *use-mysql + +.db-rollback: &db-rollback + extends: .dedicated-no-docs-and-no-qa-pull-cache-job + script: + - bundle exec rake db:migrate VERSION=20170523121229 + - bundle exec rake db:migrate + dependencies: + - setup-test-env + +db:rollback-pg: + <<: *db-rollback + <<: *use-pg + +db:rollback-mysql: + <<: *db-rollback + <<: *use-mysql + +gitlab:setup-pg: + <<: *gitlab-setup + <<: *use-pg + dependencies: + - setup-test-env + +gitlab:setup-mysql: + <<: *gitlab-setup + <<: *use-mysql + dependencies: + - setup-test-env + +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: .dedicated-runner-default-cache + cache: + policy: pull + variables: + SETUP_DB: "false" + stage: post-test + script: + - bundle exec scripts/merge-simplecov + coverage: '/LOC \((\d+\.\d+%)\) covered.$/' + artifacts: + name: coverage + expire_in: 31d + paths: + - coverage/index.html + - coverage/assets/ + except: + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ diff --git a/.gitlab/ci/reports.gitlab-ci.yml b/.gitlab/ci/reports.gitlab-ci.yml new file mode 100644 index 0000000000..d0e09dbf2f --- /dev/null +++ b/.gitlab/ci/reports.gitlab-ci.yml @@ -0,0 +1,98 @@ +include: + - template: Code-Quality.gitlab-ci.yml + +code_quality: + extends: .dedicated-no-docs-no-db-pull-cache-job + # gitlab-org runners set `privileged: false` but we need to have it set to true + # since we're using Docker in Docker + tags: [] + before_script: [] + cache: {} + dependencies: [] + variables: + SETUP_DB: "false" + +sast: + extends: .dedicated-no-docs-no-db-pull-cache-job + image: docker:stable + variables: + SAST_CONFIDENCE_LEVEL: 2 + DOCKER_DRIVER: overlay2 + allow_failure: true + tags: [] + before_script: [] + cache: {} + dependencies: [] + services: + - docker:stable-dind + script: + - | # 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 + } + - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') + - | + docker run \ + $(propagate_env_vars \ + SAST_ANALYZER_IMAGES \ + SAST_ANALYZER_IMAGE_PREFIX \ + SAST_ANALYZER_IMAGE_TAG \ + SAST_DEFAULT_ANALYZERS \ + SAST_BRAKEMAN_LEVEL \ + SAST_GOSEC_LEVEL \ + SAST_FLAWFINDER_LEVEL \ + SAST_DOCKER_CLIENT_NEGOTIATION_TIMEOUT \ + SAST_PULL_ANALYZER_IMAGE_TIMEOUT \ + SAST_RUN_ANALYZER_TIMEOUT \ + ) \ + --volume "$PWD:/code" \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code + artifacts: + reports: + sast: gl-sast-report.json + +dependency_scanning: + extends: .dedicated-no-docs-no-db-pull-cache-job + image: docker:stable + variables: + DOCKER_DRIVER: overlay2 + allow_failure: true + tags: [] + before_script: [] + cache: {} + dependencies: [] + services: + - docker:stable-dind + script: + - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') + - | # 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 \ + DEP_SCAN_DISABLE_REMOTE_CHECKS \ + DS_DOCKER_CLIENT_NEGOTIATION_TIMEOUT \ + DS_PULL_ANALYZER_IMAGE_TIMEOUT \ + DS_RUN_ANALYZER_TIMEOUT \ + ) \ + --volume "$PWD:/code" \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + "registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code + artifacts: + reports: + dependency_scanning: gl-dependency-scanning-report.json diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml new file mode 100644 index 0000000000..ae16549ef6 --- /dev/null +++ b/.gitlab/ci/review.gitlab-ci.yml @@ -0,0 +1,233 @@ +.review-only: &review-only + only: + refs: + - branches@gitlab-org/gitlab-ce + - branches@gitlab-org/gitlab-ee + kubernetes: active + except: + refs: + - master + - /(^docs[\/-].*|.*-docs$)/ + +.review-schedules-only: &review-schedules-only + only: + refs: + - schedules@gitlab-org/gitlab-ce + - schedules@gitlab-org/gitlab-ee + kubernetes: active + variables: + - $REVIEW_APP_CLEANUP + except: + refs: + - tags + - /(^docs[\/-].*|.*-docs$)/ + +.review-base: &review-base + extends: .dedicated-runner + <<: *review-only + image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base + cache: {} + dependencies: [] + before_script: + - source scripts/utils.sh + +.review-docker: &review-docker + <<: *review-base + image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine + services: + - docker:stable-dind + tags: + - gitlab-org + - docker + variables: &review-docker-variables + DOCKER_DRIVER: overlay2 + DOCKER_HOST: tcp://docker:2375 + LATEST_QA_IMAGE: "gitlab/${CI_PROJECT_NAME}-qa:nightly" + QA_IMAGE: "${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/${CI_PROJECT_NAME}-qa:${CI_COMMIT_REF_SLUG}" + +build-qa-image: + <<: *review-docker + stage: test + script: + - time docker build --cache-from ${LATEST_QA_IMAGE} --tag ${QA_IMAGE} ./qa/ + - echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY} + - time docker push ${QA_IMAGE} + +.review-build-cng-base: &review-build-cng-base + image: ruby:2.5-alpine + stage: test + when: manual + before_script: + - source scripts/utils.sh + - install_api_client_dependencies_with_apk + - install_gitlab_gem + dependencies: [] + cache: {} + script: + - BUILD_TRIGGER_TOKEN=$REVIEW_APPS_BUILD_TRIGGER_TOKEN ./scripts/trigger-build cng + +review-build-cng: + <<: *review-only + <<: *review-build-cng-base + +schedule:review-build-cng: + <<: *review-schedules-only + <<: *review-build-cng-base + +.review-deploy-base: &review-deploy-base + <<: *review-base + stage: review + retry: 2 + allow_failure: true + variables: + HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}" + DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}" + GITLAB_HELM_CHART_REF: "master" + environment: &review-environment + name: review/${CI_COMMIT_REF_NAME} + url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN} + on_stop: review-stop + before_script: + - export GITLAB_SHELL_VERSION=$( review_app_url.txt + - source scripts/utils.sh + - install_api_client_dependencies_with_apk + - source scripts/review_apps/review-apps.sh + script: + - perform_review_app_deployment + artifacts: + paths: + - review_app_url.txt + expire_in: 2 days + when: always + +review-deploy: + <<: *review-deploy-base + +schedule:review-deploy: + <<: *review-deploy-base + <<: *review-schedules-only + script: + - perform_review_app_deployment + +review-stop: + <<: *review-base + stage: review + when: manual + allow_failure: true + variables: + GIT_DEPTH: "1" + environment: + <<: *review-environment + action: stop + script: + - source scripts/review_apps/review-apps.sh + - delete + - cleanup + +.review-qa-base: &review-qa-base + <<: *review-docker + stage: qa + allow_failure: true + variables: + <<: *review-docker-variables + QA_ARTIFACTS_DIR: "${CI_PROJECT_DIR}/qa" + QA_CAN_TEST_GIT_PROTOCOL_V2: "false" + GITLAB_USERNAME: "root" + GITLAB_PASSWORD: "${REVIEW_APPS_ROOT_PASSWORD}" + GITLAB_ADMIN_USERNAME: "root" + GITLAB_ADMIN_PASSWORD: "${REVIEW_APPS_ROOT_PASSWORD}" + GITHUB_ACCESS_TOKEN: "${REVIEW_APPS_QA_GITHUB_ACCESS_TOKEN}" + EE_LICENSE: "${REVIEW_APPS_EE_LICENSE}" + QA_DEBUG: "true" + dependencies: + - review-deploy + artifacts: + paths: + - ./qa/gitlab-qa-run-* + expire_in: 7 days + when: always + before_script: + - export CI_ENVIRONMENT_URL="$(cat review_app_url.txt)" + - echo "${CI_ENVIRONMENT_URL}" + - echo "${QA_IMAGE}" + - source scripts/utils.sh + - install_api_client_dependencies_with_apk + - gem install gitlab-qa --no-document ${GITLAB_QA_VERSION:+ --version ${GITLAB_QA_VERSION}} + +review-qa-smoke: + <<: *review-qa-base + retry: 2 + script: + - gitlab-qa Test::Instance::Smoke "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" + +review-qa-all: + <<: *review-qa-base + when: manual + script: + - gitlab-qa Test::Instance::Any "${QA_IMAGE}" "${CI_ENVIRONMENT_URL}" + +.review-performance-base: &review-performance-base + <<: *review-qa-base + stage: qa + 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 + +review-performance: + <<: *review-performance-base + +schedule:review-performance: + <<: *review-performance-base + <<: *review-schedules-only + dependencies: + - schedule:review-deploy + +schedule:review-cleanup: + <<: *review-base + <<: *review-schedules-only + stage: build + allow_failure: true + environment: + name: review/auto-cleanup + action: stop + before_script: + - source scripts/utils.sh + - install_gitlab_gem + script: + - ruby -rrubygems scripts/review_apps/automated_cleanup.rb + +danger-review: + extends: .dedicated-pull-cache-job + image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger + stage: test + dependencies: [] + before_script: [] + only: + variables: + - $DANGER_GITLAB_API_TOKEN + except: + refs: + - master + variables: + - $CI_COMMIT_REF_NAME =~ /^ce-to-ee-.*/ + - $CI_COMMIT_REF_NAME =~ /.*-stable(-ee)?-prepare-.*/ + script: + - git version + - node --version + - yarn install --frozen-lockfile --cache-folder .yarn-cache + - danger --fail-on-errors=true diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml new file mode 100644 index 0000000000..debc90a1cb --- /dev/null +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -0,0 +1,43 @@ +# Insurance in case a gem needed by one of our releases gets yanked from +# rubygems.org in the future. +cache gems: + extends: .dedicated-no-docs-no-db-pull-cache-job + script: + - bundle package --all --all-platforms + artifacts: + paths: + - vendor/cache + only: + - master@gitlab-org/gitlab-ce + - master@gitlab-org/gitlab-ee + - tags + dependencies: + - setup-test-env + +gitlab_git_test: + extends: .dedicated-runner + variables: + SETUP_DB: "false" + before_script: [] + dependencies: [] + cache: {} + script: + - spec/support/prepare-gitlab-git-test-for-commit --check-for-changes + except: + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ + +no_ee_check: + extends: .dedicated-runner + variables: + SETUP_DB: "false" + before_script: [] + dependencies: [] + cache: {} + script: + - scripts/no-ee-check + only: + - /.+/@gitlab-org/gitlab-ce + except: + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ diff --git a/.gitlab/ci/test-metadata.gitlab-ci.yml b/.gitlab/ci/test-metadata.gitlab-ci.yml new file mode 100644 index 0000000000..3ba7af956b --- /dev/null +++ b/.gitlab/ci/test-metadata.gitlab-ci.yml @@ -0,0 +1,82 @@ +.tests-metadata-state: &tests-metadata-state + extends: .dedicated-runner + variables: + TESTS_METADATA_S3_BUCKET: "gitlab-ce-cache" + before_script: + - source scripts/utils.sh + artifacts: + expire_in: 31d + paths: + - knapsack/ + - rspec_flaky/ + - rspec_profiling/ + +retrieve-tests-metadata: + <<: *tests-metadata-state + stage: prepare + cache: + key: tests_metadata + policy: pull + script: + - mkdir -p knapsack/${CI_PROJECT_NAME}/ + - wget -O $KNAPSACK_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$KNAPSACK_RSPEC_SUITE_REPORT_PATH || rm $KNAPSACK_RSPEC_SUITE_REPORT_PATH + - '[[ -f $KNAPSACK_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${KNAPSACK_RSPEC_SUITE_REPORT_PATH}' + - mkdir -p rspec_flaky/ + - 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}' + except: + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ + +update-tests-metadata: + <<: *tests-metadata-state + stage: post-test + cache: + key: tests_metadata + paths: + - knapsack/ + - rspec_flaky/ + policy: push + script: + - retry gem install fog-aws mime-types activesupport rspec_profiling postgres-copy --no-document + - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec-pg_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} + - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH' + - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $FLAKY_RSPEC_SUITE_REPORT_PATH' + - rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json + - rm -f rspec_flaky/all_*.json rspec_flaky/new_*.json + - scripts/insert-rspec-profiling-data + only: + - master@gitlab-org/gitlab-ce + - master@gitlab-org/gitlab-ee + - master@gitlab/gitlabhq + - master@gitlab/gitlab-ee + +flaky-examples-check: + extends: .dedicated-runner + image: ruby:2.5-alpine + services: [] + before_script: [] + variables: + SETUP_DB: "false" + USE_BUNDLE_INSTALL: "false" + NEW_FLAKY_SPECS_REPORT: rspec_flaky/report-new.json + stage: post-test + allow_failure: true + retry: 0 + only: + - branches + except: + - master + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ + artifacts: + expire_in: 30d + paths: + - rspec_flaky/ + script: + - '[[ -f $NEW_FLAKY_SPECS_REPORT ]] || echo "{}" > ${NEW_FLAKY_SPECS_REPORT}' + - scripts/merge-reports ${NEW_FLAKY_SPECS_REPORT} rspec_flaky/new_*_*.json + - scripts/detect-new-flaky-examples $NEW_FLAKY_SPECS_REPORT diff --git a/.gitlab/issue_templates/Database Reviewer.md b/.gitlab/issue_templates/Database Reviewer.md index a5e7e42fd1..acbaf5c196 100644 --- a/.gitlab/issue_templates/Database Reviewer.md +++ b/.gitlab/issue_templates/Database Reviewer.md @@ -1,6 +1,8 @@ #### Database Reviewer Checklist -Thank you for becoming a ~database reviewer! Please work on the list below to complete your setup. For any question, reach out to #database an mention @abrandl. +Thank you for becoming a ~database reviewer! Please work on the list +below to complete your setup. For any question, reach out to #database +an mention `@abrandl`. - [ ] Change issue title to include your name: `Database Reviewer Checklist: Your Name` - [ ] Review general [code review guide](https://docs.gitlab.com/ee/development/code_review.html) @@ -12,7 +14,7 @@ Thank you for becoming a ~database reviewer! Please work on the list below to co - [ ] Read [Understanding EXPLAIN plans](https://docs.gitlab.com/ee/development/understanding_explain_plans.html) - [ ] Review [database best practices](https://docs.gitlab.com/ee/development/#best-practices) - [ ] Review how we use [database instances restored from a backup](https://ops.gitlab.net/gitlab-com/gl-infra/gitlab-restore/postgres-gprd) for testing and make sure you're set up to execute pipelines (check [README.md](https://ops.gitlab.net/gitlab-com/gl-infra/gitlab-restore/postgres-gprd/blob/master/README.md) and reach out to @abrandl since this is currently subject to being changed) -- [ ] Get yourself added to [@gl-database](https://gitlab.com/groups/gl-database/-/group_members) group and respond to @-mentions to the group (reach out to any maintainer on the group to get added). You will get TODOs on gitlab.com for group mentions. +- [ ] Get yourself added to [`@gl-database`](https://gitlab.com/groups/gl-database/-/group_members) group and respond to @-mentions to the group (reach out to any maintainer on the group to get added). You will get TODOs on gitlab.com for group mentions. - [ ] Make sure you have proper access to at least a read-only replica in staging and production - [ ] Indicate in `data/team.yml` your role as a database reviewer ([example MR](https://gitlab.com/gitlab-com/www-gitlab-com/merge_requests/19600/diffs)). Assign MR to your manager for merge. - [ ] Send one MR to improve the [review documentation](https://about.gitlab.com/handbook/engineering/workflow/code-review/database.html) or the [issue template](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.gitlab/issue_templates/Database%20Reviewer.md) @@ -25,7 +27,7 @@ You're all set! Watch out for TODOs on GitLab.com. ###### Where to go for questions? -Reach out to `#database` on Slack and mention @abrandl for any questions. +Reach out to `#database` on Slack and mention `@abrandl` for any questions. cc @abrandl diff --git a/.gitlab/issue_templates/Refactoring.md b/.gitlab/issue_templates/Refactoring.md new file mode 100644 index 0000000000..cd0ce8486f --- /dev/null +++ b/.gitlab/issue_templates/Refactoring.md @@ -0,0 +1,41 @@ +## Summary + + + +## Improvements + + + +## Risks + + + +## Involved components + + + +## Optional: Intended side effects + + + + +## Optional: Missing test coverage + + + +/label ~backstage diff --git a/.haml-lint.yml b/.haml-lint.yml index bad918ef35..e9cc4a91a2 100644 --- a/.haml-lint.yml +++ b/.haml-lint.yml @@ -97,6 +97,7 @@ linters: - Cop/LineBreakAroundConditionalBlock - Cop/ProjectPathHelper - GitlabSecurity/PublicSend + - Layout/EmptyLineAfterGuardClause - Layout/LeadingCommentSpace - Layout/SpaceAfterColon - Layout/SpaceAfterComma @@ -112,11 +113,13 @@ linters: - Lint/LiteralInInterpolation - Lint/ParenthesesAsGroupedExpression - Lint/RedundantWithIndex + - Lint/SafeNavigationConsistency - Lint/Syntax - Metrics/BlockNesting - Naming/VariableName - Performance/RedundantMatch - Performance/StringReplacement + - Rails/LinkToBlank - Rails/Presence - Rails/RequestReferer - Style/AndOr @@ -134,6 +137,7 @@ linters: - Style/TernaryParentheses - Style/TrailingCommaInHashLiteral - Style/UnlessElse + - Style/UnneededCondition - Style/WordArray - Style/ZeroLengthPredicate diff --git a/.rubocop.yml b/.rubocop.yml index 648d59e806..e5fe527e61 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -75,6 +75,7 @@ Naming/FileName: - 'qa/spec/**/*' - 'qa/qa/specs/**/*' - 'qa/bin/*' + - 'ee/bin/*' - 'config/**/*' - 'ee/config/**/*' - 'lib/generators/**/*' @@ -204,3 +205,9 @@ Style/ReturnNil: # nil values on the left hand side Performance/RegexpMatch: Enabled: false + +ActiveRecordAssociationReload: + Enabled: true + Exclude: + - 'spec/**/*' + - 'ee/spec/**/*' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 77ad4753c8..63b1685fed 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,42 +1,154 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-01-18 18:23:26 +0100 using RuboCop version 0.52.1. +# on 2019-05-04 16:01:00 +0000 using RuboCop version 0.68.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 181 +# Offense count: 264 Capybara/CurrentPathExpectation: Enabled: false -# Offense count: 167 +# Offense count: 1097 # Cop supports --auto-correct. -Layout/EmptyLinesAroundArguments: +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/AlignArguments: Enabled: false -# Offense count: 83 +# Offense count: 824 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/AlignHash: + Enabled: false + +# Offense count: 13 +# Cop supports --auto-correct. +Layout/ClosingHeredocIndentation: + Exclude: + - 'app/graphql/mutations/merge_requests/set_wip.rb' + - 'ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb' + - 'ee/db/migrate/20160204190809_update_jenkins_service_category.rb' + - 'ee/lib/gitlab/background_migration/prune_orphaned_geo_events.rb' + - 'ee/lib/gitlab/geo/health_check.rb' + - 'lib/gitlab/background_migration/populate_untracked_uploads.rb' + - 'qa/qa/service/kubernetes_cluster.rb' + - 'spec/features/merge_request/user_sees_diff_spec.rb' + - 'spec/lib/gitlab/asciidoc_spec.rb' + - 'spec/lib/gitlab/checks/project_moved_spec.rb' + - 'spec/rubocop/cop/active_record_association_reload_spec.rb' + - 'spec/services/task_list_toggle_service_spec.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +Layout/ClosingParenthesisIndentation: + Exclude: + - 'db/post_migrate/20180704145007_update_project_indexes.rb' + - 'ee/db/geo/migrate/20180405074130_add_partial_index_project_repository_verification.rb' + - 'ee/db/migrate/20180308234102_add_partial_index_to_project_repository_states_checksum_columns.rb' + - 'ee/db/post_migrate/20180605213516_fix_partial_index_to_project_repository_states_checksum_columns.rb' + - 'ee/lib/ee/gitlab/usage_data.rb' + - 'spec/services/issues/resolve_discussions_spec.rb' + - 'spec/services/projects/update_service_spec.rb' + - 'spec/support/helpers/stub_object_storage.rb' + - 'spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: leading, trailing +Layout/DotPosition: + Exclude: + - 'app/models/concerns/relative_positioning.rb' + - 'app/models/group.rb' + +# Offense count: 69 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundArguments: + Exclude: + - 'app/models/concerns/discussion_on_diff.rb' + - 'app/models/concerns/resolvable_discussion.rb' + - 'app/models/diff_discussion.rb' + - 'app/models/discussion.rb' + - 'ee/app/helpers/license_helper.rb' + - 'ee/spec/models/geo/project_registry_spec.rb' + - 'lib/banzai/pipeline/broadcast_message_pipeline.rb' + - 'lib/banzai/pipeline/gfm_pipeline.rb' + - 'lib/banzai/pipeline/single_line_pipeline.rb' + - 'spec/features/markdown/copy_as_gfm_spec.rb' + +# Offense count: 160 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_brackets -Layout/IndentArray: +Layout/IndentFirstArrayElement: Enabled: false -# Offense count: 237 +# Offense count: 631 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_braces -Layout/IndentHash: +Layout/IndentFirstHashElement: Enabled: false -# Offense count: 93 +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: consistent, align_parentheses +Layout/IndentFirstParameter: + Exclude: + - 'app/models/ci/pipeline_schedule.rb' + - 'lib/gitlab/cross_project_access.rb' + - 'lib/gitlab/data_builder/push.rb' + - 'spec/support/helpers/repo_helpers.rb' + - 'spec/support/helpers/stub_object_storage.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Layout/LeadingBlankLines: + Exclude: + - 'app/workers/update_project_statistics_worker.rb' + - 'db/migrate/20161007073613_create_user_activities.rb' + - 'ee/spec/helpers/boards_helper_spec.rb' + - 'lib/tasks/yarn.rake' + - 'spec/javascripts/fixtures/merge_requests_diffs.rb' + +# Offense count: 30 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/MultilineOperationIndentation: + Enabled: false + +# Offense count: 13 +# Cop supports --auto-correct. +Layout/RescueEnsureAlignment: + Exclude: + - 'app/models/blob_viewer/dependency_manager.rb' + - 'app/models/ci/pipeline.rb' + - 'app/models/project.rb' + - 'app/services/prometheus/proxy_service.rb' + - 'app/workers/delete_stored_files_worker.rb' + - 'app/workers/reactive_caching_worker.rb' + - 'config/initializers/1_settings.rb' + - 'config/initializers/trusted_proxies.rb' + - 'ee/db/migrate/20151113115819_canonicalize_kerberos_identities.rb' + - 'lib/gitlab/background_migration/archive_legacy_traces.rb' + - 'lib/gitlab/highlight.rb' + - 'lib/tasks/gitlab/lfs/migrate.rake' + +# Offense count: 344 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: require_no_space, require_space Layout/SpaceInLambdaLiteral: Enabled: false -# Offense count: 327 +# Offense count: 583 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. # SupportedStyles: space, no_space @@ -44,20 +156,27 @@ Layout/SpaceInLambdaLiteral: Layout/SpaceInsideBlockBraces: Enabled: false -# Offense count: 156 +# Offense count: 255 # Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space Layout/SpaceInsideParens: Enabled: false -# Offense count: 26 +# Offense count: 1 +Lint/DisjunctiveAssignmentInConstructor: + Exclude: + - 'app/models/uploads/base.rb' + +# Offense count: 19 Lint/DuplicateMethods: Exclude: - - 'app/models/application_setting.rb' - 'app/models/commit.rb' - 'app/models/note.rb' - - 'app/services/merge_requests/merge_service.rb' - 'lib/bitbucket/representation/repo.rb' - 'lib/declarative_policy/base.rb' + - 'lib/gitlab/auth/ldap/person.rb' + - 'lib/gitlab/auth/o_auth/user.rb' - 'lib/gitlab/ci/build/artifacts/metadata/entry.rb' - 'lib/gitlab/cycle_analytics/base_event_fetcher.rb' - 'lib/gitlab/diff/formatters/base_formatter.rb' @@ -65,22 +184,34 @@ Lint/DuplicateMethods: - 'lib/gitlab/git/repository.rb' - 'lib/gitlab/git/tree.rb' - 'lib/gitlab/git/wiki_page.rb' - - 'lib/gitlab/auth/ldap/person.rb' - - 'lib/gitlab/auth/o_auth/user.rb' -# Offense count: 4 +# Offense count: 2 Lint/InterpolationCheck: Exclude: - 'spec/features/issues/filtered_search/filter_issues_spec.rb' - - 'spec/features/users_spec.rb' - 'spec/services/quick_actions/interpret_service_spec.rb' -# Offense count: 206 +# Offense count: 326 # Configuration parameters: MaximumRangeSize. Lint/MissingCopEnableDirective: Enabled: false -# Offense count: 9 +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Whitelist. +# Whitelist: present?, blank?, presence, try, try! +Lint/SafeNavigationConsistency: + Exclude: + - 'lib/gitlab/gpg/commit.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Lint/ToJSON: + Exclude: + - 'lib/gitlab/cycle_analytics/usage_data.rb' + - 'lib/gitlab/template/base_template.rb' + +# Offense count: 7 Lint/UriEscapeUnescape: Exclude: - 'app/controllers/application_controller.rb' @@ -88,13 +219,25 @@ Lint/UriEscapeUnescape: - 'spec/lib/google_api/auth_spec.rb' - 'spec/requests/api/files_spec.rb' - 'spec/requests/api/internal_spec.rb' - - 'spec/requests/api/issues_spec.rb' # Offense count: 1 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'lib/gitlab/git/diff_collection.rb' + +# Offense count: 158 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: - Max: 1310 + Max: 176 + +# Offense count: 94 +# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Enabled: false # Offense count: 11 # Configuration parameters: EnforcedStyle. @@ -107,61 +250,85 @@ Naming/HeredocDelimiterCase: - 'spec/support/helpers/repo_helpers.rb' - 'spec/support/helpers/seed_repo.rb' -# Offense count: 112 +# Offense count: 197 # Configuration parameters: Blacklist. -# Blacklist: END, (?-mix:EO[A-Z]{1}) +# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) Naming/HeredocDelimiterNaming: Enabled: false +# Offense count: 125 +# Cop supports --auto-correct. +# Configuration parameters: PreferredName. +Naming/RescuedExceptionsVariableName: + Enabled: false -# Offense count: 3821 +# Offense count: 6 +# Cop supports --auto-correct. +Performance/InefficientHashSearch: + Exclude: + - 'app/controllers/concerns/sessionless_authentication.rb' + - 'app/models/note.rb' + - 'app/models/user_preference.rb' + - 'ee/app/models/ee/project.rb' + - 'lib/gitlab/import_export/members_mapper.rb' + - 'qa/spec/spec_helper.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Performance/ReverseEach: + Exclude: + - 'app/models/commit.rb' + - 'db/migrate/20190222051615_add_indexes_for_merge_request_diffs_query.rb' + - 'lib/gitlab/profiler.rb' + +# Offense count: 7081 # Configuration parameters: Prefixes. # Prefixes: when, with, without RSpec/ContextWording: Enabled: false -# Offense count: 293 +# Offense count: 407 +# Cop supports --auto-correct. RSpec/EmptyLineAfterFinalLet: Enabled: false -# Offense count: 188 +# Offense count: 232 +# Cop supports --auto-correct. RSpec/EmptyLineAfterSubject: Enabled: false -# Offense count: 258 +# Offense count: 719 +# Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: method_call, block RSpec/ExpectChange: Enabled: false -# Offense count: 221 +# Offense count: 512 RSpec/ExpectInHook: Enabled: false -# Offense count: 19 +# Offense count: 10 +# Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: it_behaves_like, it_should_behave_like RSpec/ItBehavesLike: Exclude: - 'spec/lib/gitlab/git/commit_spec.rb' - 'spec/lib/gitlab/git/repository_spec.rb' - - 'spec/lib/gitlab/shell_spec.rb' - 'spec/services/notification_service_spec.rb' - - 'spec/workers/git_garbage_collect_worker_spec.rb' -# Offense count: 5 +# Offense count: 3 RSpec/IteratedExpectation: Exclude: - 'spec/features/admin/admin_settings_spec.rb' - - 'spec/features/merge_requests/diff_notes_resolve_spec.rb' - - 'spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb' - 'spec/lib/gitlab/gitlab_import/client_spec.rb' - 'spec/lib/gitlab/legacy_github_import/client_spec.rb' -# Offense count: 75 +# Offense count: 68 +# Cop supports --auto-correct. RSpec/LetBeforeExamples: Exclude: - - 'spec/controllers/projects/commit_controller_spec.rb' - 'spec/lib/banzai/filter/issue_reference_filter_spec.rb' - 'spec/lib/banzai/filter/user_reference_filter_spec.rb' - 'spec/lib/gitlab/email/handler/create_issue_handler_spec.rb' @@ -170,12 +337,11 @@ RSpec/LetBeforeExamples: - 'spec/models/commit_range_spec.rb' - 'spec/models/milestone_spec.rb' - 'spec/models/project_services/packagist_service_spec.rb' - - 'spec/models/repository_spec.rb' - 'spec/rubocop/cop/migration/update_column_in_batches_spec.rb' - 'spec/serializers/pipeline_details_entity_spec.rb' - - 'spec/views/ci/lints/show.html.haml_spec.rb' # Offense count: 1 +# Cop supports --auto-correct. RSpec/MultipleSubjects: Exclude: - 'spec/services/merge_requests/create_from_issue_service_spec.rb' @@ -188,95 +354,136 @@ RSpec/OverwritingSetup: - 'spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb' - 'spec/services/notes/quick_actions_service_spec.rb' -# Offense count: 965 +# Offense count: 1828 +# Cop supports --auto-correct. # Configuration parameters: Strict, EnforcedStyle. # SupportedStyles: inflected, explicit RSpec/PredicateMatcher: Enabled: false -# Offense count: 35 +# Offense count: 57 RSpec/RepeatedExample: Enabled: false -# Offense count: 140 +# Offense count: 474 +# Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: and_return, block RSpec/ReturnFromStub: Enabled: false -# Offense count: 112 +# Offense count: 188 RSpec/ScatteredLet: Enabled: false -# Offense count: 22 +# Offense count: 10 RSpec/ScatteredSetup: Exclude: - 'spec/controllers/projects/templates_controller_spec.rb' - 'spec/lib/gitlab/bitbucket_import/importer_spec.rb' - - 'spec/lib/gitlab/git/env_spec.rb' - 'spec/requests/api/jobs_spec.rb' - 'spec/services/projects/create_service_spec.rb' # Offense count: 1 +# Cop supports --auto-correct. RSpec/SharedContext: Exclude: - 'spec/features/admin/admin_groups_spec.rb' -# Offense count: 5 +# Offense count: 4 RSpec/VoidExpect: Exclude: - - 'spec/features/projects/artifacts/download_spec.rb' - 'spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb' - 'spec/models/ci/group_spec.rb' - 'spec/models/ci/runner_spec.rb' - 'spec/services/users/destroy_service_spec.rb' -# Offense count: 41 +# Offense count: 8 +# Cop supports --auto-correct. +Rails/BelongsTo: + Exclude: + - 'app/models/deployment.rb' + - 'app/models/environment.rb' + - 'ee/app/models/prometheus_alert.rb' + - 'ee/app/models/prometheus_alert_event.rb' + +# Offense count: 80 # Configuration parameters: Include. # Include: db/migrate/*.rb Rails/CreateTableWithTimestamps: Enabled: false -# Offense count: 155 +# Offense count: 222 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: slashes, arguments Rails/FilePath: Enabled: false -# Offense count: 121 +# Offense count: 167 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasManyOrHasOneDependent: Enabled: false -# Offense count: 157 +# Offense count: 40 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: numeric, symbolic +Rails/HttpStatus: + Enabled: false + +# Offense count: 2 +# Configuration parameters: Include. +# Include: app/controllers/**/*.rb +Rails/IgnoredSkipActionFilterOption: + Exclude: + - 'app/controllers/projects/snippets_controller.rb' + - 'app/controllers/snippets_controller.rb' + +# Offense count: 87 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/InverseOf: Enabled: false -# Offense count: 48 +# Offense count: 46 # Configuration parameters: Include. # Include: app/controllers/**/*.rb Rails/LexicallyScopedActionFilter: Enabled: false -# Offense count: 14 +# Offense count: 4 +# Cop supports --auto-correct. +Rails/LinkToBlank: + Exclude: + - 'app/helpers/projects_helper.rb' + - 'app/helpers/wiki_helper.rb' + - 'ee/app/helpers/ee/user_callouts_helper.rb' + - 'ee/app/helpers/license_helper.rb' + +# Offense count: 11 # Cop supports --auto-correct. Rails/Presence: Exclude: - - 'app/controllers/projects/blob_controller.rb' - 'app/models/ci/pipeline.rb' - 'app/models/clusters/platforms/kubernetes.rb' - 'app/models/concerns/mentionable.rb' - - 'app/models/concerns/token_authenticatable.rb' - 'app/models/project_services/hipchat_service.rb' - 'app/models/project_services/irker_service.rb' - 'app/models/project_services/jira_service.rb' - 'app/models/project_services/kubernetes_service.rb' - 'app/models/project_services/packagist_service.rb' - 'app/models/wiki_page.rb' - - 'lib/gitlab/git/hook.rb' - 'lib/gitlab/github_import/importer/releases_importer.rb' +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/RedundantAllowNil: + Exclude: + - 'app/models/application_setting.rb' + # Offense count: 2 # Configuration parameters: Include. # Include: db/migrate/*.rb @@ -284,8 +491,8 @@ Rails/ReversibleMigration: Exclude: - 'db/migrate/20160824103857_drop_unused_ci_tables.rb' -# Offense count: 446 -# Configuration parameters: Blacklist. +# Offense count: 860 +# Configuration parameters: Blacklist, Whitelist. # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters Rails/SkipsModelValidations: Enabled: false @@ -297,21 +504,25 @@ Rails/UnknownEnv: Exclude: - 'db/migrate/20171124125748_populate_missing_merge_request_statuses.rb' -# Offense count: 13 +# Offense count: 11 # Cop supports --auto-correct. Security/YAMLLoad: Exclude: - - 'config/initializers/carrierwave.rb' - 'lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits.rb' - 'lib/gitlab/redis/wrapper.rb' - 'lib/system_check/incoming_email/imap_authentication_check.rb' - 'spec/config/mail_room_spec.rb' - 'spec/initializers/secret_token_spec.rb' - 'spec/lib/gitlab/prometheus/additional_metrics_parser_spec.rb' - - 'spec/models/clusters/platforms/kubernetes_spec.rb' - 'spec/models/project_services/kubernetes_service_spec.rb' -# Offense count: 64 +# Offense count: 34 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: inline, group +Style/AccessModifierDeclarations: + Enabled: false + +# Offense count: 121 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: percent_q, bare_percent @@ -324,17 +535,13 @@ Style/CommentedKeyword: - 'lib/tasks/gitlab/backup.rake' - 'spec/tasks/gitlab/backup_rake_spec.rb' -# Offense count: 30 -Style/DateTime: - Enabled: false - # Offense count: 1 # Cop supports --auto-correct. Style/Dir: Exclude: - 'qa/qa.rb' -# Offense count: 9 +# Offense count: 7 # Cop supports --auto-correct. Style/EachWithObject: Exclude: @@ -345,46 +552,42 @@ Style/EachWithObject: - 'lib/gitlab/i18n/po_linter.rb' - 'lib/gitlab/import_export/members_mapper.rb' - 'lib/gitlab/import_export/relation_factory.rb' - - 'scripts/static-analysis' -# Offense count: 24 +# Offense count: 34 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: empty, nil, both Style/EmptyElse: Enabled: false -# Offense count: 14 +# Offense count: 11 # Cop supports --auto-correct. Style/EmptyLambdaParameter: Exclude: - 'app/models/ci/build.rb' - 'app/models/ci/runner.rb' -# Offense count: 12 +# Offense count: 9 # Cop supports --auto-correct. Style/EmptyLiteral: Exclude: - - 'features/steps/project/commits/commits.rb' - 'lib/gitlab/fogbugz_import/importer.rb' - 'lib/gitlab/git/diff_collection.rb' - 'lib/gitlab/gitaly_client.rb' - - 'scripts/trigger-build' - - 'spec/features/merge_requests/versions_spec.rb' - 'spec/helpers/merge_requests_helper_spec.rb' - 'spec/lib/gitlab/request_context_spec.rb' - 'spec/lib/gitlab/workhorse_spec.rb' - 'spec/requests/api/jobs_spec.rb' - 'spec/support/shared_examples/chat_slash_commands_shared_examples.rb' -# Offense count: 102 +# Offense count: 180 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: compact, expanded Style/EmptyMethod: Enabled: false -# Offense count: 23 +# Offense count: 40 # Cop supports --auto-correct. Style/Encoding: Enabled: false @@ -394,52 +597,52 @@ Style/EvalWithLocation: Exclude: - 'app/models/service.rb' -# Offense count: 35 +# Offense count: 203 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: format, sprintf, percent Style/FormatString: Enabled: false -# Offense count: 384 +# Offense count: 669 # Configuration parameters: MinBodyLength. Style/GuardClause: Enabled: false -# Offense count: 22 +# Offense count: 27 Style/IfInsideElse: Enabled: false -# Offense count: 809 +# Offense count: 1346 # Cop supports --auto-correct. Style/IfUnlessModifier: Enabled: false -# Offense count: 75 +# Offense count: 186 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: line_count_dependent, lambda, literal Style/Lambda: Enabled: false -# Offense count: 11 +# Offense count: 3 # Cop supports --auto-correct. Style/LineEndConcatenation: Exclude: - - 'app/helpers/tree_helper.rb' - - 'spec/features/issuables/markdown_references_spec.rb' - - 'spec/lib/gitlab/checks/project_moved_spec.rb' - 'spec/lib/gitlab/gfm/reference_rewriter_spec.rb' - 'spec/lib/gitlab/incoming_email_spec.rb' # Offense count: 18 -Style/MethodMissing: +Style/MethodMissingSuper: Enabled: false -# Offense count: 7 +# Offense count: 18 +Style/MissingRespondToMissing: + Enabled: false + +# Offense count: 6 Style/MixinUsage: Exclude: - - 'features/support/env.rb' - 'spec/factories/ci/builds.rb' - 'spec/factories/ci/job_artifacts.rb' - 'spec/factories/lfs_objects.rb' @@ -447,59 +650,63 @@ Style/MixinUsage: - 'spec/lib/gitlab/import_export/project_tree_restorer_spec.rb' - 'spec/lib/gitlab/import_export/version_checker_spec.rb' -# Offense count: 6 +# Offense count: 4 # Cop supports --auto-correct. Style/MultilineIfModifier: Exclude: - 'app/helpers/snippets_helper.rb' - 'app/models/project_wiki.rb' - 'app/services/ci/process_pipeline_service.rb' - - 'app/services/create_deployment_service.rb' - 'lib/api/commit_statuses.rb' - - 'lib/gitlab/ci/trace.rb' -# Offense count: 25 +# Offense count: 72 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Enabled: false + +# Offense count: 28 # Cop supports --auto-correct. # Configuration parameters: Whitelist. # Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with Style/NestedParenthesizedCalls: Enabled: false -# Offense count: 19 +# Offense count: 31 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, MinBodyLength. # SupportedStyles: skip_modifier_ifs, always Style/Next: Enabled: false -# Offense count: 61 +# Offense count: 67 # Cop supports --auto-correct. # Configuration parameters: EnforcedOctalStyle. # SupportedOctalStyles: zero_with_o, zero_only Style/NumericLiteralPrefix: Enabled: false -# Offense count: 114 +# Offense count: 186 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle. +# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. # SupportedStyles: predicate, comparison Style/NumericPredicate: Enabled: false -# Offense count: 4 +# Offense count: 2 # Cop supports --auto-correct. Style/OrAssignment: Exclude: - - 'app/models/concerns/token_authenticatable.rb' - 'lib/api/commit_statuses.rb' - 'lib/gitlab/project_transfer.rb' -# Offense count: 50 +# Offense count: 79 # Cop supports --auto-correct. Style/ParallelAssignment: Enabled: false -# Offense count: 917 +# Offense count: 1390 # Cop supports --auto-correct. # Configuration parameters: PreferredDelimiters. Style/PercentLiteralDelimiters: @@ -521,25 +728,20 @@ Style/PerlBackrefs: - 'lib/gitlab/search_results.rb' - 'lib/gitlab/sherlock/query.rb' -# Offense count: 87 +# Offense count: 129 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: compact, exploded Style/RaiseArgs: Enabled: false -# Offense count: 9 +# Offense count: 3 # Cop supports --auto-correct. Style/RedundantBegin: Exclude: - - 'app/controllers/projects/clusters/gcp_controller.rb' - 'app/models/merge_request.rb' - 'app/services/projects/import_service.rb' - - 'lib/api/branches.rb' - - 'lib/gitlab/current_settings.rb' - - 'lib/gitlab/git/commit.rb' - 'lib/gitlab/health_checks/base_abstract_check.rb' - - 'lib/tasks/gitlab/task_helpers.rb' # Offense count: 1 # Cop supports --auto-correct. @@ -547,7 +749,7 @@ Style/RedundantConditional: Exclude: - 'lib/system_check/helpers.rb' -# Offense count: 57 +# Offense count: 360 # Cop supports --auto-correct. Style/RedundantFreeze: Enabled: false @@ -567,41 +769,36 @@ Style/RedundantReturn: - 'lib/gitlab/utils.rb' - 'lib/google_api/auth.rb' -# Offense count: 460 +# Offense count: 700 # Cop supports --auto-correct. Style/RedundantSelf: Enabled: false -# Offense count: 142 +# Offense count: 28 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, AllowInnerSlashes. # SupportedStyles: slashes, percent_r, mixed Style/RegexpLiteral: - Enabled: true - EnforcedStyle: mixed - AllowInnerSlashes: false + Enabled: false -# Offense count: 36 +# Offense count: 41 # Cop supports --auto-correct. Style/RescueModifier: Enabled: false -# Offense count: 107 +# Offense count: 197 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, explicit Style/RescueStandardError: Enabled: false -# Offense count: 8 +# Offense count: 5 # Cop supports --auto-correct. Style/SelfAssignment: Exclude: - 'app/models/concerns/bulk_member_access_load.rb' - 'app/serializers/base_serializer.rb' - - 'app/services/notification_service.rb' - - 'lib/api/runners.rb' - - 'spec/features/merge_requests/diff_notes_resolve_spec.rb' - 'spec/features/projects/clusters/interchangeability_spec.rb' - 'spec/support/import_export/configuration_helper.rb' @@ -612,7 +809,7 @@ Style/SingleLineMethods: Exclude: - 'lib/gitlab/ci/ansi2html.rb' -# Offense count: 66 +# Offense count: 91 # Cop supports --auto-correct. # Configuration parameters: . # SupportedStyles: use_perl_names, use_english_names @@ -625,21 +822,21 @@ Style/StderrPuts: Exclude: - 'config/initializers/rspec_profiling.rb' -# Offense count: 45 +# Offense count: 65 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: single_quotes, double_quotes Style/StringLiteralsInInterpolation: Enabled: false -# Offense count: 106 +# Offense count: 187 # Cop supports --auto-correct. # Configuration parameters: IgnoredMethods. # IgnoredMethods: respond_to, define_method Style/SymbolProc: Enabled: false -# Offense count: 9 +# Offense count: 7 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, AllowSafeAssignment. # SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex @@ -647,45 +844,65 @@ Style/TernaryParentheses: Exclude: - 'app/finders/projects_finder.rb' - 'app/helpers/namespaces_helper.rb' - - 'features/support/capybara.rb' - 'lib/gitlab/ci/build/artifacts/metadata/entry.rb' - 'spec/requests/api/pipeline_schedules_spec.rb' - 'spec/support/capybara.rb' -# Offense count: 17 +# Offense count: 3 # Cop supports --auto-correct. -# Configuration parameters: AllowNamedUnderscoreVariables. -Style/TrailingUnderscoreVariable: +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: Exclude: - - 'app/controllers/admin/background_jobs_controller.rb' - - 'app/controllers/invites_controller.rb' - - 'app/helpers/tab_helper.rb' - - 'lib/backup/manager.rb' - - 'lib/gitlab/logger.rb' - - 'lib/gitlab/upgrader.rb' - - 'lib/system_check/app/migrations_are_up_check.rb' - - 'lib/system_check/incoming_email/mail_room_running_check.rb' - - 'lib/tasks/gitlab/check.rake' - - 'lib/tasks/gitlab/task_helpers.rb' - - 'spec/lib/gitlab/etag_caching/middleware_spec.rb' - - 'spec/services/quick_actions/interpret_service_spec.rb' + - 'spec/features/markdown/copy_as_gfm_spec.rb' -# Offense count: 4 +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'ee/spec/models/project_spec.rb' + - 'spec/lib/gitlab/diff/position_tracer_spec.rb' + - 'spec/lib/gitlab/metrics/dashboard/processor_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: + Exclude: + - 'lib/gitlab/ci/ansi2html.rb' + - 'lib/gitlab/kubernetes.rb' + +# Offense count: 2 # Cop supports --auto-correct. Style/UnlessElse: Exclude: - 'lib/backup/manager.rb' - 'lib/gitlab/project_search_results.rb' - - 'lib/tasks/gitlab/check.rake' - - 'spec/features/issues/award_emoji_spec.rb' -# Offense count: 31 +# Offense count: 10 +# Cop supports --auto-correct. +Style/UnneededCondition: + Exclude: + - 'app/helpers/button_helper.rb' + - 'app/helpers/environment_helper.rb' + - 'app/models/project.rb' + - 'app/services/issuable/clone/base_service.rb' + - 'app/services/prometheus/adapter_service.rb' + - 'lib/gitlab/email/message/repository_push.rb' + - 'lib/gitlab/prometheus_client.rb' + - 'spec/lib/rspec_flaky/flaky_example_spec.rb' + +# Offense count: 73 # Cop supports --auto-correct. Style/UnneededInterpolation: Enabled: false -# Offense count: 22840 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 1310 +# Offense count: 2 +# Cop supports --auto-correct. +Style/UnneededSort: + Exclude: + - 'app/models/concerns/resolvable_discussion.rb' + - 'lib/gitlab/highlight.rb' diff --git a/.stylelintrc b/.stylelintrc index 59ee0e879e..b0ace93e04 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -2,7 +2,7 @@ "plugins":[ "./scripts/frontend/stylelint/stylelint-duplicate-selectors.js", "./scripts/frontend/stylelint/stylelint-utility-classes.js", - "stylelint-scss", + "stylelint-scss" ], "rules":{ "at-rule-blacklist":[ @@ -94,7 +94,7 @@ { "message":"Selector should be written in lowercase with hyphens (selector-class-pattern)", "severity": "warning" - }, + } ], "selector-list-comma-newline-after":"always", "selector-max-compound-selectors":[3, { "severity": "warning" }], @@ -104,8 +104,8 @@ "selector-pseudo-element-no-unknown":true, "shorthand-property-no-redundant-values":true, "string-quotes":"single", - "value-no-vendor-prefix":[true, { ignoreValues: ["sticky"] }], + "value-no-vendor-prefix":[true, { "ignoreValues": ["sticky"] }], "stylelint-gitlab/duplicate-selectors":[true,{ "severity": "warning" }], - "stylelint-gitlab/utility-classes":[true,{ "severity": "warning" }], + "stylelint-gitlab/utility-classes":[true,{ "severity": "warning" }] } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d73e94d73..d7f4e80078 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,60 +2,82 @@ documentation](doc/development/changelog.md) for instructions on adding your own entry. -## 11.10.8 (2019-06-27) +## 11.11.7 + +### Security (9 changes) + +- Restrict slash commands to users who can log in. +- Patch XSS issue in wiki links. +- Filter merge request params on the new merge request page. +- Fix Server Side Request Forgery mitigation bypass. +- Show badges if pipelines are public otherwise default to project permissions. +- Do not allow localhost url redirection in GitHub Integration. +- Do not show moved issue id for users that cannot read issue. +- Use source project as permissions reference for MergeRequestsController#pipelines. +- Drop feature to take ownership of trigger token. + + +## 11.11.6 + +- Unreleased due to QA failure. + +## 11.11.5 (2019-06-27) -- No changes. ### Security (10 changes) -- Fix Denial of Service for comments when rendering issues/MR comments. -- Gate MR head_pipeline behind read_pipeline ability. +- Disable Rails SQL query cache when applying service templates. !30060 +- Add missing authorizations in GraphQL. - Fix DoS vulnerability in color validation regex. - Expose merge requests count based on user access. -- Persist tmp snippet uploads at users. -- Add missing authorizations in GraphQL. -- Disable Rails SQL query cache when applying service templates. +- Fix Denial of Service for comments when rendering issues/MR comments. +- Gate MR head_pipeline behind read_pipeline ability. - Prevent Billion Laughs attack. - Correctly check permissions when creating snippet notes. - Prevent the detection of merge request templates by unauthorized users. - -### Performance (1 change) - -- Add improvements to global search of issues and merge requests. !27817 +- Persist tmp snippet uploads at users. -## 11.10.7 (2019-06-26) +## 11.11.4 (2019-06-26) ### Fixed (3 changes) -- Remove a default git depth in Pipelines for merge requests. !28926 -- Fix label click scrolling to top. !29202 +- Fix Fogbugz Importer not working. !29383 - Fix scrolling to top on assignee change. !29500 +- Fix IDE commit using latest ref in branch and overriding contents. !29769 -## 11.10.6 (2019-06-04) +## 11.11.3 (2019-06-10) -### Fixed (7 changes, 1 of them is from the community) +### Fixed (5 changes) -- Allow a member to have an access level equal to parent group. !27913 -- Fix uploading of LFS tracked file through UI. !28052 -- Use 3-way merge for squashing commits. !28078 -- Use a path for the related merge requests endpoint. !28171 -- Fix project visibility level validation. !28305 (Peter Marko) -- Fix Rugged get_tree_entries recursive flag not working. !28494 +- Fix invalid visibility string comparison in project import. !28612 +- Remove a default git depth in Pipelines for merge requests. !28926 +- Fix connection to Tiller error while uninstalling. !29131 +- Fix label click scrolling to top. !29202 +- Make OpenID Connect work without requiring a name. !29312 + + +## 11.11.2 (2019-06-04) + +### Fixed (7 changes) + +- Update SAST.gitlab-ci.yml - Add SAST_GITLEAKS_ENTROPY_LEVEL. !28607 +- Fix OmniAuth OAuth2Generic strategy not loading. !28680 - Use source ref in pipeline webhook. !28772 +- Fix migration failure when groups are missing route. !29022 +- Stop two-step rebase from hanging when errors occur. !29068 +- Fix project settings not being able to update. !29097 +- Fix display of 'Promote to group label' button. ### Other (1 change) - Fix input group height. -## 11.10.5 (2019-05-30) +## 11.11.1 (2019-05-30) -### Security (12 changes, 1 of them is from the community) +### Security (12 changes) -- Protect Gitlab::HTTP against DNS rebinding attack. -- Fix project visibility level validation. (Peter Marko) -- Update Knative version. - Add DNS rebinding protection settings. - Prevent XSS injection in note imports. - Prevent invalid branch for merge request. @@ -63,10 +85,198 @@ entry. - Fix confidential issue label disclosure on milestone view. - Fix url redaction for issue links. - Resolve: Milestones leaked via search API. +- Protect Gitlab::HTTP against DNS rebinding attack. +- Add extra fields for handling basic auth on import by url page. - Prevent bypass of restriction disabling web password sign in. +- Update Gitaly to fix GetArchive vulnerability. - Hide confidential issue title on unsubscribe for anonymous users. +## 11.11.0 (2019-05-22) + +### Security (1 change) + +- Destroy project remote mirrors instead of disabling. !27087 + +### Fixed (74 changes, 19 of them are from the community) + +- Don't create a temp reference for branch comparisons within project. !24038 +- Fix some label links not appearing on group labels page and label title being a link on project labels page. !24060 (Tanya Pazitny) +- Fix extra emails for custom notifications. !25607 +- Rewind IID on Ci::Pipelines. !26490 +- Fix duplicate merge request pipelines created by Sidekiq worker retry. !26643 +- Catch and report OpenSSL exceptions while fetching external configuration files in CI::Config. !26750 (Drew Cimino) +- stop rendering download links for expired artifacts on the project tags page. !26753 (Drew Cimino) +- Format extra help page text like wiki. !26782 (Bastian Blank) +- Always show instance configuration link. !26783 (Bastian Blank) +- Display maximum artifact size from runtime config. !26784 (Bastian Blank) +- Resolve issue where list labels did not have the correct text color on creation. !26794 (Tucker Chapman) +- Set release name when adding release notes to an existing tag. !26807 +- Fix the bug that the project statistics is not updated. !26854 (Hiroyuki Sato) +- Client side changes for ListLastCommitsForTree response update. !26880 +- Fix api group visibility. !26896 +- Require all templates to use default stages. !26954 +- Remove a "reopen merge request button" on a "merged" merge request. !26965 (Hiroyuki Sato) +- Fix misaligned image diff swipe view. !26969 (ftab) +- Add badge-pill class on group member count. !27019 +- Remove leading / trailing spaces from heading when generating header ids. !27025 (Willian Balmant) +- Respect updated_at attribute in notes produced by API calls. !27124 (Ben Gamari) +- Fix GitHub project import visibility. !27133 (Daniel Wyatt) +- Fixes actions dropdowns in environments page. !27160 +- Fixes create button background for Environments form. !27161 +- Display scoped labels in Issue Boards. !27164 +- Align UrlValidator to validate_url gem implementation. !27194 (Horatiu Eugen Vlad) +- Resolve Web IDE template dropdown showing duplicates. !27237 +- Update GitLab Workhorse to v8.6.0. !27260 +- Only show in autocomplete when author active. !27292 +- Remove deadline for Git fsck. !27299 +- Show prioritized labels to guests. !27307 +- Properly expire all pipeline caches when pipeline is deleted. !27334 +- Replaced icon for external URL with doc-text icon. !27365 +- Add auto direction for issue title. !27378 (Ahmad Haghighi) +- fix wiki search result links in titles. !27400 (khm) +- Fix system notes timestamp when creating issue in the past. !27406 +- Fix approvals sometimes being reset after a merge request is rebased. !27446 +- Fix empty block in MR widget when user doesn't have permission. !27462 +- Fix wrong use of ActiveRecord in PoolRepository. !27464 +- Show proper preview for uploaded images in Web IDE. !27471 +- Resolve Renaming an image via Web IDE corrupts it. !27486 +- Clean up CarrierWave's import/export files. !27487 +- Fix autocomplete dropdown for usernames starting with period. !27533 (Jan Beckmann) +- Disable password autocomplete in mirror repository form. !27542 +- Always use internal ID tables in development and production. !27544 +- Only show the "target branch has advanced" message when the merge request is open. !27588 +- Resolve Misalignment on suggested changes diff table. !27612 +- Update Workhorse to v8.7.0. !27630 +- Fix FE API and IDE handling of '/' relative_url_root. !27635 +- Hide ScopedBadge overflow notes. !27651 +- Fix base domain help text update. !27746 +- Upgrade letter_opener_web to support Rails 5.1. !27829 +- Fix webpack assets handling when relative url root is '/'. !27909 +- Fix IDE get file data with '/' as relative root. !27911 +- Allow a member to have an access level equal to parent group. !27913 +- Fix issuables state_id nil when importing projects from GitHub. !28027 +- Fix uploading of LFS tracked file through UI. !28052 +- Render Next badge only for gitlab.com. !28056 +- Fix update head pipeline process of Pipelines for merge requests. !28057 +- Fix visual issues in set status modal. !28147 +- Use a path for the related merge requests endpoint. !28171 +- disable SSH key validation in key details view. !28180 (Roger Meier) +- Fix MR discussion border missing in chrome sometimes. !28185 +- Fix Error 500 when inviting user already present. !28198 +- Remove non-semantic use of `.row` in member listing controls. !28204 +- Properly handle LFS Batch API response in project import. !28223 +- Fix project visibility level validation. !28305 (Peter Marko) +- Fix incorrect prefix used in new uploads for personal snippets. !28337 +- Fix Rugged get_tree_entries recursive flag not working. !28494 +- Fixes next badge being always visible. +- Next badge must visible when canary flag is true. +- Adds arrow icons to select option in CI/CD settings. +- Vertically aligns the play button for stages. +- Allow replying to individual notes from API. + +### Changed (19 changes, 3 of them are from the community) + +- Sort by due date and popularity in both directions for Issues and Merge requests. !25502 (Nermin Vehabovic) +- Improve pipelines table spacing, add triggerer column. !26136 +- Allow extra arguments in helm commands when deploying the application in Auto-DevOps.gitlab-ci.yml. !26171 (tortuetorche) +- Switch to sassc-rails for faster stylesheet compilation. !26224 +- Reorganize project merge request settings. !26834 +- Display a toast message when the Kubernetes runner has successfully upgraded. !27206 +- Allow guests users to access project releases. !27247 +- Add help texts to K8 form fields. !27274 +- Support prometheus for group level clusters. !27280 +- Include link to raw job log in plain-text emails. !27409 +- Only escape Markdown emphasis characters in autocomplete when necessary. !27457 +- Move location of charts/auto-deploy-app -> gitlab-org/charts/auto-deploy-app. !27477 +- Make canceled jobs not retryable. !27503 +- Upgrade to Gitaly v1.36.0. !27831 +- Update deployment event chat notification message. !27972 +- Upgrade to Gitaly v1.42.0. !28135 +- Resolve discussion when apply suggestion. !28160 +- Improve expanding diff to full file performance. +- Knative version bump 0.3 -> 0.5. (Chris Baumbauer ) + +### Performance (5 changes) + +- Added list_pages method to avoid loading all wiki pages content. !22801 +- Add gitaly session id & catfile-cache feature flag. !27472 +- Add improvements to global search of issues and merge requests. !27817 +- Disable method replacement in avatar loading. !27866 +- Fix Blob.lazy always loading all previously-requested blobs when a new request is made. + +### Added (36 changes, 10 of them are from the community) + +- Add time preferences for user. !25381 +- Added write_repository scope for personal access token. !26021 (Horatiu Eugen Vlad) +- Mark disabled pages domains for removal, but don't remove them yet. !26212 +- Remove pages domains if they weren't verified for 1 week. !26227 +- Expose pipeline variables via API. !26501 (Agustin Henze ) +- Download a folder from repository. !26532 (kiameisomabes) +- Remove cleaned up OIDs from database and cache. !26555 +- Disables kubernetes resources creation if a cluster is not managed. !26565 +- Add CI_COMMIT_REF_PROTECTED CI variable. !26716 (Jason van den Hurk) +- Add new API endpoint to expose a single environment. !26887 +- Allow Sentry configuration to be passed on gitlab.yml. !27091 (Roger Meier) +- CI variables of type file. !27112 +- Allow linking to a private helm repository by providing credentials, and customisation of repository name. !27123 (Stuart Moore @stjm-cc) +- Add time tracking information to Issue Boards sidebar. !27166 +- Play all manual jobs in a stage. !27188 +- Instance level kubernetes clusters. !27196 +- Adds if InfluxDB and Prometheus metrics are enabled to usage ping data. !27238 +- Autosave description in epics. !27296 +- Add deployment events to chat notification services. !27338 +- Add packages_size to ProjectStatistics. !27373 +- Added OmniAuth OpenID Connect strategy. !27383 (Horatiu Eugen Vlad) +- Test using Git 2.21. !27418 +- Use official Gitea logo in importer. !27424 (Matti Ranta (@techknowlogick)) +- Add option to set access_level of runners upon registration. !27490 (Zelin L) +- Add initial GraphQL query for Groups. !27492 +- Enable Sidekiq Reliable Fetcher for background jobs by default. !27530 +- Add backend support for a External Dashboard URL setting. !27550 +- Implement UI for uninstalling Cluster’s managed apps. !27559 +- Resolve Salesforce.com omniauth support. !27834 +- Leave project/group from access granted email. !27892 +- Allow Sentry client-side DSN to be passed on gitlab.yml. !27967 +- GraphQL: improve evaluation of query complexity based on arguments and query limits. !28017 +- Adds badge for Canary environment and help link. +- Support negative matches. +- Show category icons in user popover. +- Added Omniauth UltraAuth strategy to GitLab. (Kartikey Tanna) + +### Other (29 changes, 8 of them are from the community) + +- Validate refs used in controllers don't have spaces. !24037 +- Migrate correlation and tracing code to LabKit. !25379 +- Update node.js to 10.15.3 in CI template for Hexo. !25943 (Takuya Noguchi) +- Improve icons and button order in project overview. !26796 +- Add instructions on how to contribute a Built-In template for project. !26976 +- Extract DiscussionNotes component from NoteableDiscussion. !27066 +- Bump gRPC to 1.19.0 and protobuf to 3.7.1. !27086 +- Extract DiscussionActions component from NoteableDiscussion. !27227 +- Show disabled project repo mirrors in settings. !27326 +- Add backtrace to Gitaly performance bar. !27345 +- Moved EE/CE differences for dropdown_value_collapsed into CE. !27367 +- Remove "You are already signed in" banner. !27377 +- Move ee-specific code from boards/components/issue_card_inner.vue. !27394 (Roman Rodionov) +- Upgrade to Rails 5.1. !27480 (Jasper Maes) +- Update GitLab Runner Helm Chart to 0.4.0. !27508 +- Update GitLab Runner Helm Chart to 0.4.1. !27627 +- Refactored notes tests from Karma to Jest. !27648 (Martin Hobert) +- refactor(issue): Refactored issue tests from Karma to Jest. !27673 (Martin Hobert) +- Refactored Karma spec files to Jest. !27688 (Martin Hobert) +- Add CSS fix for elements on IE11. !27846 +- Update clair-local-scan to v2.0.8 for container scanning. !27977 +- Use PostgreSQL 10.7 in tests. !28020 +- Document EE License Auto Import During Install. !28106 +- Remove the note in the docs that multi-line suggestions are not yet available. !28119 (hardysim) +- Update gitlab-shell to v9.1.0. !28184 +- Add EE fixtures to SeedFu list. !28241 +- Replaces CSS with BS4 utility class for pipeline schedules. +- Creates a vendors folder for external CSS. +- Add some frozen string to spec/**/*.rb. (gfyoung) + + ## 11.10.4 (2019-05-01) ### Fixed (12 changes) @@ -358,6 +568,44 @@ entry. - Removes EE differences for environment_item.vue. +## 11.9.10 (2019-04-26) + +### Security (5 changes) + +- Loosen regex for exception sanitization. !3077 +- Resolve: moving an issue to private repo leaks namespace and project name. +- Escape path in new merge request mail. +- Stop sending emails to users who can't read commit. +- Upgrade Rails to 5.0.7.2. + + +## 11.9.9 (2019-04-23) + +### Performance (1 change) + +- Bring back Rugged implementation of ListCommitsByOid. !27441 + + +## 11.9.8 (2019-04-11) + +### Deprecated (1 change) + +- Allow to use untrusted Regexp via feature flag. !26905 + +### Performance (2 changes) + +- Improve performance of PR import. !27121 +- Disable method instrumentation for diffs. !27235 + +### Other (1 change) + +- Restore HipChat project service. !27172 + + +## 11.9.7 (2019-04-09) + +- No changes. + ## 11.9.6 (2019-04-04) ### Fixed (3 changes) @@ -689,6 +937,35 @@ entry. - Removes EE differences for jobs/getters.js. +## 11.8.10 (2019-04-30) + +### Security (1 change) + +- Allow to see project events only with api scope token. + + +## 11.8.8 (2019-04-23) + +### Fixed (5 changes) + +- Bring back Rugged implementation of find_commit. !25477 +- Fix bug in BitBucket imports with SHA shorter than 40 chars. !26050 +- Fix health checks not working behind load balancers. !26055 +- Fix error creating a merge request when diff includes a null byte. !26190 +- Avoid excessive recursive calls with Rugged TreeEntries. !26813 + +### Performance (1 change) + +- Bring back Rugged implementation of ListCommitsByOid. !27441 + +### Other (4 changes) + +- Bring back Rugged implementation of GetTreeEntries. !25674 +- Bring back Rugged implementation of CommitIsAncestor. !25702 +- Bring back Rugged implementation of TreeEntry. !25706 +- Bring back Rugged implementation of commit_tree_entry. !25896 + + ## 11.8.3 (2019-03-19) ### Security (1 change) @@ -958,6 +1235,29 @@ entry. - Creates mixin to reduce code duplication between CE and EE in graph component. +## 11.7.12 (2019-04-23) + +### Fixed (2 changes) + +- Bring back Rugged implementation of find_commit. !25477 +- Avoid excessive recursive calls with Rugged TreeEntries. !26813 + +### Performance (1 change) + +- Bring back Rugged implementation of ListCommitsByOid. !27441 + +### Other (4 changes) + +- Bring back Rugged implementation of GetTreeEntries. !25674 +- Bring back Rugged implementation of CommitIsAncestor. !25702 +- Bring back Rugged implementation of TreeEntry. !25706 +- Bring back Rugged implementation of commit_tree_entry. !25896 + + +## 11.7.11 (2019-04-09) + +- No changes. + ## 11.7.10 (2019-03-28) ### Security (7 changes) @@ -1229,6 +1529,30 @@ entry. - Update url placeholder for the sentry configuration page. !24338 +## 11.6.11 (2019-04-23) + +### Security (2 changes) + +- Fixed ability to see private groups by users not belonging to given group. +- Fix XSS in resolve conflicts form. + +### Fixed (2 changes) + +- Bring back Rugged implementation of find_commit. !25477 +- Avoid excessive recursive calls with Rugged TreeEntries. !26813 + +### Performance (1 change) + +- Bring back Rugged implementation of ListCommitsByOid. !27441 + +### Other (4 changes) + +- Bring back Rugged implementation of GetTreeEntries. !25674 +- Bring back Rugged implementation of CommitIsAncestor. !25702 +- Bring back Rugged implementation of TreeEntry. !25706 +- Bring back Rugged implementation of commit_tree_entry. !25896 + + ## 11.6.10 (2019-02-28) ### Security (21 changes) @@ -1600,6 +1924,25 @@ entry. - Enable Rubocop on lib/gitlab. (gfyoung) +## 11.5.11 (2019-04-23) + +### Fixed (2 changes) + +- Bring back Rugged implementation of find_commit. !25477 +- Avoid excessive recursive calls with Rugged TreeEntries. !26813 + +### Performance (1 change) + +- Bring back Rugged implementation of ListCommitsByOid. !27441 + +### Other (4 changes) + +- Bring back Rugged implementation of GetTreeEntries. !25674 +- Bring back Rugged implementation of CommitIsAncestor. !25702 +- Bring back Rugged implementation of TreeEntry. !25706 +- Bring back Rugged implementation of commit_tree_entry. !25896 + + ## 11.5.8 (2019-01-28) ### Security (21 changes) diff --git a/Dangerfile b/Dangerfile index 3e8cb45600..9e3a08949b 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true danger.import_plugin('danger/plugins/helper.rb') unless helper.release_automation? @@ -16,4 +17,5 @@ unless helper.release_automation? danger.import_dangerfile(path: 'danger/roulette') danger.import_dangerfile(path: 'danger/single_codebase') danger.import_dangerfile(path: 'danger/gitlab_ui_wg') + danger.import_dangerfile(path: 'danger/ce_ee_vue_templates') end diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 7e3856fe87..c39f63b9ef 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -1.34.3 +1.42.5 diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION index f7ee06693c..47da986f86 100644 --- a/GITLAB_SHELL_VERSION +++ b/GITLAB_SHELL_VERSION @@ -1 +1 @@ -9.0.0 +9.1.0 diff --git a/GITLAB_WORKHORSE_VERSION b/GITLAB_WORKHORSE_VERSION index 85e2cd5309..df5119ec64 100644 --- a/GITLAB_WORKHORSE_VERSION +++ b/GITLAB_WORKHORSE_VERSION @@ -1 +1 @@ -8.5.2 +8.7.0 diff --git a/Gemfile b/Gemfile index 00f90bdf7e..faedbd892c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '5.0.7.2' -gem 'rails-deprecated_sanitizer', '~> 1.0.3' +gem 'rails', '5.1.7' # Improves copy-on-write performance for MRI gem 'nakayoshi_fork', '~> 0.0.4' @@ -19,7 +18,7 @@ gem 'mysql2', '~> 0.4.10', group: :mysql gem 'pg', '~> 1.1', group: :postgres gem 'rugged', '~> 0.28' -gem 'grape-path-helpers', '~> 1.0' +gem 'grape-path-helpers', '~> 1.1' gem 'faraday', '~> 0.12' @@ -42,6 +41,9 @@ gem 'omniauth-shibboleth', '~> 1.3.0' gem 'omniauth-twitter', '~> 1.4' gem 'omniauth_crowd', '~> 2.2.0' gem 'omniauth-authentiq', '~> 0.3.3' +gem 'omniauth_openid_connect', '~> 0.3.0' +gem "omniauth-ultraauth", '~> 0.0.2' +gem 'omniauth-salesforce', '~> 1.0.5' gem 'rack-oauth2', '~> 1.9.3' gem 'jwt', '~> 2.1.0' @@ -79,6 +81,7 @@ gem 'rack-cors', '~> 1.0.0', require: 'rack/cors' # GraphQL API gem 'graphql', '~> 1.8.0' gem 'graphiql-rails', '~> 1.4.10' +gem 'apollo_upload_server', '~> 2.0.0.beta3' # Disable strong_params so that Mash does not respond to :permitted? gem 'hashie-forbidden_attributes' @@ -129,7 +132,7 @@ gem 'asciidoctor-plantuml', '0.0.8' gem 'rouge', '~> 3.1' gem 'truncato', '~> 0.7.11' gem 'bootstrap_form', '~> 4.2.0' -gem 'nokogiri', '~> 1.10.1' +gem 'nokogiri', '~> 1.10.3' gem 'escape_utils', '~> 1.1' # Calendar rendering @@ -158,7 +161,7 @@ gem 'state_machines-activerecord', '~> 0.5.1' gem 'acts-as-taggable-on', '~> 6.0' # Background jobs -gem 'sidekiq', '~> 5.2.1' +gem 'sidekiq', '~> 5.2.7' gem 'sidekiq-cron', '~> 1.0' gem 'redis-namespace', '~> 1.6.0' gem 'gitlab-sidekiq-fetcher', '~> 0.4.0', require: 'sidekiq-reliable-fetch' @@ -257,8 +260,7 @@ gem 'chronic_duration', '~> 0.10.6' gem 'webpack-rails', '~> 0.9.10' gem 'rack-proxy', '~> 0.6.0' -gem 'sass-rails', '~> 5.0.6' -gem 'sass', '~> 3.5' +gem 'sassc-rails', '~> 2.1.0' gem 'uglifier', '~> 2.7.2' gem 'addressable', '~> 2.5.2' @@ -274,6 +276,9 @@ gem 'sentry-raven', '~> 2.7' gem 'premailer-rails', '~> 1.9.7' +# LabKit: Tracing and Correlation +gem 'gitlab-labkit', '~> 0.2.0' + # I18n gem 'ruby_parser', '~> 3.8', require: false gem 'rails-i18n', '~> 5.1' @@ -281,7 +286,7 @@ gem 'gettext_i18n_rails', '~> 1.8.0' gem 'gettext_i18n_rails_js', '~> 1.3' gem 'gettext', '~> 3.2.2', require: false, group: :development -gem 'batch-loader', '~> 1.2.2' +gem 'batch-loader', '~> 1.4.0' # Perf bar gem 'peek', '~> 1.0.1' @@ -301,17 +306,11 @@ group :metrics do gem 'raindrops', '~> 0.18' end -group :tracing do - # OpenTracing - gem 'opentracing', '~> 0.4.3' - gem 'jaeger-client', '~> 0.10.0' -end - group :development do gem 'foreman', '~> 0.84.0' gem 'brakeman', '~> 4.2', require: false - gem 'letter_opener_web', '~> 1.3.0' + gem 'letter_opener_web', '~> 1.3.4' gem 'rblineprof', '~> 0.3.6', platform: :mri, require: false # Better errors handler @@ -334,7 +333,7 @@ group :development, :test do gem 'database_cleaner', '~> 1.7.0' gem 'factory_bot_rails', '~> 4.8.2' gem 'rspec-rails', '~> 3.7.0' - gem 'rspec-retry', '~> 0.4.5' + gem 'rspec-retry', '~> 0.6.1' gem 'rspec_profiling', '~> 0.0.5' gem 'rspec-set', '~> 0.1.3' gem 'rspec-parameterized', require: false @@ -345,20 +344,21 @@ group :development, :test do # Generate Fake data gem 'ffaker', '~> 2.10' - gem 'capybara', '~> 2.16.1' - gem 'capybara-screenshot', '~> 1.0.18' - gem 'selenium-webdriver', '~> 3.12' + gem 'capybara', '~> 2.18.0' + gem 'capybara-screenshot', '~> 1.0.22' + gem 'selenium-webdriver', '~> 3.141' gem 'spring', '~> 2.0.0' gem 'spring-commands-rspec', '~> 1.0.4' - gem 'gitlab-styles', '~> 2.4', require: false + gem 'gitlab-styles', '~> 2.6', require: false # Pin these dependencies, otherwise a new rule could break the CI pipelines - gem 'rubocop', '~> 0.54.0' + gem 'rubocop', '~> 0.68.1' + gem 'rubocop-performance', '~> 1.1.0' gem 'rubocop-rspec', '~> 1.22.1' gem 'scss_lint', '~> 0.56.0', require: false - gem 'haml_lint', '~> 0.28.0', require: false + gem 'haml_lint', '~> 0.30.0', require: false gem 'simplecov', '~> 0.14.0', require: false gem 'bundler-audit', '~> 0.5.0', require: false @@ -419,11 +419,11 @@ group :ed25519 do end # Gitaly GRPC client -gem 'gitaly-proto', '~> 1.22.1', require: 'gitaly' +gem 'gitaly-proto', '~> 1.27.2', require: 'gitaly' -gem 'grpc', '~> 1.15.0' +gem 'grpc', '~> 1.19.0' -gem 'google-protobuf', '~> 3.6' +gem 'google-protobuf', '~> 3.7.1' gem 'toml-rb', '~> 1.0.0', require: false diff --git a/Gemfile.lock b/Gemfile.lock index d498172b02..8708e79733 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,41 +4,41 @@ GEM RedCloth (4.3.2) abstract_type (0.0.7) ace-rails-ap (4.1.2) - actioncable (5.0.7.2) - actionpack (= 5.0.7.2) - nio4r (>= 1.2, < 3.0) + actioncable (5.1.7) + actionpack (= 5.1.7) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) + actionmailer (5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.7.2) - actionview (= 5.0.7.2) - activesupport (= 5.0.7.2) + actionpack (5.1.7) + actionview (= 5.1.7) + activesupport (= 5.1.7) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.7.2) - activesupport (= 5.0.7.2) + actionview (5.1.7) + activesupport (= 5.1.7) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.7.2) - activesupport (= 5.0.7.2) + activejob (5.1.7) + activesupport (= 5.1.7) globalid (>= 0.3.6) - activemodel (5.0.7.2) - activesupport (= 5.0.7.2) - activerecord (5.0.7.2) - activemodel (= 5.0.7.2) - activesupport (= 5.0.7.2) - arel (~> 7.0) + activemodel (5.1.7) + activesupport (= 5.1.7) + activerecord (5.1.7) + activemodel (= 5.1.7) + activesupport (= 5.1.7) + arel (~> 8.0) activerecord_sane_schema_dumper (1.0) rails (>= 5, < 6) - activesupport (5.0.7.2) + activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -52,7 +52,10 @@ GEM public_suffix (>= 2.0.2, < 4.0) aes_key_wrap (1.0.1) akismet (2.0.0) - arel (7.1.4) + apollo_upload_server (2.0.0.beta.3) + graphql (>= 1.8) + rails (>= 4.2) + arel (8.0.0) asana (0.8.1) faraday (~> 0.9) faraday_middleware (~> 0.9) @@ -73,7 +76,7 @@ GEM thread_safe (~> 0.3, >= 0.3.1) babosa (1.0.2) base32 (0.3.2) - batch-loader (1.2.2) + batch-loader (1.4.0) bcrypt (3.1.12) bcrypt_pbkdf (1.0.0) benchmark-ips (2.3.0) @@ -100,13 +103,13 @@ GEM bundler (~> 1.2) thor (~> 0.18) byebug (9.1.0) - capybara (2.16.1) + capybara (2.18.0) addressable mini_mime (>= 0.1.3) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) - xpath (~> 2.0) + xpath (>= 2.0, < 4.0) capybara-screenshot (1.0.22) capybara (>= 1.0, < 4) launchy @@ -185,8 +188,7 @@ GEM mail (~> 2.7) encryptor (3.0.0) equalizer (0.0.11) - erubi (1.7.1) - erubis (2.7.0) + erubi (1.8.0) escape_utils (1.2.1) et-orbi (1.1.7) tzinfo @@ -257,8 +259,8 @@ GEM fog-xml (0.1.3) fog-core nokogiri (>= 1.5.11, < 2.0.0) - font-awesome-rails (4.7.0.1) - railties (>= 3.2, < 5.1) + font-awesome-rails (4.7.0.4) + railties (>= 3.2, < 6.0) foreman (0.84.0) thor (~> 0.19.1) formatador (0.2.5) @@ -281,17 +283,24 @@ GEM gettext_i18n_rails (>= 0.7.1) po_to_json (>= 1.0.0) rails (>= 3.2.0) - gitaly-proto (1.22.1) + gitaly-proto (1.27.2) grpc (~> 1.0) github-markup (1.7.0) gitlab-default_value_for (3.1.1) activerecord (>= 3.2.0, < 6.0) + gitlab-labkit (0.2.0) + actionpack (~> 5) + activesupport (~> 5) + grpc (~> 1.15) + jaeger-client (~> 0.10) + opentracing (~> 0.4) gitlab-markup (1.7.0) gitlab-sidekiq-fetcher (0.4.0) sidekiq (~> 5) - gitlab-styles (2.5.1) - rubocop (~> 0.54.0) + gitlab-styles (2.6.2) + rubocop (~> 0.68.1) rubocop-gitlab-security (~> 0.1.0) + rubocop-performance (~> 1.1.0) rubocop-rspec (~> 1.19) gitlab_omniauth-ldap (2.1.1) net-ldap (~> 0.16) @@ -311,8 +320,8 @@ GEM mime-types (~> 3.0) representable (~> 3.0) retriable (>= 2.0, < 4.0) - google-protobuf (3.6.1) - googleapis-common-protos-types (1.0.3) + google-protobuf (3.7.1) + googleapis-common-protos-types (1.0.4) google-protobuf (~> 3.0) googleauth (0.6.6) faraday (~> 0.12) @@ -333,8 +342,8 @@ GEM grape-entity (0.7.1) activesupport (>= 4.0) multi_json (>= 1.3.2) - grape-path-helpers (1.0.6) - activesupport (>= 4, < 5.1) + grape-path-helpers (1.1.0) + activesupport grape (~> 1.0) rake (~> 12) grape_logging (1.7.0) @@ -343,13 +352,13 @@ GEM railties sprockets-rails graphql (1.8.1) - grpc (1.15.0) + grpc (1.19.0) google-protobuf (~> 3.1) googleapis-common-protos-types (~> 1.0.0) haml (5.0.4) temple (>= 0.8.0) tilt - haml_lint (0.28.0) + haml_lint (0.30.0) haml (>= 4.0, < 5.1) rainbow rake (>= 10, < 13) @@ -399,6 +408,7 @@ GEM jaeger-client (0.10.0) opentracing (~> 0.3) thrift + jaro_winkler (1.5.2) jira-ruby (1.4.1) activesupport multipart-post @@ -436,9 +446,9 @@ GEM rest-client (~> 2.0) launchy (2.4.3) addressable (~> 2.3) - letter_opener (1.4.1) + letter_opener (1.7.0) launchy (~> 2.2) - letter_opener_web (1.3.0) + letter_opener_web (1.3.4) actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) @@ -488,7 +498,7 @@ GEM net-ssh (5.0.1) netrc (0.11.0) nio4r (2.3.1) - nokogiri (1.10.1) + nokogiri (1.10.3) mini_portile2 (~> 2.4.0) nokogumbo (1.5.0) nokogiri @@ -543,6 +553,9 @@ GEM omniauth (~> 1.9) omniauth-oauth2-generic (0.2.2) omniauth-oauth2 (~> 1.0) + omniauth-salesforce (1.0.5) + omniauth (~> 1.0) + omniauth-oauth2 (~> 1.0) omniauth-saml (1.10.0) omniauth (~> 1.3, >= 1.3.2) ruby-saml (~> 1.7) @@ -551,17 +564,33 @@ GEM omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack + omniauth-ultraauth (0.0.2) + omniauth_openid_connect (~> 0.3.0) omniauth_crowd (2.2.3) activesupport nokogiri (>= 1.4.4) omniauth (~> 1.0) - opentracing (0.4.3) + omniauth_openid_connect (0.3.0) + addressable (~> 2.5) + omniauth (~> 1.3) + openid_connect (~> 1.1) + openid_connect (1.1.6) + activemodel + attr_required (>= 1.0.0) + json-jwt (>= 1.5.0) + rack-oauth2 (>= 1.6.1) + swd (>= 1.0.0) + tzinfo + validate_email + validate_url + webfinger (>= 1.0.1) + opentracing (0.5.0) optimist (3.0.0) org-ruby (0.9.12) rubypants (~> 0.2) orm_adapter (0.5.0) os (1.0.0) - parallel (1.12.1) + parallel (1.17.0) parser (2.5.3.0) ast (~> 2.4.0) parslet (1.8.2) @@ -591,7 +620,6 @@ GEM pg (1.1.4) po_to_json (1.0.1) json (>= 1.6.0) - powerpack (0.1.1) premailer (1.10.4) addressable css_parser (>= 1.4.10) @@ -636,26 +664,24 @@ GEM rack rack-proxy (0.6.0) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.7.2) - actioncable (= 5.0.7.2) - actionmailer (= 5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) - activemodel (= 5.0.7.2) - activerecord (= 5.0.7.2) - activesupport (= 5.0.7.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.1.7) + actioncable (= 5.1.7) + actionmailer (= 5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) + activemodel (= 5.1.7) + activerecord (= 5.1.7) + activesupport (= 5.1.7) bundler (>= 1.3.0) - railties (= 5.0.7.2) + railties (= 5.1.7) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.2) actionpack (~> 5.x, >= 5.0.1) actionview (~> 5.x, >= 5.0.1) activesupport (~> 5.x) - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -664,9 +690,9 @@ GEM rails-i18n (5.1.1) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.0.7.2) - actionpack (= 5.0.7.2) - activesupport (= 5.0.7.2) + railties (5.1.7) + actionpack (= 5.1.7) + activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -706,7 +732,7 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.6.0) redis (>= 2.2, < 5) - regexp_parser (1.3.0) + regexp_parser (1.4.0) regexp_property_values (0.3.4) representable (3.0.4) declarative (< 0.1.0) @@ -754,8 +780,8 @@ GEM rspec-expectations (~> 3.7.0) rspec-mocks (~> 3.7.0) rspec-support (~> 3.7.0) - rspec-retry (0.4.5) - rspec-core + rspec-retry (0.6.1) + rspec-core (> 3.3) rspec-set (0.1.3) rspec-support (3.7.1) rspec_junit_formatter (0.4.1) @@ -765,15 +791,17 @@ GEM pg rails sqlite3 - rubocop (0.54.0) + rubocop (0.68.1) + jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5) - powerpack (~> 0.1) + parser (>= 2.5, != 2.5.1.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) + unicode-display_width (>= 1.4.0, < 1.6) rubocop-gitlab-security (0.1.1) rubocop (>= 0.51) + rubocop-performance (1.1.0) + rubocop (>= 0.67.0) rubocop-rspec (1.22.2) rubocop (>= 0.52.1) ruby-enum (0.7.2) @@ -781,7 +809,7 @@ GEM ruby-fogbugz (0.2.1) crack (~> 0.4) ruby-prof (0.17.0) - ruby-progressbar (1.9.0) + ruby-progressbar (1.10.0) ruby-saml (1.7.2) nokogiri (>= 1.5.10) ruby_parser (3.11.0) @@ -800,12 +828,15 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.6) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) + sassc (2.0.1) + ffi (~> 1.9) + rake + sassc-rails (2.1.0) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) @@ -815,9 +846,9 @@ GEM seed-fu (2.3.7) activerecord (>= 3.1) activesupport (>= 3.1) - selenium-webdriver (3.12.0) + selenium-webdriver (3.141.0) childprocess (~> 0.5) - rubyzip (~> 1.2) + rubyzip (~> 1.2, >= 1.2.2) sentry-raven (2.9.0) faraday (>= 0.7.6, < 1.0) settingslogic (2.0.9) @@ -826,7 +857,7 @@ GEM rack shoulda-matchers (3.1.2) activesupport (>= 4.0.0) - sidekiq (5.2.5) + sidekiq (5.2.7) connection_pool (~> 2.2, >= 2.2.2) rack (>= 1.5.0) rack-protection (>= 1.5.0) @@ -867,6 +898,10 @@ GEM state_machines-activerecord (0.5.1) activerecord (>= 4.1, < 6.0) state_machines-activemodel (>= 0.5.0) + swd (1.1.2) + activesupport (>= 3) + attr_required (>= 0.0.5) + httpclient (>= 2.4) sys-filesystem (1.1.6) ffi sysexits (1.2.0) @@ -900,7 +935,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.3.2) + unicode-display_width (1.5.0) unicorn (5.4.1) kgio (~> 2.6) raindrops (~> 0.7) @@ -916,6 +951,12 @@ GEM equalizer (~> 0.0.9) parser (>= 2.3.1.2, < 2.6) procto (~> 0.0.2) + validate_email (0.1.6) + activemodel (>= 3.0) + mail (>= 2.2.5) + validate_url (1.0.8) + activemodel (>= 3.0.0) + public_suffix validates_hostname (1.0.6) activerecord (>= 3.0) activesupport (>= 3.0) @@ -928,6 +969,9 @@ GEM vmstat (2.3.0) warden (1.2.7) rack (>= 1.0) + webfinger (1.1.0) + activesupport + httpclient (>= 2.4) webmock (3.5.1) addressable (>= 2.3.6) crack (>= 0.3.2) @@ -943,8 +987,8 @@ GEM rinku with_env (1.1.0) xml-simple (1.1.5) - xpath (2.1.0) - nokogiri (~> 1.3) + xpath (3.2.0) + nokogiri (~> 1.8) PLATFORMS ruby @@ -956,6 +1000,7 @@ DEPENDENCIES acts-as-taggable-on (~> 6.0) addressable (~> 2.5.2) akismet (~> 2.0) + apollo_upload_server (~> 2.0.0.beta3) asana (~> 0.8.1) asciidoctor (~> 1.5.8) asciidoctor-plantuml (= 0.0.8) @@ -963,7 +1008,7 @@ DEPENDENCIES awesome_print babosa (~> 1.0.2) base32 (~> 0.3.0) - batch-loader (~> 1.2.2) + batch-loader (~> 1.4.0) bcrypt_pbkdf (~> 1.0) benchmark-ips (~> 2.3.0) better_errors (~> 2.5.0) @@ -974,8 +1019,8 @@ DEPENDENCIES browser (~> 2.5) bullet (~> 5.5.0) bundler-audit (~> 0.5.0) - capybara (~> 2.16.1) - capybara-screenshot (~> 1.0.18) + capybara (~> 2.18.0) + capybara-screenshot (~> 1.0.22) carrierwave (~> 1.3) charlock_holmes (~> 0.7.5) chronic (~> 0.10.2) @@ -1020,25 +1065,26 @@ DEPENDENCIES gettext (~> 3.2.2) gettext_i18n_rails (~> 1.8.0) gettext_i18n_rails_js (~> 1.3) - gitaly-proto (~> 1.22.1) + gitaly-proto (~> 1.27.2) github-markup (~> 1.7.0) gitlab-default_value_for (~> 3.1.1) + gitlab-labkit (~> 0.2.0) gitlab-markup (~> 1.7.0) gitlab-sidekiq-fetcher (~> 0.4.0) - gitlab-styles (~> 2.4) + gitlab-styles (~> 2.6) gitlab_omniauth-ldap (~> 2.1.1) gon (~> 6.2) google-api-client (~> 0.23) - google-protobuf (~> 3.6) + google-protobuf (~> 3.7.1) gpgme (~> 2.0.18) grape (~> 1.1.0) grape-entity (~> 0.7.1) - grape-path-helpers (~> 1.0) + grape-path-helpers (~> 1.1) grape_logging (~> 1.7) graphiql-rails (~> 1.4.10) graphql (~> 1.8.0) - grpc (~> 1.15.0) - haml_lint (~> 0.28.0) + grpc (~> 1.19.0) + haml_lint (~> 0.30.0) hamlit (~> 2.8.8) hangouts-chat (~> 0.0.5) hashie-forbidden_attributes @@ -1049,7 +1095,6 @@ DEPENDENCIES httparty (~> 0.16.4) icalendar influxdb (~> 0.2) - jaeger-client (~> 0.10.0) jira-ruby (~> 1.4) js_regex (~> 3.1) json-schema (~> 2.8.0) @@ -1057,7 +1102,7 @@ DEPENDENCIES kaminari (~> 1.0) knapsack (~> 1.17) kubeclient (~> 4.2.2) - letter_opener_web (~> 1.3.0) + letter_opener_web (~> 1.3.4) license_finder (~> 5.4) licensee (~> 8.9) lograge (~> 0.5) @@ -1071,7 +1116,7 @@ DEPENDENCIES nakayoshi_fork (~> 0.0.4) net-ldap net-ssh (~> 5.0) - nokogiri (~> 1.10.1) + nokogiri (~> 1.10.3) oauth2 (~> 1.4) octokit (~> 4.9) omniauth (~> 1.8) @@ -1085,11 +1130,13 @@ DEPENDENCIES omniauth-google-oauth2 (~> 0.6.0) omniauth-kerberos (~> 0.3.0) omniauth-oauth2-generic (~> 0.2.2) + omniauth-salesforce (~> 1.0.5) omniauth-saml (~> 1.10) omniauth-shibboleth (~> 1.3.0) omniauth-twitter (~> 1.4) + omniauth-ultraauth (~> 0.0.2) omniauth_crowd (~> 2.2.0) - opentracing (~> 0.4.3) + omniauth_openid_connect (~> 0.3.0) org-ruby (~> 0.9.12) peek (~> 1.0.1) peek-gc (~> 0.0.2) @@ -1109,9 +1156,8 @@ DEPENDENCIES rack-cors (~> 1.0.0) rack-oauth2 (~> 1.9.3) rack-proxy (~> 0.6.0) - rails (= 5.0.7.2) + rails (= 5.1.7) rails-controller-testing - rails-deprecated_sanitizer (~> 1.0.3) rails-i18n (~> 5.1) rainbow (~> 3.0) raindrops (~> 0.18) @@ -1129,11 +1175,12 @@ DEPENDENCIES rqrcode-rails3 (~> 0.1.7) rspec-parameterized rspec-rails (~> 3.7.0) - rspec-retry (~> 0.4.5) + rspec-retry (~> 0.6.1) rspec-set (~> 0.1.3) rspec_junit_formatter rspec_profiling (~> 0.0.5) - rubocop (~> 0.54.0) + rubocop (~> 0.68.1) + rubocop-performance (~> 1.1.0) rubocop-rspec (~> 1.22.1) ruby-fogbugz (~> 0.2.1) ruby-prof (~> 0.17.0) @@ -1142,16 +1189,15 @@ DEPENDENCIES rubyzip (~> 1.2.2) rugged (~> 0.28) sanitize (~> 4.6) - sass (~> 3.5) - sass-rails (~> 5.0.6) + sassc-rails (~> 2.1.0) scss_lint (~> 0.56.0) seed-fu (~> 2.3.7) - selenium-webdriver (~> 3.12) + selenium-webdriver (~> 3.141) sentry-raven (~> 2.7) settingslogic (~> 2.0.9) sham_rack (~> 1.3.6) shoulda-matchers (~> 3.1.2) - sidekiq (~> 5.2.1) + sidekiq (~> 5.2.7) sidekiq-cron (~> 1.0) simple_po_parser (~> 1.1.2) simplecov (~> 0.14.0) diff --git a/VERSION b/VERSION index 31265f292c..ae5e173a54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.10.8 +11.11.7 diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 8754c25388..e583a8affd 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -1,6 +1,7 @@ import $ from 'jquery'; import _ from 'underscore'; import axios from './lib/utils/axios_utils'; +import { joinPaths } from './lib/utils/url_utility'; const Api = { groupsPath: '/api/:version/groups.json', @@ -339,11 +340,7 @@ const Api = { }, buildUrl(url) { - let urlRoot = ''; - if (gon.relative_url_root != null) { - urlRoot = gon.relative_url_root; - } - return urlRoot + url.replace(':version', gon.api_version); + return joinPaths(gon.relative_url_root || '', url.replace(':version', gon.api_version)); }, }; diff --git a/app/assets/javascripts/batch_comments/mixins/resolved_status.js b/app/assets/javascripts/batch_comments/mixins/resolved_status.js new file mode 100644 index 0000000000..20c31d9f8a --- /dev/null +++ b/app/assets/javascripts/batch_comments/mixins/resolved_status.js @@ -0,0 +1,13 @@ +export default { + computed: { + resolveButtonTitle() { + let title = 'Mark as resolved'; + + if (this.resolvedBy) { + title = `Resolved by ${this.resolvedBy.name}`; + } + + return title; + }, + }, +}; diff --git a/app/assets/javascripts/behaviors/copy_to_clipboard.js b/app/assets/javascripts/behaviors/copy_to_clipboard.js index 9a33a060c7..c3541e6256 100644 --- a/app/assets/javascripts/behaviors/copy_to_clipboard.js +++ b/app/assets/javascripts/behaviors/copy_to_clipboard.js @@ -1,5 +1,6 @@ import $ from 'jquery'; import Clipboard from 'clipboard'; +import { sprintf, __ } from '~/locale'; function showTooltip(target, title) { const $target = $(target); @@ -16,7 +17,7 @@ function showTooltip(target, title) { } function genericSuccess(e) { - showTooltip(e.trigger, 'Copied'); + showTooltip(e.trigger, __('Copied')); // Clear the selection and blur the trigger so it loses its border e.clearSelection(); $(e.trigger).blur(); @@ -33,7 +34,7 @@ function genericError(e) { } else { key = 'Ctrl'; } - showTooltip(e.trigger, `Press ${key}-C to copy`); + showTooltip(e.trigger, sprintf(__(`Press %{key}-C to copy`), { key })); } export default function initCopyToClipboard() { diff --git a/app/assets/javascripts/behaviors/markdown/gfm_auto_complete.js b/app/assets/javascripts/behaviors/markdown/gfm_auto_complete.js index 55c68139de..b720015092 100644 --- a/app/assets/javascripts/behaviors/markdown/gfm_auto_complete.js +++ b/app/assets/javascripts/behaviors/markdown/gfm_auto_complete.js @@ -1,6 +1,6 @@ import $ from 'jquery'; import { parseBoolean } from '~/lib/utils/common_utils'; -import GfmAutoComplete from '~/gfm_auto_complete'; +import GfmAutoComplete from 'ee_else_ce/gfm_auto_complete'; export default function initGFMInput() { $('.js-gfm-input:not(.js-vue-textarea)').each((i, el) => { diff --git a/app/assets/javascripts/behaviors/markdown/nodes/table_of_contents.js b/app/assets/javascripts/behaviors/markdown/nodes/table_of_contents.js index 20c7fa8a9a..9a2e2c0321 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/table_of_contents.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/table_of_contents.js @@ -1,6 +1,7 @@ /* eslint-disable class-methods-use-this */ import { Node } from 'tiptap'; +import { __ } from '~/locale'; // Transforms generated HTML back to GFM for Banzai::Filter::TableOfContentsFilter export default class TableOfContents extends Node { @@ -22,7 +23,7 @@ export default class TableOfContents extends Node { priority: 51, }, ], - toDOM: () => ['p', { class: 'table-of-contents' }, 'Table of Contents'], + toDOM: () => ['p', { class: 'table-of-contents' }, __('Table of Contents')], }; } diff --git a/app/assets/javascripts/behaviors/preview_markdown.js b/app/assets/javascripts/behaviors/preview_markdown.js index 7adccbb062..35874140bf 100644 --- a/app/assets/javascripts/behaviors/preview_markdown.js +++ b/app/assets/javascripts/behaviors/preview_markdown.js @@ -22,7 +22,7 @@ function MarkdownPreview() {} // Minimum number of users referenced before triggering a warning MarkdownPreview.prototype.referenceThreshold = 10; -MarkdownPreview.prototype.emptyMessage = 'Nothing to preview.'; +MarkdownPreview.prototype.emptyMessage = __('Nothing to preview.'); MarkdownPreview.prototype.ajaxCache = {}; @@ -40,7 +40,7 @@ MarkdownPreview.prototype.showPreview = function($form) { preview.text(this.emptyMessage); this.hideReferencedUsers($form); } else { - preview.addClass('md-preview-loading').text('Loading...'); + preview.addClass('md-preview-loading').text(__('Loading...')); this.fetchMarkdownPreview( mdText, url, diff --git a/app/assets/javascripts/behaviors/quick_submit.js b/app/assets/javascripts/behaviors/quick_submit.js index c1ea67f929..530ab0bd4d 100644 --- a/app/assets/javascripts/behaviors/quick_submit.js +++ b/app/assets/javascripts/behaviors/quick_submit.js @@ -1,6 +1,7 @@ import $ from 'jquery'; import '../commons/bootstrap'; import { isInIssuePage } from '../lib/utils/common_utils'; +import { __ } from '~/locale'; // Quick Submit behavior // @@ -65,7 +66,9 @@ $(document).on( } const $this = $(this); - const title = isMac() ? 'You can also press ⌘-Enter' : 'You can also press Ctrl-Enter'; + const title = isMac() + ? __('You can also press ⌘-Enter') + : __('You can also press Ctrl-Enter'); $this.tooltip({ container: 'body', diff --git a/app/assets/javascripts/blob/balsamiq_viewer.js b/app/assets/javascripts/blob/balsamiq_viewer.js index b88e69a07b..2e537d8c00 100644 --- a/app/assets/javascripts/blob/balsamiq_viewer.js +++ b/app/assets/javascripts/blob/balsamiq_viewer.js @@ -1,8 +1,9 @@ import Flash from '../flash'; import BalsamiqViewer from './balsamiq/balsamiq_viewer'; +import { __ } from '~/locale'; function onError() { - const flash = new Flash('Balsamiq file could not be loaded.'); + const flash = new Flash(__('Balsamiq file could not be loaded.')); return flash; } diff --git a/app/assets/javascripts/blob/blob_file_dropzone.js b/app/assets/javascripts/blob/blob_file_dropzone.js index cd3251ad1c..9010cd0c3c 100644 --- a/app/assets/javascripts/blob/blob_file_dropzone.js +++ b/app/assets/javascripts/blob/blob_file_dropzone.js @@ -5,6 +5,7 @@ import Dropzone from 'dropzone'; import { visitUrl } from '../lib/utils/url_utility'; import { HIDDEN_CLASS } from '../lib/utils/constants'; import csrf from '../lib/utils/csrf'; +import { sprintf, __ } from '~/locale'; Dropzone.autoDiscover = false; @@ -73,7 +74,7 @@ export default class BlobFileDropzone { .html(errorMessage) .text(); $('.dropzone-alerts') - .html(`Error uploading file: "${stripped}"`) + .html(sprintf(__('Error uploading file: %{stripped}'), { stripped })) .show(); this.removeFile(file); }, @@ -84,7 +85,7 @@ export default class BlobFileDropzone { e.stopPropagation(); if (dropzone[0].dropzone.getQueuedFiles().length === 0) { // eslint-disable-next-line no-alert - alert('Please select a file'); + alert(__('Please select a file')); return false; } toggleLoading(submitButton, submitButtonLoadingIcon, true); diff --git a/app/assets/javascripts/blob/sketch/index.js b/app/assets/javascripts/blob/sketch/index.js index 57c1baa988..dbff03dc73 100644 --- a/app/assets/javascripts/blob/sketch/index.js +++ b/app/assets/javascripts/blob/sketch/index.js @@ -1,5 +1,6 @@ import JSZip from 'jszip'; import JSZipUtils from 'jszip-utils'; +import { __ } from '~/locale'; export default class SketchLoader { constructor(container) { @@ -56,10 +57,10 @@ export default class SketchLoader { const errorMsg = document.createElement('p'); errorMsg.className = 'prepend-top-default append-bottom-default text-center'; - errorMsg.textContent = ` + errorMsg.textContent = __(` Cannot show preview. For previews on sketch files, they must have the file format introduced by Sketch version 43 and above. - `; + `); this.container.appendChild(errorMsg); this.removeLoadingIcon(); diff --git a/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js b/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js index 4718b64261..659d57e6a6 100644 --- a/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js +++ b/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js @@ -1,11 +1,12 @@ import FileTemplateSelector from '../file_template_selector'; +import { __ } from '~/locale'; export default class DockerfileSelector extends FileTemplateSelector { constructor({ mediator }) { super(mediator); this.config = { key: 'dockerfile', - name: 'Dockerfile', + name: __('Dockerfile'), pattern: /(Dockerfile)/, type: 'dockerfiles', dropdown: '.js-dockerfile-selector', diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index d0359fc5fe..d246a1f606 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import Flash from '../../flash'; import { handleLocationHash } from '../../lib/utils/common_utils'; import axios from '../../lib/utils/axios_utils'; +import { __ } from '~/locale'; export default class BlobViewer { constructor() { @@ -26,7 +27,7 @@ export default class BlobViewer { promise .then(module => module.default(viewer)) .catch(error => { - Flash('Error loading file viewer.'); + Flash(__('Error loading file viewer.')); throw error; }); @@ -106,16 +107,19 @@ export default class BlobViewer { if (!this.copySourceBtn) return; if (this.simpleViewer.getAttribute('data-loaded')) { - this.copySourceBtn.setAttribute('title', 'Copy source to clipboard'); + this.copySourceBtn.setAttribute('title', __('Copy source to clipboard')); this.copySourceBtn.classList.remove('disabled'); } else if (this.activeViewer === this.simpleViewer) { this.copySourceBtn.setAttribute( 'title', - 'Wait for the source to load to copy it to the clipboard', + __('Wait for the source to load to copy it to the clipboard'), ); this.copySourceBtn.classList.add('disabled'); } else { - this.copySourceBtn.setAttribute('title', 'Switch to the source to copy it to the clipboard'); + this.copySourceBtn.setAttribute( + 'title', + __('Switch to the source to copy it to the clipboard'), + ); this.copySourceBtn.classList.add('disabled'); } @@ -158,7 +162,7 @@ export default class BlobViewer { this.toggleCopyButtonState(); }) - .catch(() => new Flash('Error loading viewer')); + .catch(() => new Flash(__('Error loading viewer'))); } static loadViewer(viewerParam) { diff --git a/app/assets/javascripts/boards/boards_util.js b/app/assets/javascripts/boards/boards_util.js new file mode 100644 index 0000000000..3178bda93b --- /dev/null +++ b/app/assets/javascripts/boards/boards_util.js @@ -0,0 +1,7 @@ +export function getMilestone() { + return null; +} + +export default { + getMilestone, +}; diff --git a/app/assets/javascripts/boards/components/board_blank_state.vue b/app/assets/javascripts/boards/components/board_blank_state.vue index 667eea17d4..47a46502bf 100644 --- a/app/assets/javascripts/boards/components/board_blank_state.vue +++ b/app/assets/javascripts/boards/components/board_blank_state.vue @@ -60,11 +60,15 @@ export default {