diff options
28 files changed, 264 insertions, 159 deletions
diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index e23c5198a09..12505642611 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -17,25 +17,25 @@ /doc/administration/operations/ @axil @eread @marcia /doc/administration/packages/ @ngaskill /doc/administration/postgresql/ @marcia -/doc/administration/raketasks/ @axil @eread @mjang1 +/doc/administration/raketasks/ @axil @eread /doc/administration/redis/ @axil /doc/administration/reference_architectures/ @axil /doc/administration/snippets/ @aqualls -/doc/administration/troubleshooting @axil @marcia @mjang1 +/doc/administration/troubleshooting @axil @marcia /doc/api/group_activity_analytics.md @msedlakjakubowski /doc/ci/ @marcel.amirault @sselhorn /doc/ci/environments/ @axil /doc/ci/services/ @sselhorn /doc/ci/test_cases/ @msedlakjakubowski -/doc/development/ @marcia @mjang1 +/doc/development/ @marcia /doc/development/documentation/ @cnorris /doc/development/value_stream_analytics.md @msedlakjakubowski /doc/gitlab-basics/ @marcia /doc/install/ @axil -/doc/integration/ @aqualls @mjang1 +/doc/integration/ @aqualls /doc/operations/ @ngaskill @axil /doc/push_rules/ @aqualls -/doc/ssh/ @mjang1 +/doc/ssh/ @eread /doc/subscriptions/ @sselhorn /doc/topics/autodevops/ @ngaskill @marcia /doc/topics/git/ @aqualls @@ -43,7 +43,7 @@ /doc/user/analytics/ @msedlakjakubowski @ngaskill /doc/user/application_security @rdickenson /doc/user/clusters/ @marcia -/doc/user/compliance/ @mjang1 @rdickenson +/doc/user/compliance/ @rdickenson /doc/user/group/ @msedlakjakubowski /doc/user/group/bulk_editing/ @msedlakjakubowski /doc/user/group/devops_adoption/ @msedlakjakubowski @@ -54,10 +54,10 @@ /doc/user/group/value_stream_analytics/ @msedlakjakubowski /doc/user/infrastructure/ @marcia /doc/user/packages/ @ngaskill -/doc/user/profile/ @mjang1 @msedlakjakubowski -/doc/user/project/ @aqualls @axil @eread @mjang1 @msedlakjakubowski @ngaskill +/doc/user/profile/ @msedlakjakubowski +/doc/user/project/ @aqualls @axil @eread @msedlakjakubowski @ngaskill /doc/user/project/clusters/ @ngaskill -/doc/user/project/import/ @mjang1 @msedlakjakubowski +/doc/user/project/import/ @msedlakjakubowski /doc/user/project/integrations/ @aqualls /doc/user/project/integrations/prometheus_library/ @ngaskill /doc/user/project/issues/ @msedlakjakubowski @@ -65,7 +65,7 @@ /doc/user/project/milestones/ @msedlakjakubowski /doc/user/project/pages/ @axil /doc/user/project/repository/ @aqualls -/doc/user/project/settings/ @mjang1 @aqualls +/doc/user/project/settings/ @aqualls /doc/user/project/static_site_editor/index.md @aqualls /doc/user/project/web_ide/index.md @aqualls /doc/user/project/wiki/index.md @aqualls diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index 5e9aea52d96..33aab8554e7 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -58,31 +58,27 @@ compile-test-assets as-if-foss: update-assets-compile-production-cache: extends: - compile-production-assets + - .assets-compile-cache-push - .shared:rules:update-cache stage: prepare artifacts: {} # This job's purpose is only to update the cache. - cache: - policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. update-assets-compile-test-cache: extends: - compile-test-assets + - .assets-compile-cache-push - .shared:rules:update-cache stage: prepare artifacts: {} # This job's purpose is only to update the cache. - cache: - policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. update-yarn-cache: extends: - .default-retry - - .yarn-cache + - .yarn-cache-push - .shared:rules:update-cache stage: prepare script: - *yarn-install - cache: - policy: push .frontend-fixtures-base: extends: diff --git a/.gitlab/ci/global.gitlab-ci.yml b/.gitlab/ci/global.gitlab-ci.yml index 0cadce5cc20..489b02fe2f6 100644 --- a/.gitlab/ci/global.gitlab-ci.yml +++ b/.gitlab/ci/global.gitlab-ci.yml @@ -16,75 +16,147 @@ - source scripts/utils.sh - source scripts/prepare_build.sh +.ruby-gems-cache: &ruby-gems-cache + key: "ruby-gems-v1" + paths: + - vendor/ruby/ + policy: pull + +.ruby-gems-cache-push: &ruby-gems-cache-push + <<: *ruby-gems-cache + policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. + +.gitaly-ruby-gems-cache: &gitaly-ruby-gems-cache + key: "gitaly-ruby-gems-v1" + paths: + - vendor/gitaly-ruby/ + policy: pull + +.gitaly-ruby-gems-cache-push: &gitaly-ruby-gems-cache-push + <<: *gitaly-ruby-gems-cache + policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. + +.go-pkg-cache: &go-pkg-cache + key: "go-pkg-v1" + paths: + - .go/pkg/mod/ + policy: pull + +.go-pkg-cache-push: &go-pkg-cache-push + <<: *go-pkg-cache + policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. + +.node-modules-cache: &node-modules-cache + key: "node-modules-${NODE_ENV}-v1" + paths: + - node_modules/ + - tmp/cache/webpack-dlls/ + policy: pull + +.node-modules-cache-push: &node-modules-cache-push + <<: *node-modules-cache + policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. + +.assets-cache: &assets-cache + key: "assets-${NODE_ENV}-v1" + paths: + - assets-hash.txt + - public/assets/webpack/ + - tmp/cache/assets/sprockets/ + - tmp/cache/babel-loader/ + - tmp/cache/vue-loader/ + policy: pull + +.assets-cache-push: &assets-cache-push + <<: *assets-cache + policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. + +.rubocop-cache: &rubocop-cache + key: "rubocop-v1" + paths: + - tmp/rubocop_cache/ + policy: pull + +.rubocop-cache-push: &rubocop-cache-push + <<: *rubocop-cache + # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up but RuboCop has a mechanism + # for keeping only the N latest cache files, so we take advantage of it with `pull-push`. + policy: pull-push + +.qa-ruby-gems-cache: &qa-ruby-gems-cache + key: "qa-ruby-gems-v1" + paths: + - qa/vendor/ruby/ + policy: pull + +.qa-ruby-gems-cache-push: &qa-ruby-gems-cache-push + <<: *qa-ruby-gems-cache + policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. + .setup-test-env-cache: cache: - key: "setup-test-env-v1" - paths: - - vendor/ruby/ - - vendor/gitaly-ruby/ - - .go/pkg/mod/ - policy: pull + - *ruby-gems-cache + - *gitaly-ruby-gems-cache + - *go-pkg-cache + +.setup-test-env-cache-push: + cache: + - *ruby-gems-cache-push + - *gitaly-ruby-gems-cache-push + - *go-pkg-cache-push .rails-cache: cache: - key: "rails-v5" - paths: - - vendor/ruby/ - - vendor/gitaly-ruby/ - policy: pull + - *ruby-gems-cache + - *gitaly-ruby-gems-cache .static-analysis-cache: cache: - key: "static-analysis-v2" - paths: - - vendor/ruby/ - - node_modules/ - - tmp/rubocop_cache/ - policy: pull + - *ruby-gems-cache + - *node-modules-cache + - *rubocop-cache + +.static-analysis-cache-push: + cache: + - *ruby-gems-cache # We don't push this cache as it's already rebuilt by `update-setup-test-env-cache` + - *rubocop-cache-push .coverage-cache: cache: - key: "coverage-cache-v1" - paths: - - vendor/ruby/ - policy: pull + - *ruby-gems-cache .danger-review-cache: cache: - key: "danger-review-v1" - paths: - - vendor/ruby/ - - node_modules/ - policy: pull + - *ruby-gems-cache + - *node-modules-cache .qa-cache: cache: - key: "qa-v2" - paths: - - qa/vendor/ruby/ - policy: pull + - *qa-ruby-gems-cache + +.qa-cache-push: + cache: + - *qa-ruby-gems-cache-push .yarn-cache: cache: - key: "yarn-v1" - paths: - - node_modules/ - - tmp/cache/webpack-dlls/ - policy: pull + - *node-modules-cache + +.yarn-cache-push: + cache: + - *node-modules-cache-push .assets-compile-cache: cache: - key: "assets-compile-${NODE_ENV}-v1" - paths: - - vendor/ruby/ - - node_modules/ - - assets-hash.txt - - public/assets/webpack/ - - tmp/cache/assets/sprockets/ - - tmp/cache/babel-loader/ - - tmp/cache/vue-loader/ - - tmp/cache/webpack-dlls/ - policy: pull + - *ruby-gems-cache + - *node-modules-cache + - *assets-cache + +.assets-compile-cache-push: + cache: + - *ruby-gems-cache # We don't push this cache as it's already rebuilt by `update-setup-test-env-cache` + - *node-modules-cache-push + - *assets-cache-push .use-pg11: image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.7.2.patched-golang-1.14-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-11-graphicsmagick-1.3.36" diff --git a/.gitlab/ci/qa.gitlab-ci.yml b/.gitlab/ci/qa.gitlab-ci.yml index 5097fd28eeb..8bbd7dbf075 100644 --- a/.gitlab/ci/qa.gitlab-ci.yml +++ b/.gitlab/ci/qa.gitlab-ci.yml @@ -41,12 +41,11 @@ qa:selectors-as-if-foss: update-qa-cache: extends: - .qa-job-base + - .qa-cache-push - .shared:rules:update-cache stage: prepare script: - echo "Cache has been updated and ready to be uploaded." - cache: - policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. .package-and-qa-base: image: ${GITLAB_DEPENDENCY_PROXY}ruby:2.7-alpine diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 4a3cbf89edb..5cd64baf4d3 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -187,18 +187,10 @@ setup-test-env: update-setup-test-env-cache: extends: - setup-test-env + - .setup-test-env-cache-push - .shared:rules:update-cache artifacts: paths: [] # This job's purpose is only to update the cache. - cache: - policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. - -update-rails-cache: - extends: - - update-setup-test-env-cache - - .rails-cache - cache: - policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. .coverage-base: extends: @@ -209,16 +201,6 @@ update-rails-cache: SETUP_DB: "false" USE_BUNDLE_INSTALL: "false" -update-coverage-cache: - extends: - - .coverage-base - - .shared:rules:update-cache - stage: prepare - script: - - !reference [.minimal-bundle-install, script] - cache: - policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. - .static-analysis-base: extends: - .default-retry @@ -232,16 +214,11 @@ update-coverage-cache: update-static-analysis-cache: extends: - .static-analysis-base + - .static-analysis-cache-push - .shared:rules:update-cache stage: prepare script: - - rm -rf ./node_modules # We remove node_modules because there's no mechanism to remove stall entries. - - run_timed_command "retry yarn install --frozen-lockfile" - - run_timed_command "bundle exec rubocop --parallel" # For the moment we only cache `vendor/ruby/`, `node_modules/`, and `tmp/rubocop_cache` so we don't need to run all the tasks, - cache: - # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up but RuboCop has a mechanism - # for keeping only the N latest cache files, so we take advantage of it with `pull-push` and removing `node_modules` at the start of the job. - policy: pull-push + - run_timed_command "bundle exec rubocop --parallel" # For the moment we only cache `tmp/rubocop_cache` so we don't need to run all the tasks. static-analysis: extends: diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml index 1eccc9cabfa..5decc83da2b 100644 --- a/.gitlab/ci/review.gitlab-ci.yml +++ b/.gitlab/ci/review.gitlab-ci.yml @@ -230,12 +230,3 @@ danger-review: else run_timed_command "bundle exec danger --fail-on-errors=true --verbose" fi - -update-danger-review-cache: - extends: - - danger-review - - .shared:rules:update-cache - stage: prepare - script: echo 'Cache is fresh!' - cache: - policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up. diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml index c3863b457ad..10ffb7b897c 100644 --- a/.rubocop_manual_todo.yml +++ b/.rubocop_manual_todo.yml @@ -158,9 +158,6 @@ Rails/SaveBang: - 'spec/lib/gitlab/middleware/go_spec.rb' - 'spec/lib/gitlab/shard_health_cache_spec.rb' - 'spec/mailers/notify_spec.rb' - - 'spec/models/appearance_spec.rb' - - 'spec/models/application_record_spec.rb' - - 'spec/models/application_setting_spec.rb' - 'spec/models/clusters/applications/helm_spec.rb' - 'spec/models/container_repository_spec.rb' - 'spec/models/design_management/version_spec.rb' diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 33eba3d6b3c..c6865d35011 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -7,7 +7,9 @@ module GroupsHelper groups#details groups#activity groups#subgroups - ] + ].tap do |paths| + paths << 'labels#index' if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) + end end def group_settings_nav_link_paths diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index 0e5822a7c6f..aab1a44bdfb 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -69,7 +69,14 @@ module NavHelper end def group_issues_sub_menu_items - %w(groups#issues labels#index milestones#index boards#index boards#show) + %w[ + groups#issues + milestones#index + boards#index + boards#show + ].tap do |paths| + paths << 'labels#index' if Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml) + end end private diff --git a/app/views/layouts/nav/sidebar/_group.html.haml b/app/views/layouts/nav/sidebar/_group.html.haml index 286d12b9ac8..e23c813d15b 100644 --- a/app/views/layouts/nav/sidebar/_group.html.haml +++ b/app/views/layouts/nav/sidebar/_group.html.haml @@ -24,7 +24,7 @@ = group_information_title(@group) %ul.sidebar-sub-level-items - = nav_link(path: ['groups#show', 'groups#details', 'groups#activity', 'groups#subgroups'], html_options: { class: "fly-out-top-item" } ) do + = nav_link(path: paths, html_options: { class: "fly-out-top-item" } ) do = link_to group_path(@group) do %strong.fly-out-top-item-name = group_information_title(@group) @@ -42,6 +42,12 @@ %span = _('Activity') + - if group_sidebar_link?(:labels) && Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) + = nav_link(path: 'labels#index') do + = link_to group_labels_path(@group), title: _('Labels') do + %span + = _('Labels') + = render_if_exists "layouts/nav/ee/epic_link", group: @group - if group_sidebar_link?(:issues) @@ -54,7 +60,7 @@ %span.badge.badge-pill.count= issues_count %ul.sidebar-sub-level-items{ data: { qa_selector: 'group_issues_sidebar_submenu'} } - = nav_link(path: ['groups#issues', 'labels#index', 'milestones#index', 'iterations#index'], html_options: { class: "fly-out-top-item" } ) do + = nav_link(path: group_issues_sub_menu_items, html_options: { class: "fly-out-top-item" } ) do = link_to issues_group_path(@group) do %strong.fly-out-top-item-name = _('Issues') @@ -72,7 +78,7 @@ %span = boards_link_text - - if group_sidebar_link?(:labels) + - if group_sidebar_link?(:labels) && Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml) = nav_link(path: 'labels#index') do = link_to group_labels_path(@group), title: _('Labels') do %span diff --git a/changelogs/unreleased/enable-deployments_finder_implicitly_enforce_ordering_for_updated_at_filt.yml b/changelogs/unreleased/enable-deployments_finder_implicitly_enforce_ordering_for_updated_at_filt.yml new file mode 100644 index 00000000000..c17837b1d7d --- /dev/null +++ b/changelogs/unreleased/enable-deployments_finder_implicitly_enforce_ordering_for_updated_at_filt.yml @@ -0,0 +1,5 @@ +--- +title: Enforce updated_at ordering in Deployment API for performance optimization +merge_request: 61870 +author: +type: performance diff --git a/changelogs/unreleased/issue-220040-fix-robocop-savebang-spec-models.yml b/changelogs/unreleased/issue-220040-fix-robocop-savebang-spec-models.yml new file mode 100644 index 00000000000..cbb7712bcfa --- /dev/null +++ b/changelogs/unreleased/issue-220040-fix-robocop-savebang-spec-models.yml @@ -0,0 +1,5 @@ +--- +title: Fixed Rails Save Bang offenses in few spec/models/* files +merge_request: 61862 +author: Suraj Tripathi @surajtripathy07 +type: fixed diff --git a/changelogs/unreleased/update-rails-project-template-to-rails-6-1.yml b/changelogs/unreleased/update-rails-project-template-to-rails-6-1.yml new file mode 100644 index 00000000000..2cb23db101b --- /dev/null +++ b/changelogs/unreleased/update-rails-project-template-to-rails-6-1.yml @@ -0,0 +1,5 @@ +--- +title: Update rails project template to rails 6.1 +merge_request: 61547 +author: +type: changed diff --git a/config/feature_flags/development/deployments_finder_implicitly_enforce_ordering_for_updated_at_filter.yml b/config/feature_flags/development/deployments_finder_implicitly_enforce_ordering_for_updated_at_filter.yml index bc8e3ca3997..68a3de44e88 100644 --- a/config/feature_flags/development/deployments_finder_implicitly_enforce_ordering_for_updated_at_filter.yml +++ b/config/feature_flags/development/deployments_finder_implicitly_enforce_ordering_for_updated_at_filter.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329286 milestone: '13.12' type: development group: group::release -default_enabled: false +default_enabled: true diff --git a/config/webpack.config.js b/config/webpack.config.js index d40d14e1158..db5371a7258 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -188,7 +188,7 @@ module.exports = { }, resolve: { - extensions: ['.js', '.gql', '.graphql'], + extensions: ['.js'], alias, }, diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index c9a015f0950..2dbb3be0a0e 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -9350,8 +9350,8 @@ Contains release-related statistics about a group. | Name | Type | Description | | ---- | ---- | ----------- | -| <a id="groupreleasestatsreleasescount"></a>`releasesCount` | [`Int`](#int) | Total number of releases in all descendant projects of the group. Will always return `null` if `group_level_release_statistics` feature flag is disabled. | -| <a id="groupreleasestatsreleasespercentage"></a>`releasesPercentage` | [`Int`](#int) | Percentage of the group's descendant projects that have at least one release. Will always return `null` if `group_level_release_statistics` feature flag is disabled. | +| <a id="groupreleasestatsreleasescount"></a>`releasesCount` | [`Int`](#int) | Total number of releases in all descendant projects of the group. | +| <a id="groupreleasestatsreleasespercentage"></a>`releasesPercentage` | [`Int`](#int) | Percentage of the group's descendant projects that have at least one release. | ### `GroupStats` diff --git a/doc/development/pipelines.md b/doc/development/pipelines.md index f607260803e..24f35bdab57 100644 --- a/doc/development/pipelines.md +++ b/doc/development/pipelines.md @@ -548,7 +548,7 @@ request, be sure to start the `dont-interrupt-me` job before pushing. 1. All jobs must only pull caches by default. 1. All jobs must be able to pass with an empty cache. In other words, caches are only there to speed up jobs. -1. We currently have several different caches defined in +1. We currently have several different cache definitions defined in [`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/global.gitlab-ci.yml), with fixed keys: - `.setup-test-env-cache` @@ -559,17 +559,15 @@ request, be sure to start the `dont-interrupt-me` job before pushing. - `.qa-cache` - `.yarn-cache` - `.assets-compile-cache` (the key includes `${NODE_ENV}` so it's actually two different caches). +1. These cache definitions are composed of [multiple atomic caches](../ci/yaml/README.md#multiple-caches). 1. Only 6 specific jobs, running in 2-hourly scheduled pipelines, are pushing (i.e. updating) to the caches: - `update-setup-test-env-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml). - - `update-rails-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml). - `update-static-analysis-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml). - - `update-coverage-cache`, defined in [`.gitlab/ci/rails.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/rails.gitlab-ci.yml). - - `update-danger-review-cache`, defined in [`.gitlab/ci/review.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/review.gitlab-ci.yml). - `update-qa-cache`, defined in [`.gitlab/ci/qa.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/qa.gitlab-ci.yml). - `update-assets-compile-production-cache`, defined in [`.gitlab/ci/frontend.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/frontend.gitlab-ci.yml). - `update-assets-compile-test-cache`, defined in [`.gitlab/ci/frontend.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/frontend.gitlab-ci.yml). - `update-yarn-cache`, defined in [`.gitlab/ci/frontend.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/frontend.gitlab-ci.yml). -1. These jobs run in merge requests whose title include `UPDATE CACHE`. +1. These jobs can also be forced to run in merge requests whose title include `UPDATE CACHE` (this can be useful to warm the caches in a MR that updates the cache keys). ### Artifacts strategy @@ -593,12 +591,12 @@ The `CI_PRE_CLONE_SCRIPT` is currently defined as a project CI/CD variable: ( echo "Downloading archived master..." wget -O /tmp/gitlab.tar.gz https://storage.googleapis.com/gitlab-ci-git-repo-cache/project-278964/gitlab-master-shallow.tar.gz - + if [ ! -f /tmp/gitlab.tar.gz ]; then echo "Repository cache not available, cloning a new directory..." exit fi - + rm -rf $CI_PROJECT_DIR echo "Extracting tarball into $CI_PROJECT_DIR..." mkdir -p $CI_PROJECT_DIR diff --git a/doc/development/snowplow/index.md b/doc/development/snowplow/index.md index b4bdd88e654..ece72dbbf03 100644 --- a/doc/development/snowplow/index.md +++ b/doc/development/snowplow/index.md @@ -427,7 +427,7 @@ https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#test-sn ### Performance -We use the [AsyncEmitter](https://github.com/snowplow/snowplow/wiki/Ruby-Tracker#52-the-asyncemitter-class) when tracking events, which allows for instrumentation calls to be run in a background thread. This is still an active area of development. +We use the [AsyncEmitter](https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/ruby-tracker/emitters/#the-asyncemitter-class) when tracking events, which allows for instrumentation calls to be run in a background thread. This is still an active area of development. ## Developing and testing Snowplow diff --git a/doc/user/group/value_stream_analytics/img/vsa_label_based_stage_v14_0.png b/doc/user/group/value_stream_analytics/img/vsa_label_based_stage_v14_0.png Binary files differnew file mode 100644 index 00000000000..1f47670462c --- /dev/null +++ b/doc/user/group/value_stream_analytics/img/vsa_label_based_stage_v14_0.png diff --git a/doc/user/group/value_stream_analytics/index.md b/doc/user/group/value_stream_analytics/index.md index a0ddbf22d2a..4b473c9217d 100644 --- a/doc/user/group/value_stream_analytics/index.md +++ b/doc/user/group/value_stream_analytics/index.md @@ -191,7 +191,7 @@ A few notes: cycles, calculate their median time and the result is what the dashboard of Value Stream Analytics is showing. -## Customizable Stages +## Custom value streams > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12196) in GitLab 12.9. @@ -311,16 +311,53 @@ add stages as desired. To create a value stream with stages: -1. Navigate to your group's **Analytics > Value Stream**. -1. Find and select the Value Stream dropdown. Select **Create new Value Stream**. +1. Go to your group and select **Analytics > Value Stream**. +1. Select the Value Stream dropdown and select **Create new Value Stream**. 1. Select either **Create from default template** or **Create from no template**. - - Default stages in the value stream can be hidden or re-ordered + - Default stages in the value stream can be hidden or re-ordered. + ![Default stage actions](img/vsa_default_stage_v13_10.png "Default stage actions") - - New stages can be added by clicking the 'Add another stage' button + + - New stages can be added by clicking the 'Add another stage' button. - The name, start and end events for the stage can be selected + ![Custom stage actions](img/vsa_custom_stage_v13_10.png "Custom stage actions") 1. Select the **Create Value Stream** button to save the value stream. +#### Label-based stages + +The pre-defined start and end events can cover many use cases involving both issues and merge requests. + +In more complex workflows, use stages based on group labels. These events are based on +added or removed labels. In particular, [scoped labels](../../project/labels.md#scoped-labels) +are useful for complex workflows. + +In this example, we'd like to measure times for deployment from a staging environment to production. The workflow is the following: + +- When the code is deployed to staging, the `workflow::staging` label is added to the merge request. +- When the code is deployed to production, the `workflow::production` label is added to the merge request. + +![Label Based Value Stream Analytics Stage](img/vsa_label_based_stage_v14_0.png "Creating a label based Value Stream Analytics Stage") + +### Editing a value stream + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/267537) in GitLab 13.10. + +After you create a value stream, you can customize it to suit your purposes. To edit a value stream: + +1. Go to your group and select **Analytics > Value Stream**. +1. Find and select the relevant value stream from the value stream dropdown. +1. Next to the value stream dropdown, select **Edit**. + The edit form is populated with the value stream details. +1. Optional: + - Rename the value stream. + - Hide or re-order default stages. + - Remove existing custom stages. + - Add new stages by selecting the 'Add another stage' button + - Select the start and end events for the stage. +1. Optional. To undo any modifications, select **Restore value stream defaults**. +1. Select **Save Value Stream**. + ### Deleting a value stream > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/221205) in GitLab 13.4. diff --git a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml index 0271ee00ac4..a8d45e80356 100644 --- a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml @@ -155,7 +155,7 @@ gosec-sast: exists: - '**/*.go' -mobsf-android-sast: +.mobsf-sast: extends: .sast-analyzer image: name: "$SAST_ANALYZER_IMAGE" @@ -164,6 +164,9 @@ mobsf-android-sast: # override the analyzer image with a custom value. This may be subject to change or # breakage across GitLab releases. SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/mobsf:$SAST_ANALYZER_IMAGE_TAG" + +mobsf-android-sast: + extends: .mobsf-sast rules: - if: $SAST_DISABLED when: never @@ -173,17 +176,11 @@ mobsf-android-sast: $SAST_DEFAULT_ANALYZERS =~ /mobsf/ && $SAST_EXPERIMENTAL_FEATURES == 'true' exists: + - '**/*.apk' - '**/AndroidManifest.xml' mobsf-ios-sast: - extends: .sast-analyzer - image: - name: "$SAST_ANALYZER_IMAGE" - variables: - # SAST_ANALYZER_IMAGE is an undocumented variable used internally to allow QA to - # override the analyzer image with a custom value. This may be subject to change or - # breakage across GitLab releases. - SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/mobsf:$SAST_ANALYZER_IMAGE_TAG" + extends: .mobsf-sast rules: - if: $SAST_DISABLED when: never @@ -193,6 +190,7 @@ mobsf-ios-sast: $SAST_DEFAULT_ANALYZERS =~ /mobsf/ && $SAST_EXPERIMENTAL_FEATURES == 'true' exists: + - '**/*.ipa' - '**/*.xcodeproj/*' nodejs-scan-sast: diff --git a/spec/features/groups/navbar_spec.rb b/spec/features/groups/navbar_spec.rb index 7f0aef6b300..c1d7b3ecae6 100644 --- a/spec/features/groups/navbar_spec.rb +++ b/spec/features/groups/navbar_spec.rb @@ -13,18 +13,12 @@ RSpec.describe 'Group navbar' do let(:structure) do [ - { - nav_item: _('Group information'), - nav_sub_items: [ - _('Activity') - ] - }, + group_information_nav_item, { nav_item: _('Issues'), nav_sub_items: [ _('List'), _('Board'), - _('Labels'), _('Milestones') ] }, diff --git a/spec/helpers/nav_helper_spec.rb b/spec/helpers/nav_helper_spec.rb index 2efff3402c5..4c5f440b8a3 100644 --- a/spec/helpers/nav_helper_spec.rb +++ b/spec/helpers/nav_helper_spec.rb @@ -115,6 +115,10 @@ RSpec.describe NavHelper do describe '.group_issues_sub_menu_items' do subject { helper.group_issues_sub_menu_items } + before do + allow(helper).to receive(:current_user).and_return(nil) + end + it { is_expected.to all(be_a(String)) } end diff --git a/spec/models/appearance_spec.rb b/spec/models/appearance_spec.rb index 37eddf9a22a..2817e177d28 100644 --- a/spec/models/appearance_spec.rb +++ b/spec/models/appearance_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Appearance do create(:appearance) new_row = build(:appearance) - new_row.save + expect { new_row.save! }.to raise_error(ActiveRecord::RecordInvalid, 'Validation failed: Only 1 appearances row can exist') expect(new_row.valid?).to eq(false) end @@ -39,7 +39,7 @@ RSpec.describe Appearance do end it 'returns the path when the upload has been orphaned' do - appearance.send(logo_type).upload.destroy + appearance.send(logo_type).upload.destroy! appearance.reload expect(appearance.send("#{logo_type}_path")).to eq(expected_path) diff --git a/spec/models/application_record_spec.rb b/spec/models/application_record_spec.rb index 7e6ac351e68..24de46cb536 100644 --- a/spec/models/application_record_spec.rb +++ b/spec/models/application_record_spec.rb @@ -13,20 +13,24 @@ RSpec.describe ApplicationRecord do describe '.safe_ensure_unique' do let(:model) { build(:suggestion) } + let_it_be(:note) { create(:diff_note_on_merge_request) } + let(:klass) { model.class } before do - allow(model).to receive(:save).and_raise(ActiveRecord::RecordNotUnique) + allow(model).to receive(:save!).and_raise(ActiveRecord::RecordNotUnique) end it 'returns false when ActiveRecord::RecordNotUnique is raised' do - expect(model).to receive(:save).once - expect(klass.safe_ensure_unique { model.save }).to be_falsey + expect(model).to receive(:save!).once + model.note_id = note.id + expect(klass.safe_ensure_unique { model.save! }).to be_falsey end it 'retries based on retry count specified' do - expect(model).to receive(:save).exactly(3).times - expect(klass.safe_ensure_unique(retries: 2) { model.save }).to be_falsey + expect(model).to receive(:save!).exactly(3).times + model.note_id = note.id + expect(klass.safe_ensure_unique(retries: 2) { model.save! }).to be_falsey end end diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index f96444f9e83..4b4e7820f7a 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -252,7 +252,9 @@ RSpec.describe ApplicationSetting do context "when user accepted let's encrypt terms of service" do before do - setting.update(lets_encrypt_terms_of_service_accepted: true) + expect do + setting.update!(lets_encrypt_terms_of_service_accepted: true) + end.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Lets encrypt notification email can't be blank") end it { is_expected.not_to allow_value(nil).for(:lets_encrypt_notification_email) } @@ -302,26 +304,30 @@ RSpec.describe ApplicationSetting do describe 'default_artifacts_expire_in' do it 'sets an error if it cannot parse' do - setting.update(default_artifacts_expire_in: 'a') + expect do + setting.update!(default_artifacts_expire_in: 'a') + end.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Default artifacts expire in is not a correct duration") expect_invalid end it 'sets an error if it is blank' do - setting.update(default_artifacts_expire_in: ' ') + expect do + setting.update!(default_artifacts_expire_in: ' ') + end.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Default artifacts expire in can't be blank") expect_invalid end it 'sets the value if it is valid' do - setting.update(default_artifacts_expire_in: '30 days') + setting.update!(default_artifacts_expire_in: '30 days') expect(setting).to be_valid expect(setting.default_artifacts_expire_in).to eq('30 days') end it 'sets the value if it is 0' do - setting.update(default_artifacts_expire_in: '0') + setting.update!(default_artifacts_expire_in: '0') expect(setting).to be_valid expect(setting.default_artifacts_expire_in).to eq('0') @@ -400,18 +406,18 @@ RSpec.describe ApplicationSetting do context 'auto_devops_domain setting' do context 'when auto_devops_enabled? is true' do before do - setting.update(auto_devops_enabled: true) + setting.update!(auto_devops_enabled: true) end it 'can be blank' do - setting.update(auto_devops_domain: '') + setting.update!(auto_devops_domain: '') expect(setting).to be_valid end context 'with a valid value' do before do - setting.update(auto_devops_domain: 'domain.com') + setting.update!(auto_devops_domain: 'domain.com') end it 'is valid' do @@ -421,7 +427,9 @@ RSpec.describe ApplicationSetting do context 'with an invalid value' do before do - setting.update(auto_devops_domain: 'definitelynotahostname') + expect do + setting.update!(auto_devops_domain: 'definitelynotahostname') + end.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Auto devops domain is not a fully qualified domain name") end it 'is invalid' do diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb index ab24828a057..4f8e1ac99af 100644 --- a/spec/support/shared_contexts/navbar_structure_context.rb +++ b/spec/support/shared_contexts/navbar_structure_context.rb @@ -181,7 +181,8 @@ RSpec.shared_context 'group navbar structure' do { nav_item: _('Group information'), nav_sub_items: [ - _('Activity') + _('Activity'), + _('Labels') ] } end @@ -194,7 +195,6 @@ RSpec.shared_context 'group navbar structure' do nav_sub_items: [ _('List'), _('Board'), - _('Labels'), _('Milestones') ] }, diff --git a/vendor/project_templates/rails.tar.gz b/vendor/project_templates/rails.tar.gz Binary files differindex 5ead9bd8459..357a049da44 100644 --- a/vendor/project_templates/rails.tar.gz +++ b/vendor/project_templates/rails.tar.gz |