From 6a0085290e97f344d3ed69463c8a1f729a337bc4 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 15 Oct 2020 00:08:42 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop.yml | 2 +- Gemfile | 2 +- Gemfile.lock | 4 +- app/controllers/concerns/redis_tracking.rb | 13 ++- app/controllers/concerns/wiki_actions.rb | 6 ++ .../experience_levels_controller.rb | 8 +- app/presenters/project_presenter.rb | 18 ++-- .../262686-track-unique-wiki-page-views.yml | 5 ++ ...page-default-view-for-anonoymous-users.yml | 5 ++ .../track_unique_wiki_page_views.yml | 7 ++ doc/administration/database_load_balancing.md | 4 +- doc/administration/geo/index.md | 4 +- .../replication/version_specific_updates.md | 8 +- doc/administration/gitaly/index.md | 2 +- .../operations/sidekiq_memory_killer.md | 2 +- .../raketasks/uploads/sanitize.md | 2 +- doc/administration/terraform_state.md | 6 ++ .../troubleshooting/log_parsing.md | 2 +- .../troubleshooting/tracing_correlation_id.md | 2 +- doc/api/commits.md | 2 +- doc/api/container_registry.md | 2 +- doc/api/instance_level_ci_variables.md | 6 +- doc/api/v3_to_v4.md | 2 +- .../github_integration.md | 2 - doc/ci/ci_cd_for_external_repos/index.md | 1 - doc/ci/environments/index.md | 4 +- .../laravel_with_gitlab_and_envoy/index.md | 11 +-- .../index.md | 2 - doc/ci/merge_request_pipelines/index.md | 1 - .../merge_trains/index.md | 1 - doc/ci/pipelines/index.md | 9 +- doc/ci/pipelines/job_artifacts.md | 3 - doc/ci/pipelines/schedules.md | 5 +- doc/ci/pipelines/settings.md | 13 ++- doc/ci/variables/README.md | 10 +-- doc/ci/variables/deprecated_variables.md | 1 - .../variables/where_variables_can_be_used.md | 12 ++- doc/ci/yaml/README.md | 15 ++-- .../database/not_null_constraints.md | 2 +- doc/development/geo.md | 2 +- doc/development/go_guide/index.md | 4 +- doc/development/gotchas.md | 2 +- doc/development/migration_style_guide.md | 2 +- doc/install/aws/index.md | 2 +- doc/install/installation.md | 6 +- doc/raketasks/import.md | 2 +- doc/topics/autodevops/stages.md | 4 +- doc/user/clusters/applications.md | 2 +- doc/user/group/index.md | 2 +- doc/user/permissions.md | 4 +- .../integrations/services_templates.md | 44 ++++++++-- .../project/issues/issue_data_and_actions.md | 2 +- .../project/merge_requests/revert_changes.md | 2 +- doc/user/project/protected_branches.md | 2 +- doc/user/todos.md | 2 +- lib/api/access_requests.rb | 2 +- lib/api/admin/ci/variables.rb | 2 +- lib/api/admin/instance_clusters.rb | 2 +- lib/api/admin/sidekiq.rb | 2 +- lib/api/api.rb | 2 +- lib/api/appearance.rb | 2 +- lib/api/applications.rb | 2 +- lib/api/avatar.rb | 2 +- lib/api/award_emoji.rb | 2 +- lib/api/badges.rb | 2 +- lib/api/base.rb | 6 ++ lib/api/boards.rb | 2 +- lib/api/branches.rb | 2 +- lib/api/broadcast_messages.rb | 2 +- lib/api/ci/pipeline_schedules.rb | 2 +- lib/api/ci/pipelines.rb | 2 +- lib/api/ci/runner.rb | 2 +- lib/api/ci/runners.rb | 2 +- lib/api/commit_statuses.rb | 2 +- lib/api/commits.rb | 2 +- lib/api/composer_packages.rb | 2 +- lib/api/conan_instance_packages.rb | 2 +- lib/api/conan_project_packages.rb | 2 +- lib/api/container_registry_event.rb | 2 +- lib/api/debian_group_packages.rb | 2 +- lib/api/debian_project_packages.rb | 2 +- lib/api/deploy_keys.rb | 2 +- lib/api/deploy_tokens.rb | 2 +- lib/api/deployments.rb | 2 +- lib/api/discussions.rb | 2 +- lib/api/environments.rb | 2 +- lib/api/error_tracking.rb | 2 +- lib/api/events.rb | 2 +- lib/api/feature_flag_scopes.rb | 2 +- lib/api/feature_flags.rb | 2 +- lib/api/feature_flags_user_lists.rb | 2 +- lib/api/features.rb | 2 +- lib/api/files.rb | 2 +- lib/api/freeze_periods.rb | 2 +- lib/api/generic_packages.rb | 2 +- lib/api/go_proxy.rb | 2 +- lib/api/group_boards.rb | 2 +- lib/api/group_clusters.rb | 2 +- lib/api/group_container_repositories.rb | 2 +- lib/api/group_export.rb | 2 +- lib/api/group_import.rb | 2 +- lib/api/group_labels.rb | 2 +- lib/api/group_milestones.rb | 2 +- lib/api/group_packages.rb | 2 +- lib/api/group_variables.rb | 2 +- lib/api/groups.rb | 2 +- lib/api/import_bitbucket_server.rb | 2 +- lib/api/import_github.rb | 2 +- lib/api/internal/base.rb | 2 +- lib/api/internal/kubernetes.rb | 2 +- lib/api/internal/lfs.rb | 2 +- lib/api/internal/pages.rb | 2 +- lib/api/issue_links.rb | 2 +- lib/api/issues.rb | 2 +- lib/api/job_artifacts.rb | 2 +- lib/api/jobs.rb | 2 +- lib/api/keys.rb | 2 +- lib/api/labels.rb | 2 +- lib/api/lint.rb | 2 +- lib/api/markdown.rb | 2 +- lib/api/maven_packages.rb | 2 +- lib/api/members.rb | 2 +- lib/api/merge_request_approvals.rb | 2 +- lib/api/merge_request_diffs.rb | 2 +- lib/api/merge_requests.rb | 2 +- lib/api/metrics/dashboard/annotations.rb | 2 +- lib/api/metrics/user_starred_dashboards.rb | 2 +- lib/api/namespaces.rb | 2 +- lib/api/notes.rb | 2 +- lib/api/notification_settings.rb | 2 +- lib/api/npm_packages.rb | 2 +- lib/api/nuget_packages.rb | 2 +- lib/api/package_files.rb | 2 +- lib/api/pages.rb | 2 +- lib/api/pages_domains.rb | 2 +- lib/api/project_clusters.rb | 2 +- lib/api/project_container_repositories.rb | 2 +- lib/api/project_events.rb | 2 +- lib/api/project_export.rb | 2 +- lib/api/project_hooks.rb | 2 +- lib/api/project_import.rb | 2 +- lib/api/project_milestones.rb | 2 +- lib/api/project_packages.rb | 2 +- lib/api/project_repository_storage_moves.rb | 2 +- lib/api/project_snapshots.rb | 2 +- lib/api/project_snippets.rb | 2 +- lib/api/project_statistics.rb | 2 +- lib/api/project_templates.rb | 2 +- lib/api/projects.rb | 2 +- lib/api/protected_branches.rb | 2 +- lib/api/protected_tags.rb | 2 +- lib/api/pypi_packages.rb | 2 +- lib/api/release/links.rb | 2 +- lib/api/releases.rb | 2 +- lib/api/remote_mirrors.rb | 2 +- lib/api/repositories.rb | 2 +- lib/api/resource_label_events.rb | 2 +- lib/api/resource_milestone_events.rb | 2 +- lib/api/resource_state_events.rb | 2 +- lib/api/search.rb | 2 +- lib/api/services.rb | 2 +- lib/api/settings.rb | 2 +- lib/api/sidekiq_metrics.rb | 2 +- lib/api/snippets.rb | 2 +- lib/api/statistics.rb | 2 +- lib/api/submodules.rb | 2 +- lib/api/subscriptions.rb | 2 +- lib/api/suggestions.rb | 2 +- lib/api/system_hooks.rb | 2 +- lib/api/tags.rb | 2 +- lib/api/templates.rb | 2 +- lib/api/terraform/state.rb | 2 +- lib/api/terraform/state_version.rb | 2 +- lib/api/todos.rb | 2 +- lib/api/triggers.rb | 2 +- lib/api/unleash.rb | 2 +- lib/api/usage_data.rb | 2 +- lib/api/user_counts.rb | 2 +- lib/api/users.rb | 2 +- lib/api/v3/github.rb | 2 +- lib/api/variables.rb | 2 +- lib/api/version.rb | 2 +- lib/api/wikis.rb | 2 +- lib/gitlab/experimentation.rb | 3 + .../api/{grape_api_instance.rb => base.rb} | 25 ++++-- .../concerns/redis_tracking_spec.rb | 82 +++++++++++++++---- .../projects/blob_controller_spec.rb | 4 +- spec/controllers/projects_controller_spec.rb | 4 +- .../experience_levels_controller_spec.rb | 49 +++++++++-- spec/controllers/search_controller_spec.rb | 2 +- .../projects/features_visibility_spec.rb | 2 +- .../projects/user_sees_sidebar_spec.rb | 59 ++++++++++++- spec/presenters/project_presenter_spec.rb | 51 ++++++++++-- spec/rubocop/cop/api/base_spec.rb | 35 ++++++++ .../cop/api/grape_api_instance_spec.rb | 29 ------- .../controllers/unique_hll_events_examples.rb | 49 +++-------- .../wiki_actions_shared_examples.rb | 67 ++++++++------- 197 files changed, 620 insertions(+), 391 deletions(-) create mode 100644 changelogs/unreleased/262686-track-unique-wiki-page-views.yml create mode 100644 changelogs/unreleased/copy-project-homepage-default-view-for-anonoymous-users.yml create mode 100644 config/feature_flags/development/track_unique_wiki_page_views.yml create mode 100644 lib/api/base.rb rename rubocop/cop/api/{grape_api_instance.rb => base.rb} (50%) create mode 100644 spec/rubocop/cop/api/base_spec.rb delete mode 100644 spec/rubocop/cop/api/grape_api_instance_spec.rb diff --git a/.rubocop.yml b/.rubocop.yml index eb5beb6633a..28a9db5fdda 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -335,7 +335,7 @@ Gitlab/Union: - 'spec/**/*' - 'ee/spec/**/*' -API/GrapeAPIInstance: +API/Base: Enabled: true Include: - 'lib/**/api/**/*.rb' diff --git a/Gemfile b/Gemfile index 116a58cf4b2..1632045262b 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'default_value_for', '~> 3.3.0' gem 'pg', '~> 1.1' gem 'rugged', '~> 0.28' -gem 'grape-path-helpers', '~> 1.3' +gem 'grape-path-helpers', '~> 1.4' gem 'faraday', '~> 1.0' gem 'marginalia', '~> 1.9.0' diff --git a/Gemfile.lock b/Gemfile.lock index 437a39d5ac4..34a2e6ee28e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -495,7 +495,7 @@ GEM grape-entity (0.7.1) activesupport (>= 4.0) multi_json (>= 1.3.2) - grape-path-helpers (1.3.0) + grape-path-helpers (1.4.0) activesupport grape (~> 1.3) rake (~> 12) @@ -1348,7 +1348,7 @@ DEPENDENCIES gpgme (~> 2.0.19) grape (= 1.4.0) grape-entity (~> 0.7.1) - grape-path-helpers (~> 1.3) + grape-path-helpers (~> 1.4) grape_logging (~> 1.7) graphiql-rails (~> 1.4.10) graphql (~> 1.11.4) diff --git a/app/controllers/concerns/redis_tracking.rb b/app/controllers/concerns/redis_tracking.rb index fdd22cc0da0..d81bd10d5bb 100644 --- a/app/controllers/concerns/redis_tracking.rb +++ b/app/controllers/concerns/redis_tracking.rb @@ -11,12 +11,17 @@ # # if the feature flag is enabled by default you should use # track_redis_hll_event :index, :show, name: 'i_analytics_dev_ops_score', feature: :my_feature, feature_default_enabled: true +# +# You can also pass custom conditions using `if:`, using the same format as with Rails callbacks. module RedisTracking extend ActiveSupport::Concern class_methods do - def track_redis_hll_event(*controller_actions, name:, feature:, feature_default_enabled: false) - after_action only: controller_actions, if: -> { request.format.html? && request.headers['DNT'] != '1' } do + def track_redis_hll_event(*controller_actions, name:, feature:, feature_default_enabled: false, if: nil) + custom_conditions = Array.wrap(binding.local_variable_get('if')) + conditions = [:trackable_request?, *custom_conditions] + + after_action only: controller_actions, if: conditions do track_unique_redis_hll_event(name, feature, feature_default_enabled) end end @@ -31,6 +36,10 @@ module RedisTracking Gitlab::UsageDataCounters::HLLRedisCounter.track_event(visitor_id, event_name) end + def trackable_request? + request.format.html? && request.headers['DNT'] != '1' + end + def metric_feature_enabled?(feature, default_enabled) Feature.enabled?(feature, default_enabled: default_enabled) end diff --git a/app/controllers/concerns/wiki_actions.rb b/app/controllers/concerns/wiki_actions.rb index 4d1684ec3a2..aed109309e3 100644 --- a/app/controllers/concerns/wiki_actions.rb +++ b/app/controllers/concerns/wiki_actions.rb @@ -5,6 +5,7 @@ module WikiActions include PreviewMarkdown include SendsBlob include Gitlab::Utils::StrongMemoize + include RedisTracking extend ActiveSupport::Concern included do @@ -31,6 +32,11 @@ module WikiActions end end + # NOTE: We want to include wiki page views in the same counter as the other + # Event-based wiki actions tracked through TrackUniqueEvents, so we use the same event name. + track_redis_hll_event :show, name: Gitlab::UsageDataCounters::TrackUniqueEvents::WIKI_ACTION.to_s, + feature: :track_unique_wiki_page_views, feature_default_enabled: true + helper_method :view_file_button, :diff_file_html_data end diff --git a/app/controllers/registrations/experience_levels_controller.rb b/app/controllers/registrations/experience_levels_controller.rb index eb2b899d20e..23126983eb5 100644 --- a/app/controllers/registrations/experience_levels_controller.rb +++ b/app/controllers/registrations/experience_levels_controller.rb @@ -14,7 +14,13 @@ module Registrations if current_user.save hide_advanced_issues - redirect_to group_path(params[:namespace_path]) + record_experiment_user(:default_to_issues_board) + + if experiment_enabled?(:default_to_issues_board) && learn_gitlab.available? + redirect_to namespace_project_board_path(params[:namespace_path], learn_gitlab.project, learn_gitlab.board) + else + redirect_to group_path(params[:namespace_path]) + end else render :show end diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 4732f895b0d..392eeafb2b4 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -65,14 +65,14 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated if can?(current_user, :download_code, project) user_view - elsif user_view == "activity" - "activity" - elsif can?(current_user, :read_wiki, project) - "wiki" - elsif feature_available?(:issues, current_user) - "projects/issues/issues" + elsif user_view == 'activity' + 'activity' + elsif project.wiki_repository_exists? && can?(current_user, :read_wiki, project) + 'wiki' + elsif can?(current_user, :read_issue, project) + 'projects/issues/issues' else - "customize_workflow" + 'activity' end end @@ -407,6 +407,10 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated def anonymous_project_view if !project.empty_repo? && can?(current_user, :download_code, project) 'files' + elsif project.wiki_repository_exists? && can?(current_user, :read_wiki, project) + 'wiki' + elsif can?(current_user, :read_issue, project) + 'projects/issues/issues' else 'activity' end diff --git a/changelogs/unreleased/262686-track-unique-wiki-page-views.yml b/changelogs/unreleased/262686-track-unique-wiki-page-views.yml new file mode 100644 index 00000000000..3b40651c42b --- /dev/null +++ b/changelogs/unreleased/262686-track-unique-wiki-page-views.yml @@ -0,0 +1,5 @@ +--- +title: Track unique wiki page views in Usage Ping +merge_request: 44622 +author: +type: changed diff --git a/changelogs/unreleased/copy-project-homepage-default-view-for-anonoymous-users.yml b/changelogs/unreleased/copy-project-homepage-default-view-for-anonoymous-users.yml new file mode 100644 index 00000000000..cc4bba49c42 --- /dev/null +++ b/changelogs/unreleased/copy-project-homepage-default-view-for-anonoymous-users.yml @@ -0,0 +1,5 @@ +--- +title: Copy project homepage default view for anonymous users +merge_request: 44606 +author: George Tsiolis +type: changed diff --git a/config/feature_flags/development/track_unique_wiki_page_views.yml b/config/feature_flags/development/track_unique_wiki_page_views.yml new file mode 100644 index 00000000000..0e8120635ab --- /dev/null +++ b/config/feature_flags/development/track_unique_wiki_page_views.yml @@ -0,0 +1,7 @@ +--- +name: track_unique_wiki_page_views +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44622 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/267162 +type: development +group: group::knowledge +default_enabled: true diff --git a/doc/administration/database_load_balancing.md b/doc/administration/database_load_balancing.md index 36ef905fd90..ff9b6c92800 100644 --- a/doc/administration/database_load_balancing.md +++ b/doc/administration/database_load_balancing.md @@ -128,7 +128,7 @@ production: disconnect_timeout: 120 ``` -Here the `discover:` section specifies the configuration details to use for +Here, the `discover:` section specifies the configuration details to use for service discovery. ### Configuration @@ -139,7 +139,7 @@ The following options can be set: |----------------------|---------------------------------------------------------------------------------------------------|-----------| | `nameserver` | The nameserver to use for looking up the DNS record. | localhost | | `record` | The record to look up. This option is required for service discovery to work. | | -| `record_type` | Optional record type to look up, this can be either A or SRV (since GitLab 12.3) | A | +| `record_type` | Optional record type to look up, this can be either A or SRV (GitLab 12.3 and later) | A | | `port` | The port of the nameserver. | 8600 | | `interval` | The minimum time in seconds between checking the DNS record. | 60 | | `disconnect_timeout` | The time in seconds after which an old connection is closed, after the list of hosts was updated. | 120 | diff --git a/doc/administration/geo/index.md b/doc/administration/geo/index.md index 47d19c1e12c..8767940816b 100644 --- a/doc/administration/geo/index.md +++ b/doc/administration/geo/index.md @@ -67,7 +67,7 @@ Keep in mind that: - **Secondary** nodes talk to the **primary** node to: - Get user data for logins (API). - Replicate repositories, LFS Objects, and Attachments (HTTPS + JWT). -- Since GitLab Premium 10.0, the **primary** node no longer talks to **secondary** nodes to notify for changes (API). +- In GitLab Premium 10.0 and later, the **primary** node no longer talks to **secondary** nodes to notify for changes (API). - Pushing directly to a **secondary** node (for both HTTP and SSH, including Git LFS) was [introduced](https://about.gitlab.com/releases/2018/09/22/gitlab-11-3-released/) in [GitLab Premium](https://about.gitlab.com/pricing/#self-managed) 11.3. - There are [limitations](#limitations) when using Geo. @@ -282,7 +282,7 @@ For answers to common questions, see the [Geo FAQ](replication/faq.md). ## Log files -Since GitLab 9.5, Geo stores structured log messages in a `geo.log` file. For Omnibus installations, this file is at `/var/log/gitlab/gitlab-rails/geo.log`. +In GitLab 9.5 and later, Geo stores structured log messages in a `geo.log` file. For Omnibus installations, this file is at `/var/log/gitlab/gitlab-rails/geo.log`. This file contains information about when Geo attempts to sync repositories and files. Each line in the file contains a separate JSON entry that can be ingested into. For example, Elasticsearch or Splunk. diff --git a/doc/administration/geo/replication/version_specific_updates.md b/doc/administration/geo/replication/version_specific_updates.md index 71facb808ab..85c869eff92 100644 --- a/doc/administration/geo/replication/version_specific_updates.md +++ b/doc/administration/geo/replication/version_specific_updates.md @@ -397,7 +397,7 @@ existing repositories was added in GitLab 10.1. ## Updating to GitLab 10.0 -Since GitLab 10.0, we require all **Geo** systems to [use SSH key lookups via +In GitLab 10.0 and later, we require all **Geo** systems to [use SSH key lookups via the database](../../operations/fast_ssh_key_lookup.md) to avoid having to maintain consistency of the `authorized_keys` file for SSH access. Failing to do this will prevent users from being able to clone via SSH. @@ -611,9 +611,9 @@ is prepended with the relevant node for better clarity: ### Update tracking database on **secondary** node -After updating a **secondary** node, you might need to run migrations on -the tracking database. The tracking database was added in GitLab 9.1, -and it is required since 10.0. +After updating a **secondary** node, you might need to run migrations on the +tracking database. The tracking database was added in GitLab 9.1, and is +required in GitLab 10.0 and later. 1. Run database migrations on tracking database: diff --git a/doc/administration/gitaly/index.md b/doc/administration/gitaly/index.md index aed8a0d0a7f..59a6f2596da 100644 --- a/doc/administration/gitaly/index.md +++ b/doc/administration/gitaly/index.md @@ -93,7 +93,7 @@ When running Gitaly on its own server, note the following regarding GitLab versi NFS. To use Elasticsearch in these versions, the [repository indexer](../../integration/elasticsearch.md#elasticsearch-repository-indexer) must be enabled in your GitLab configuration. -- [Since GitLab 12.3](https://gitlab.com/gitlab-org/gitlab/-/issues/6481), the new indexer is +- [In GitLab 12.3 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/6481), the new indexer is the default and no configuration is required. ### Network architecture diff --git a/doc/administration/operations/sidekiq_memory_killer.md b/doc/administration/operations/sidekiq_memory_killer.md index d1ff98a0079..1172e90b166 100644 --- a/doc/administration/operations/sidekiq_memory_killer.md +++ b/doc/administration/operations/sidekiq_memory_killer.md @@ -8,7 +8,7 @@ MemoryKiller applies the same approach to the Sidekiq processes used by GitLab to process background jobs. Unlike puma-worker-killer, which is enabled by default for all GitLab -installations since GitLab 13.0, the Sidekiq MemoryKiller is enabled by default +installations of GitLab 13.0 and later, the Sidekiq MemoryKiller is enabled by default _only_ for Omnibus packages. The reason for this is that the MemoryKiller relies on runit to restart Sidekiq after a memory-induced shutdown and GitLab installations from source do not all use runit or an equivalent. diff --git a/doc/administration/raketasks/uploads/sanitize.md b/doc/administration/raketasks/uploads/sanitize.md index 9586ab2c6f4..54aa62059cf 100644 --- a/doc/administration/raketasks/uploads/sanitize.md +++ b/doc/administration/raketasks/uploads/sanitize.md @@ -1,6 +1,6 @@ # Uploads sanitize Rake tasks **(CORE ONLY)** -Since GitLab 11.9, EXIF data is automatically stripped from JPG or TIFF image uploads. +In GitLab 11.9 and later, EXIF data is automatically stripped from JPG or TIFF image uploads. EXIF data may contain sensitive information (for example, GPS location), so you can remove EXIF data from existing images that were uploaded to an earlier version of GitLab. diff --git a/doc/administration/terraform_state.md b/doc/administration/terraform_state.md index 76e54acce16..55e166d2bf7 100644 --- a/doc/administration/terraform_state.md +++ b/doc/administration/terraform_state.md @@ -1,3 +1,9 @@ +--- +stage: Configure +group: Configure +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + # Terraform state administration (alpha) > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2673) in GitLab 12.10. diff --git a/doc/administration/troubleshooting/log_parsing.md b/doc/administration/troubleshooting/log_parsing.md index dcd1df2f423..557a6a32b82 100644 --- a/doc/administration/troubleshooting/log_parsing.md +++ b/doc/administration/troubleshooting/log_parsing.md @@ -3,7 +3,7 @@ We recommend using log aggregation and search tools like Kibana and Splunk whenever possible, but if they are not available you can still quickly parse [GitLab logs](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26311) in JSON format -(the default since GitLab 12.0) using [`jq`](https://stedolan.github.io/jq/). +(the default in GitLab 12.0 and later) using [`jq`](https://stedolan.github.io/jq/). ## What is JQ? diff --git a/doc/administration/troubleshooting/tracing_correlation_id.md b/doc/administration/troubleshooting/tracing_correlation_id.md index c59ce97e2b8..ae9ebd90951 100644 --- a/doc/administration/troubleshooting/tracing_correlation_id.md +++ b/doc/administration/troubleshooting/tracing_correlation_id.md @@ -4,7 +4,7 @@ type: reference # Finding relevant log entries with a correlation ID -Since GitLab 11.6, a unique request tracking ID, known as the "correlation ID" has been +In GitLab 11.6 and later, a unique request tracking ID, known as the "correlation ID" has been logged by the GitLab instance for most requests. Each individual request to GitLab gets its own correlation ID, which then gets logged in each GitLab component's logs for that request. This makes it easier to trace behavior in a diff --git a/doc/api/commits.md b/doc/api/commits.md index da95e9a943f..66b34d4bc75 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -614,7 +614,7 @@ Example response: ## Commit status -Since GitLab 8.1, this is the new commit status API. +In GitLab 8.1 and later, this is the new commit status API. ### List the statuses of a commit diff --git a/doc/api/container_registry.md b/doc/api/container_registry.md index 3ce04b0c189..3a7ebf9a2aa 100644 --- a/doc/api/container_registry.md +++ b/doc/api/container_registry.md @@ -272,7 +272,7 @@ action doesn't delete blobs. To delete them and recycle disk space, [run the garbage collection](https://docs.gitlab.com/omnibus/maintenance/README.html#removing-unused-layers-not-referenced-by-manifests). NOTE: **Note:** -Since GitLab 12.4, individual tags are deleted. +In GitLab 12.4 and later, individual tags are deleted. For more details, see the [discussion](https://gitlab.com/gitlab-org/gitlab/-/issues/15737). Examples: diff --git a/doc/api/instance_level_ci_variables.md b/doc/api/instance_level_ci_variables.md index d8f306a822c..e8550d41c44 100644 --- a/doc/api/instance_level_ci_variables.md +++ b/doc/api/instance_level_ci_variables.md @@ -70,7 +70,7 @@ curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/a Create a new instance-level variable. -[Since GitLab 13.1](https://gitlab.com/gitlab-org/gitlab/-/issues/216097), the maximum number of allowed instance-level variables can be changed. +[In GitLab 13.1 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/216097), the maximum number of allowed instance-level variables can be changed. ```plaintext POST /admin/ci/variables @@ -79,7 +79,7 @@ POST /admin/ci/variables | Attribute | Type | required | Description | |-----------------|---------|----------|-----------------------| | `key` | string | yes | The `key` of a variable. Max 255 characters, only `A-Z`, `a-z`, `0-9`, and `_` are allowed. | -| `value` | string | yes | The `value` of a variable. 10,000 characters allowed. [Since GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/220028) | +| `value` | string | yes | The `value` of a variable. 10,000 characters allowed ([GitLab 13.3 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/220028)). | | `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file`. | | `protected` | boolean | no | Whether the variable is protected. | | `masked` | boolean | no | Whether the variable is masked. | @@ -109,7 +109,7 @@ PUT /admin/ci/variables/:key | Attribute | Type | required | Description | |-----------------|---------|----------|-------------------------| | `key` | string | yes | The `key` of a variable. | -| `value` | string | yes | The `value` of a variable. [Since GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/220028), around 10,000 characters allowed. Previously 700 characters. | +| `value` | string | yes | The `value` of a variable. 10,000 characters allowed ([GitLab 13.3 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/220028)). | | `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file`. | | `protected` | boolean | no | Whether the variable is protected. | | `masked` | boolean | no | Whether the variable is masked. | diff --git a/doc/api/v3_to_v4.md b/doc/api/v3_to_v4.md index 4139438bea0..c351c14e24c 100644 --- a/doc/api/v3_to_v4.md +++ b/doc/api/v3_to_v4.md @@ -1,6 +1,6 @@ # API V3 to API V4 -Since GitLab 9.0, API V4 is the preferred version to be used. +In GitLab 9.0 and later, API V4 is the preferred version to be used. API V3 was unsupported from GitLab 9.5, released on August 22, 2017. API v3 was removed in [GitLab 11.0](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/36819). diff --git a/doc/ci/ci_cd_for_external_repos/github_integration.md b/doc/ci/ci_cd_for_external_repos/github_integration.md index 661d935fc1d..7ee9f98bd39 100644 --- a/doc/ci/ci_cd_for_external_repos/github_integration.md +++ b/doc/ci/ci_cd_for_external_repos/github_integration.md @@ -21,7 +21,6 @@ cannot be used to authenticate with GitHub as an external CI/CD repository. ## Connect with Personal Access Token -NOTE: **Note:** Personal access tokens can only be used to connect GitHub.com repositories to GitLab, and the GitHub user must have the [owner role](https://docs.github.com/en/github/getting-started-with-github/access-permissions-on-github). @@ -53,7 +52,6 @@ GitLab will: ## Connect manually -NOTE: **Note:** To use **GitHub Enterprise** with **GitLab.com**, use this method. To manually enable GitLab CI/CD for your repository: diff --git a/doc/ci/ci_cd_for_external_repos/index.md b/doc/ci/ci_cd_for_external_repos/index.md index 78988e8a057..c6590599849 100644 --- a/doc/ci/ci_cd_for_external_repos/index.md +++ b/doc/ci/ci_cd_for_external_repos/index.md @@ -74,7 +74,6 @@ If changes are pushed to the branch referenced by the Pull Request and the Pull Request is still open, a pipeline for the external pull request is created. -NOTE: **Note:** GitLab CI/CD will create 2 pipelines in this case. One for the branch push and one for the external pull request. diff --git a/doc/ci/environments/index.md b/doc/ci/environments/index.md index b39fb69d64c..baf2156e64a 100644 --- a/doc/ci/environments/index.md +++ b/doc/ci/environments/index.md @@ -892,7 +892,7 @@ you can monitor the behavior of your app running in each environment. For the mo dashboard to appear, you need to Configure Prometheus to collect at least one [supported metric](../../user/project/integrations/prometheus_library/index.md). -Since GitLab 9.2, all deployments to an environment are shown directly on the monitoring dashboard. +In GitLab 9.2 and later, all deployments to an environment are shown directly on the monitoring dashboard. Once configured, GitLab will attempt to retrieve [supported performance metrics](../../user/project/integrations/prometheus_library/index.md) for any environment that has had a successful deployment. If monitoring data was @@ -956,7 +956,7 @@ session and even a multiplexer like `screen` or `tmux`. ### Check out deployments locally -Since GitLab 8.13, a reference in the Git repository is saved for each deployment, so +In GitLab 8.13 and later, a reference in the Git repository is saved for each deployment, so knowing the state of your current environments is only a `git fetch` away. In your Git configuration, append the `[remote ""]` block with an extra diff --git a/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md b/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md index d3f2d8223ef..aaa34afeddf 100644 --- a/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md +++ b/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md @@ -143,7 +143,6 @@ Now, let's clone our repository on the server just to make sure the `deployer` u git clone git@gitlab.example.com:/laravel-sample.git ``` -NOTE: **Note:** Answer **yes** if asked `Are you sure you want to continue connecting (yes/no)?`. It adds GitLab.com to the known hosts. @@ -167,7 +166,6 @@ server { } ``` -NOTE: **Note:** You may replace the app's name in `/var/www/app/current/public` with the folder name of your application. ## Setting up Envoy @@ -441,7 +439,9 @@ On your GitLab project repository navigate to the **Registry** tab. You may need to enable the Container Registry for your project to see this tab. You'll find it under your project's **Settings > General > Visibility, project features, permissions**. -To start using Container Registry on our machine, we first need to sign in to the GitLab registry using our GitLab username and password: +To start using Container Registry on our machine, we first need to sign in to the GitLab registry using our GitLab username and password. +Make sure you have [Docker](https://docs.docker.com/engine/installation/) installed on our machine, +then run the following commands: ```shell docker login registry.gitlab.com @@ -455,14 +455,10 @@ docker build -t registry.gitlab.com//laravel-sample . docker push registry.gitlab.com//laravel-sample ``` -NOTE: **Note:** -To run the above commands, we first need to have [Docker](https://docs.docker.com/engine/installation/) installed on our machine. - Congratulations! You just pushed the first Docker image to the GitLab Registry, and if you refresh the page you should be able to see it: ![container registry page with image](img/container_registry_page_with_image.jpg) -NOTE: **Note:** You can also [use GitLab CI/CD](https://about.gitlab.com/blog/2016/05/23/gitlab-container-registry/#use-with-gitlab-ci) to build and push your Docker images, rather than doing that on your machine. We'll use this image further down in the `.gitlab-ci.yml` configuration file to handle the process of testing and deploying our app. @@ -542,7 +538,6 @@ services: ... ``` -NOTE: **Note:** If you wish to test your app with different PHP versions and [database management systems](../../services/README.md), you can define different `image` and `services` keywords for each test job. #### Variables diff --git a/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md b/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md index ab6a4d3f507..c62f0dec598 100644 --- a/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md +++ b/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md @@ -117,7 +117,6 @@ Generated hello_gitlab_ci app The database for HelloGitlabCi.Repo has been created ``` -NOTE: **Note:** Phoenix assumes that our PostgreSQL database will have a `postgres` user account with the correct permissions and a password of `postgres`. If it's not your case, check [Ecto's instructions](https://hexdocs.pm/ecto/Ecto.html#module-repositories). @@ -205,7 +204,6 @@ when running our Phoenix in our `localhost`. Without `.gitkeep`, Git will not upload this empty directory and we'll got an error when running our test on GitLab. - NOTE: **Note:** If we add a folder via the GitLab UI, GitLab itself will add the `.gitkeep` to that new dir. Now, let's run a local test and see if everything we did didn't break anything. diff --git a/doc/ci/merge_request_pipelines/index.md b/doc/ci/merge_request_pipelines/index.md index 1fc5283f604..cc0b4ac1f86 100644 --- a/doc/ci/merge_request_pipelines/index.md +++ b/doc/ci/merge_request_pipelines/index.md @@ -24,7 +24,6 @@ can run a pipeline for merge requests. ![Merge request page](img/merge_request.png) -NOTE: **Note:** If you use this feature with [merge when pipeline succeeds](../../user/project/merge_requests/merge_when_pipeline_succeeds.md), pipelines for merge requests take precedence over the other regular pipelines. diff --git a/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md b/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md index 1f88e8f832f..45cae49377f 100644 --- a/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md +++ b/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md @@ -37,7 +37,6 @@ run. To add a merge request to a merge train, you need [permissions](../../../../user/permissions.md) to push to the target branch. -NOTE: **Note:** Each merge train can run a maximum of **twenty** pipelines in parallel. If more than twenty merge requests are added to the merge train, the merge requests will be queued until a slot in the merge train is free. There is no limit to the diff --git a/doc/ci/pipelines/index.md b/doc/ci/pipelines/index.md index f172032630d..f7e3698b6d4 100644 --- a/doc/ci/pipelines/index.md +++ b/doc/ci/pipelines/index.md @@ -10,7 +10,7 @@ type: reference > Introduced in GitLab 8.8. -NOTE: **Tip:** +TIP: **Tip:** Watch the ["Mastering continuous software development"](https://about.gitlab.com/webcast/mastering-ci-cd/) webcast to see a comprehensive demo of a GitLab CI/CD pipeline. @@ -101,8 +101,8 @@ you can filter the pipeline list by: - Trigger author - Branch name -- Status ([since GitLab 13.1](https://gitlab.com/gitlab-org/gitlab/-/issues/217617)) -- Tag ([since GitLab 13.1](https://gitlab.com/gitlab-org/gitlab/-/issues/217617)) +- Status ([GitLab 13.1 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/217617)) +- Tag ([GitLab 13.1 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/217617)) ### Run a pipeline manually @@ -114,7 +114,7 @@ operation of the pipeline. To execute a pipeline manually: 1. Navigate to your project's **CI/CD > Pipelines**. -1. Click on the **Run Pipeline** button. +1. Select the **Run Pipeline** button. 1. On the **Run Pipeline** page: 1. Select the branch to run the pipeline for in the **Create for** field. 1. Enter any [environment variables](../variables/README.md) required for the pipeline run. @@ -495,7 +495,6 @@ and their statuses. Pipeline graphs can be displayed in two different ways, depending on the page you access the graph from. -NOTE: **Note:** GitLab capitalizes the stages' names in the pipeline graphs. ### Regular pipeline graphs diff --git a/doc/ci/pipelines/job_artifacts.md b/doc/ci/pipelines/job_artifacts.md index fc04ea87c40..d904452a011 100644 --- a/doc/ci/pipelines/job_artifacts.md +++ b/doc/ci/pipelines/job_artifacts.md @@ -61,12 +61,10 @@ The `artifacts:reports` keyword is used for collecting test reports, code qualit reports, and security reports from jobs. It also exposes these reports in GitLab's UI (merge requests, pipeline views, and security dashboards). -NOTE: **Note:** The test reports are collected regardless of the job results (success or failure). You can use [`artifacts:expire_in`](../yaml/README.md#artifactsexpire_in) to set up an expiration date for their artifacts. -NOTE: **Note:** If you also want the ability to browse the report output files, include the [`artifacts:paths`](../yaml/README.md#artifactspaths) keyword. @@ -96,7 +94,6 @@ rspec: The collected Unit test reports upload to GitLab as an artifact and display in merge requests. -NOTE: **Note:** If the JUnit tool you use exports to multiple XML files, specify multiple test report paths within a single job to concatenate them into a single file. Use a filename pattern (`junit: rspec-*.xml`), diff --git a/doc/ci/pipelines/schedules.md b/doc/ci/pipelines/schedules.md index e488179ffee..bcdb7c4c8b6 100644 --- a/doc/ci/pipelines/schedules.md +++ b/doc/ci/pipelines/schedules.md @@ -11,9 +11,6 @@ type: reference, howto > - Introduced in GitLab 9.1 as [Trigger Schedule](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10533). > - [Renamed to Pipeline Schedule](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10853) in GitLab 9.2. -NOTE: **Note:** -Cron notation is parsed by [Fugit](https://github.com/floraison/fugit). - Pipelines are normally run based on certain conditions being met. For example, when a branch is pushed to repository. Pipeline schedules can be used to also run [pipelines](index.md) at specific intervals. For example: @@ -24,6 +21,8 @@ Pipeline schedules can be used to also run [pipelines](index.md) at specific int In addition to using the GitLab UI, pipeline schedules can be maintained using the [Pipeline schedules API](../../api/pipeline_schedules.md). +Schedule timing is configured with cron notation, parsed by [Fugit](https://github.com/floraison/fugit). + ## Prerequisites In order for a scheduled pipeline to be created successfully: diff --git a/doc/ci/pipelines/settings.md b/doc/ci/pipelines/settings.md index 24061ed36f3..143a5346e88 100644 --- a/doc/ci/pipelines/settings.md +++ b/doc/ci/pipelines/settings.md @@ -36,13 +36,11 @@ in `.gitlab-ci.yml`. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/28919) in GitLab 12.0. -NOTE: **Note:** -As of GitLab 12.0, newly created projects automatically have a default -`git depth` value of `50`. - It is possible to limit the number of changes that GitLab CI/CD fetches when cloning -a repository. Setting a limit to `git depth` can speed up Pipelines execution. Maximum -allowed value is `1000`. +a repository. Setting a limit to `git depth` can speed up Pipelines execution. + +In GitLab 12.0 and later, newly created projects automatically have a default +`git depth` value of `50`. The maximum allowed value is `1000`. To disable shallow clone and make GitLab CI/CD fetch all branches and tags each time, keep the value empty or set to `0`. @@ -180,8 +178,7 @@ This also determines the visibility of these related features: - Job artifacts - The [pipeline security dashboard](../../user/application_security/security_dashboard/index.md#pipeline-security) **(ULTIMATE)** -NOTE: **Note:** -Currently, job logs and artifacts are [not yet visible for guest users and non-project members](https://gitlab.com/gitlab-org/gitlab/-/issues/25649). +Job logs and artifacts are [not visible for guest users and non-project members](https://gitlab.com/gitlab-org/gitlab/-/issues/25649). If **Public pipelines** is enabled (default): diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md index c133af2c082..28502967c31 100644 --- a/doc/ci/variables/README.md +++ b/doc/ci/variables/README.md @@ -243,7 +243,7 @@ Some variables are listed in the UI so you can choose them more quickly. | `AWS_DEFAULT_REGION` | Any | 12.10 | | `AWS_SECRET_ACCESS_KEY` | Any | 12.10 | -NOTE: **Note:** +CAUTION: **Caution:** When you store credentials, there are security implications. If you are using AWS keys, for example, follow their [best practices](https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html). @@ -371,9 +371,6 @@ export GITLAB_USER_ID="42" ## `.gitlab-ci.yml` defined variables -NOTE: **Note:** -This feature requires GitLab Runner 0.5.0 or higher and GitLab 7.14 or higher. - You can add variables that are set in the build environment to `.gitlab-ci.yml`. These variables are saved in the repository, and they are meant to store non-sensitive project configuration, like `RAILS_ENV` or @@ -437,8 +434,7 @@ Once you set them, they are available for all subsequent pipelines. Any group-le Instance variables are useful for no longer needing to manually enter the same credentials repeatedly for all your projects. Instance-level variables are available to all projects and groups on the instance. -NOTE: **Note:** -The maximum number of instance-level variables is [planned to be 25](https://gitlab.com/gitlab-org/gitlab/-/issues/216097). +In GitLab 13.1 and later, the [maximum number of instance-level variables is 25](https://gitlab.com/gitlab-org/gitlab/-/issues/216097). You can define instance-level variables via the UI or [API](../../api/instance_level_ci_variables.md). @@ -448,7 +444,7 @@ To add an instance-level variable: 1. Click the **Add variable** button, and fill in the details: - **Key**: Must be one line, using only letters, numbers, or `_` (underscore), with no spaces. - - **Value**: [Since GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/220028), 10,000 characters allowed. This is also bounded by the limits of the selected runner operating system. In GitLab 13.0 to 13.2, 700 characters allowed. + - **Value**: [In GitLab 13.3 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/220028), 10,000 characters allowed. This is also bounded by the limits of the selected runner operating system. In GitLab 13.0 to 13.2, 700 characters allowed. - **Type**: `File` or `Variable`. - **Protect variable** (Optional): If selected, the variable is only available in pipelines that run on protected branches or tags. - **Mask variable** (Optional): If selected, the variable's **Value** is not shown in job logs. The variable is not saved if the value does not meet the [masking requirements](#masked-variable-requirements). diff --git a/doc/ci/variables/deprecated_variables.md b/doc/ci/variables/deprecated_variables.md index 94ec8439605..71e2b5b2e44 100644 --- a/doc/ci/variables/deprecated_variables.md +++ b/doc/ci/variables/deprecated_variables.md @@ -16,7 +16,6 @@ To follow conventions of naming across GitLab, and to further move away from the `build` term and toward `job`, some [CI/CD environment variables](README.md#predefined-environment-variables) were renamed for GitLab 9.0 release. -NOTE: **Note:** Starting with GitLab 9.0, we have deprecated the `$CI_BUILD_*` variables. **You are strongly advised to use the new variables as we will remove the old ones in future GitLab releases.** diff --git a/doc/ci/variables/where_variables_can_be_used.md b/doc/ci/variables/where_variables_can_be_used.md index 330b960ca9a..b4236ca34c2 100644 --- a/doc/ci/variables/where_variables_can_be_used.md +++ b/doc/ci/variables/where_variables_can_be_used.md @@ -38,15 +38,14 @@ There are two places defined variables can be used. On the: ### `config.toml` file -NOTE: **Note:** -You can read more about `config.toml` in the [GitLab Runner docs](https://docs.gitlab.com/runner/configuration/advanced-configuration.html). - | Definition | Can be expanded? | Description | |:-------------------------------------|:-----------------|:---------------------------------------------------------------------------------------------------------------------------------------------| | `runners.environment` | yes | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) | | `runners.kubernetes.pod_labels` | yes | The Variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) | | `runners.kubernetes.pod_annotations` | yes | The Variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) | +You can read more about `config.toml` in the [GitLab Runner docs](https://docs.gitlab.com/runner/configuration/advanced-configuration.html). + ## Expansion mechanisms There are three expansion mechanisms: @@ -104,10 +103,6 @@ These restrictions are because `after_script` scripts are executed in a ## Persisted variables -NOTE: **Note:** -Some of the persisted variables contain tokens and cannot be used by some definitions -due to security reasons. - The following variables are known as "persisted": - `CI_PIPELINE_ID` @@ -130,6 +125,9 @@ They are: - For definitions where the ["Expansion place"](#gitlab-ciyml-file) is GitLab. - In the `only` and `except` [variables expressions](README.md#environment-variables-expressions). +Some of the persisted variables contain tokens and cannot be used by some definitions +due to security reasons. + ## Variables with an environment scope Variables defined with an environment scope are supported. Given that diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 1a005f6b858..0e490bbded3 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -388,7 +388,7 @@ include: ### `include` > - Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.5. -> - Available for Starter, Premium and Ultimate since 10.6. +> - Available for Starter, Premium, and Ultimate in GitLab 10.6 and later. > - [Moved](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/42861) to GitLab Core in 11.4. Using the `include` keyword allows the inclusion of external YAML files. This helps @@ -541,7 +541,7 @@ Nested includes allow you to compose a set of includes. A total of 100 includes is allowed, but duplicate includes are considered a configuration error. -Since [GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/-/issues/28212), the time limit +In [GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/-/issues/28212) and later, the time limit for resolving all files is 30 seconds. #### Additional `includes` examples @@ -1487,9 +1487,8 @@ job: - spec/**.rb ``` -NOTE: **Note:** -For performance reasons, using `exists` with patterns is limited to 10000 -checks. After the 10000th check, rules with patterned globs always match. +For performance reasons, using `exists` with patterns is limited to 10,000 +checks. After the 10,000th check, rules with patterned globs always match. #### `rules:allow_failure` @@ -2093,7 +2092,7 @@ To disable directed acyclic graphs (DAG), set the limit to `0`. When using `needs`, artifact downloads are controlled with `artifacts: true` (default) or `artifacts: false`. -Since GitLab 12.6, you can't combine the [`dependencies`](#dependencies) keyword +In GitLab 12.6 and later, you can't combine the [`dependencies`](#dependencies) keyword with `needs` to control artifact downloads in jobs. `dependencies` is still valid in jobs that do not use `needs`. @@ -3627,7 +3626,7 @@ You can use this keyword to create two different types of downstream pipelines: - [Multi-project pipelines](../multi_project_pipelines.md#creating-multi-project-pipelines-from-gitlab-ciyml) - [Child pipelines](../parent_child_pipelines.md) -[In GitLab 13.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/197140/), you can +[In GitLab 13.2](https://gitlab.com/gitlab-org/gitlab/-/issues/197140/) and later, you can view which job triggered a downstream pipeline. In the [pipeline graph](../pipelines/index.md#visualize-pipelines), hover over the downstream pipeline job. @@ -4378,7 +4377,7 @@ the following stages: | Variable | Description | |-----------------------------------|--------------------------------------------------------| | **ARTIFACT_DOWNLOAD_ATTEMPTS** | Number of attempts to download artifacts running a job | -| **EXECUTOR_JOB_SECTION_ATTEMPTS** | [Since GitLab 12.10](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4450), the number of attempts to run a section in a job after a [`No Such Container`](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4450) error ([Docker executor](https://docs.gitlab.com/runner/executors/docker.html) only). | +| **EXECUTOR_JOB_SECTION_ATTEMPTS** | [In GitLab 12.10](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4450) and later, the number of attempts to run a section in a job after a [`No Such Container`](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4450) error ([Docker executor](https://docs.gitlab.com/runner/executors/docker.html) only). | | **GET_SOURCES_ATTEMPTS** | Number of attempts to fetch sources running a job | | **RESTORE_CACHE_ATTEMPTS** | Number of attempts to restore the cache running a job | diff --git a/doc/development/database/not_null_constraints.md b/doc/development/database/not_null_constraints.md index de8f62a61e7..96271863d94 100644 --- a/doc/development/database/not_null_constraints.md +++ b/doc/development/database/not_null_constraints.md @@ -39,7 +39,7 @@ end ## Add a `NOT NULL` column to an existing table -With PostgreSQL 11 being the minimum version since GitLab 13.0, adding columns with `NULL` and/or +With PostgreSQL 11 being the minimum version in GitLab 13.0 and later, adding columns with `NULL` and/or default values has become much easier and the standard `add_column` helper should be used in all cases. For example, consider a migration that adds a new `NOT NULL` column `active` to table `db_guides`, diff --git a/doc/development/geo.md b/doc/development/geo.md index b5fb34dcdcc..06b032a8f66 100644 --- a/doc/development/geo.md +++ b/doc/development/geo.md @@ -426,7 +426,7 @@ We switch and filter from each event by the `event_name` field. ### Geo Log Cursor (GitLab 10.0 and up) -Since GitLab 10.0, [System Webhooks](#system-hooks-gitlab-87-to-95) are no longer +In GitLab 10.0 and later, [System Webhooks](#system-hooks-gitlab-87-to-95) are no longer used and Geo Log Cursor is used instead. The Log Cursor traverses the `Geo::EventLog` rows to see if there are changes since the last time the log was checked and will handle repository updates, deletes, diff --git a/doc/development/go_guide/index.md b/doc/development/go_guide/index.md index 6954b2bd6dc..a37bec3b43e 100644 --- a/doc/development/go_guide/index.md +++ b/doc/development/go_guide/index.md @@ -138,7 +138,7 @@ security status and license compatibility. ### Modules -Since Go 1.11, a standard dependency system is available behind the name [Go +In Go 1.11 and later, a standard dependency system is available behind the name [Go Modules](https://github.com/golang/go/wiki/Modules). It provides a way to define and lock dependencies for reproducible builds. It should be used whenever possible. @@ -472,7 +472,7 @@ In case we want to drop support for `go 1.11` in GitLab `12.10`, we need to veri We will not consider the active milestone, `12.10`, because a backport for `12.7` will be required in case of a critical security release. -1. If both [Omnibus and CNG](#updating-go-version) were using Go `1.12` since GitLab `12.7`, then we safely drop support for `1.11`. +1. If both [Omnibus and CNG](#updating-go-version) were using Go `1.12` in GitLab `12.7` and later, then we safely drop support for `1.11`. 1. If Omnibus or CNG were using `1.11` in GitLab `12.7`, then we still need to keep support for Go `1.11` for easier backporting of security fixes. ## Secure Team standards and style guidelines diff --git a/doc/development/gotchas.md b/doc/development/gotchas.md index 1044b7edcb8..cc3db267d53 100644 --- a/doc/development/gotchas.md +++ b/doc/development/gotchas.md @@ -5,7 +5,7 @@ might encounter or should avoid during development of GitLab CE and EE. ## Do not read files from app/assets directory -Since GitLab 10.8, Omnibus has [dropped the `app/assets` directory](https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/2456), +In GitLab 10.8 and later, Omnibus has [dropped the `app/assets` directory](https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/2456), after asset compilation. The `ee/app/assets`, `vendor/assets` directories are dropped as well. This means that reading files from that directory will fail in Omnibus-installed GitLab instances: diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md index ae01571ae4b..50493e27ce9 100644 --- a/doc/development/migration_style_guide.md +++ b/doc/development/migration_style_guide.md @@ -602,7 +602,7 @@ See the style guide on [`NOT NULL` constraints](database/not_null_constraints.md ## Adding Columns With Default Values -With PostgreSQL 11 being the minimum version since GitLab 13.0, adding columns with default values has become much easier and +With PostgreSQL 11 being the minimum version in GitLab 13.0 and later, adding columns with default values has become much easier and the standard `add_column` helper should be used in all cases. Before PostgreSQL 11, adding a column with a default was problematic as it would diff --git a/doc/install/aws/index.md b/doc/install/aws/index.md index bad01175363..93ac17d823b 100644 --- a/doc/install/aws/index.md +++ b/doc/install/aws/index.md @@ -466,7 +466,7 @@ Connect to your GitLab instance via **Bastion Host A** using [SSH Agent Forwardi #### Disable Let's Encrypt -Since we're adding our SSL certificate at the load balancer, we do not need GitLab's built-in support for Let's Encrypt. Let's Encrypt [is enabled by default](https://docs.gitlab.com/omnibus/settings/ssl.html#lets-encrypt-integration) when using an `https` domain since GitLab 10.7, so we need to explicitly disable it: +Since we're adding our SSL certificate at the load balancer, we do not need GitLab's built-in support for Let's Encrypt. Let's Encrypt [is enabled by default](https://docs.gitlab.com/omnibus/settings/ssl.html#lets-encrypt-integration) when using an `https` domain in GitLab 10.7 and later, so we need to explicitly disable it: 1. Open `/etc/gitlab/gitlab.rb` and disable it: diff --git a/doc/install/installation.md b/doc/install/installation.md index 5421800ac39..0adf09595e4 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -260,7 +260,7 @@ sudo gem install bundler --no-document --version '< 2' ## 3. Go -Since GitLab 8.0, GitLab has several daemons written in Go. To install +In GitLab 8.0 and later, GitLab has several daemons written in Go. To install GitLab we need a Go compiler. The instructions below assume you use 64-bit Linux. You can find downloads for other platforms at the [Go download page](https://golang.org/dl). @@ -278,7 +278,7 @@ rm go1.13.5.linux-amd64.tar.gz ## 4. Node -Since GitLab 8.17, GitLab requires the use of Node to compile JavaScript +In GitLab 8.17 and later, GitLab requires the use of Node to compile JavaScript assets, and Yarn to manage JavaScript dependencies. The current minimum requirements for these are: @@ -313,7 +313,7 @@ sudo adduser --disabled-login --gecos 'GitLab' git ## 6. Database NOTE: **Note:** -Starting from GitLab 12.1, only PostgreSQL is supported. Since GitLab 13.0, we [require PostgreSQL 11+](requirements.md#postgresql-requirements). +In GitLab 12.1 and later, only PostgreSQL is supported. In GitLab 13.0 and later, we [require PostgreSQL 11+](requirements.md#postgresql-requirements). 1. Install the database packages: diff --git a/doc/raketasks/import.md b/doc/raketasks/import.md index 9d1560ccfd5..b0603a76211 100644 --- a/doc/raketasks/import.md +++ b/doc/raketasks/import.md @@ -127,7 +127,7 @@ Bare repositories are **not** importable by GitLab 10.4 to GitLab 11.6, if all t - It was not renamed, transferred, or migrated to [hashed storage](../administration/repository_storage_types.md#hashed-storage) in GitLab 10.4 to GitLab 11.6. - Its ancestor namespaces were not renamed or transferred in GitLab 10.4 to GitLab 11.6. -[Since GitLab 11.6](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41776), all +[In GitLab 11.6](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41776) and later, all bare repositories are importable. To manually migrate repositories yourself (for GitLab 10.4 to GitLab 11.6), you can use the diff --git a/doc/topics/autodevops/stages.md b/doc/topics/autodevops/stages.md index be6800abf75..3fec3c4c621 100644 --- a/doc/topics/autodevops/stages.md +++ b/doc/topics/autodevops/stages.md @@ -247,7 +247,7 @@ Helm, which you can [customize](customize.md#custom-helm-chart). The application into the [Kubernetes namespace](../../user/project/clusters/index.md#deployment-variables) for the environment. -Since GitLab 11.4, [local Tiller](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/22036) is +In GitLab 11.4 and later, [local Tiller](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/22036) is used. Previous versions of GitLab had a Tiller installed in the project namespace. @@ -365,7 +365,7 @@ chart to deploy the application into the [Kubernetes namespace](../../user/project/clusters/index.md#deployment-variables) for the environment. -Since GitLab 11.4, a +In GitLab 11.4 and later, a [local Tiller](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/22036) is used. Previous versions of GitLab had a Tiller installed in the project namespace. diff --git a/doc/user/clusters/applications.md b/doc/user/clusters/applications.md index 24ea0e771f6..4e0e2991acb 100644 --- a/doc/user/clusters/applications.md +++ b/doc/user/clusters/applications.md @@ -63,7 +63,7 @@ supported by GitLab before installing any of the applications. > - Introduced in GitLab 10.2 for project-level clusters. > - Introduced in GitLab 11.6 for group-level clusters. -> - [Uses a local Tiller](https://gitlab.com/gitlab-org/gitlab/-/issues/209736) since GitLab 13.2. +> - [Uses a local Tiller](https://gitlab.com/gitlab-org/gitlab/-/issues/209736) in GitLab 13.2 and later. [Helm](https://helm.sh/docs/) is a package manager for Kubernetes and is used to install the GitLab-managed apps. GitLab runs each `helm` command diff --git a/doc/user/group/index.md b/doc/user/group/index.md index 15bcaaffa66..e22b14e43b9 100644 --- a/doc/user/group/index.md +++ b/doc/user/group/index.md @@ -371,7 +371,7 @@ To create group links via filter: ### Overriding user permissions **(STARTER ONLY)** -Since GitLab [v8.15](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/822) LDAP user permissions can now be manually overridden by an admin user. To override a user's permissions: +In GitLab [8.15](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/822) and later, LDAP user permissions can now be manually overridden by an admin user. To override a user's permissions: 1. Go to your group's **Members** page. 1. Select the pencil icon in the row for the user you are editing. diff --git a/doc/user/permissions.md b/doc/user/permissions.md index 3c11de76b81..abd02d6317f 100644 --- a/doc/user/permissions.md +++ b/doc/user/permissions.md @@ -438,7 +438,7 @@ instance and project. In addition, all admins can use the admin interface under 1. Only if the job was: - Triggered by the user - - [Since GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/35069), not run for a protected branch + - [In GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/35069) and later, not run for a protected branch ### Job permissions @@ -485,7 +485,7 @@ for details about the pipelines security model. ## LDAP users permissions -Since GitLab 8.15, LDAP user permissions can now be manually overridden by an admin user. +In GitLab 8.15 and later, LDAP user permissions can now be manually overridden by an admin user. Read through the documentation on [LDAP users permissions](group/index.md#manage-group-memberships-via-ldap) to learn more. ## Project aliases diff --git a/doc/user/project/integrations/services_templates.md b/doc/user/project/integrations/services_templates.md index 688643a85a7..abb072c9a0a 100644 --- a/doc/user/project/integrations/services_templates.md +++ b/doc/user/project/integrations/services_templates.md @@ -6,20 +6,52 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Service templates -Using a service template, GitLab administrators can provide default values for configuring integrations at the project level. +Using a service template, GitLab administrators can: -When you enable a service template, the defaults are applied to **all** projects that do not -already have the integration enabled or do not otherwise have custom values saved. -The values are pre-filled on each project's configuration page for the applicable integration. +- Provide default values for configuring integrations when creating new projects. +- Bulk configure all existing projects in one step. -If you disable the template, these values no longer appear as defaults, while -any values already saved for an integration remain unchanged. +When you enable a service template: + +- The defaults are applied to **all** existing projects that either: + - Don't already have the integration enabled. + - Don't have custom values stored for already enabled integrations. +- Values are populated on each project's configuration page for the applicable + integration. +- Settings are stored at the project level. + +If you disable the template: + +- GitLab default values again become the default values for integrations on + new projects. +- Projects previously configured using the template will continue to use + those settings. + +If you change the template, the revised values are applied to new projects. This feature +does not provide central administration of integration settings. + +## Central administration of project integrations + +A new set of features is being introduced in GitLab to provide more control over +how integrations are configured at the instance, group, and project level. + +[Read more about setting up project integration management](../../admin_area/settings/project_integration_management.md) +(introduced in GitLab 13.3) and [our plans for managing integrations](https://gitlab.com/groups/gitlab-org/-/epics/2137). ## Enable a service template Navigate to the **Admin Area > Service Templates** and choose the service template you wish to create. +Recommendation: + +- Test the settings on some projects individually before enabling a template. +- Copy the working settings from a project to the template. + +There is no "Test settings" option when enabling templates. If the settings do not work, +these incorrect settings will be applied to all existing projects that do not already have +the integration configured. Fixing the integration then needs to be done project-by-project. + ## Service for external issue trackers The following image shows an example service template for Redmine. diff --git a/doc/user/project/issues/issue_data_and_actions.md b/doc/user/project/issues/issue_data_and_actions.md index 6e10aba714c..003444e0ed8 100644 --- a/doc/user/project/issues/issue_data_and_actions.md +++ b/doc/user/project/issues/issue_data_and_actions.md @@ -191,7 +191,7 @@ The plain text title and description of the issue fill the top center of the iss The description fully supports [GitLab Flavored Markdown](../../markdown.md#gitlab-flavored-markdown-gfm), allowing many formatting options. -> [Since GitLab 12.6](https://gitlab.com/gitlab-org/gitlab/-/issues/10103), changes to an issue's description are listed in the [issue history](#issue-history).**(STARTER)** +> [In GitLab 12.6](https://gitlab.com/gitlab-org/gitlab/-/issues/10103) and later, changes to an issue's description are listed in the [issue history](#issue-history).**(STARTER)** ### Mentions diff --git a/doc/user/project/merge_requests/revert_changes.md b/doc/user/project/merge_requests/revert_changes.md index bc4fee749e8..6b302b0ff02 100644 --- a/doc/user/project/merge_requests/revert_changes.md +++ b/doc/user/project/merge_requests/revert_changes.md @@ -14,7 +14,7 @@ by clicking the **Revert** button in merge requests and commit details. NOTE: **Note:** The **Revert** button will only be available for merge requests -created since GitLab 8.5. However, you can still revert a merge request +created in GitLab 8.5 and later. However, you can still revert a merge request by reverting the merge commit from the list of Commits page. NOTE: **Note:** diff --git a/doc/user/project/protected_branches.md b/doc/user/project/protected_branches.md index 3d0cb1bf3a5..09757bc73eb 100644 --- a/doc/user/project/protected_branches.md +++ b/doc/user/project/protected_branches.md @@ -48,7 +48,7 @@ that the `master` branch is protected by default. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5081) in GitLab 8.11. -Since GitLab 8.11, we added another layer of branch protection which provides +In GitLab 8.11 and later, we added another layer of branch protection which provides more granular management of protected branches. The "Developers can push" option was replaced by an "Allowed to push" setting which can be set to allow/prohibit Maintainers and/or Developers to push to a protected branch. diff --git a/doc/user/todos.md b/doc/user/todos.md index 67e248d0e68..c48d2adfa45 100644 --- a/doc/user/todos.md +++ b/doc/user/todos.md @@ -51,7 +51,7 @@ A to do item appears on your To-Do List when: - You're the author. - You're the user that set the merge request to automatically merge after a pipeline succeeds. -- [Since GitLab 13.2](https://gitlab.com/gitlab-org/gitlab/-/issues/12136), a +- [In GitLab 13.2](https://gitlab.com/gitlab-org/gitlab/-/issues/12136) and later, a merge request is removed from a [merge train](../ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md), and you're the user that added it. **(PREMIUM)** diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb index 5305b25538f..7e3d70a210a 100644 --- a/lib/api/access_requests.rb +++ b/lib/api/access_requests.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class AccessRequests < Grape::API::Instance + class AccessRequests < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/admin/ci/variables.rb b/lib/api/admin/ci/variables.rb index 8721d94d642..44c389d6f94 100644 --- a/lib/api/admin/ci/variables.rb +++ b/lib/api/admin/ci/variables.rb @@ -3,7 +3,7 @@ module API module Admin module Ci - class Variables < Grape::API::Instance + class Variables < ::API::Base include PaginationParams before { authenticated_as_admin! } diff --git a/lib/api/admin/instance_clusters.rb b/lib/api/admin/instance_clusters.rb index 0db2321199a..ce1bdd65eff 100644 --- a/lib/api/admin/instance_clusters.rb +++ b/lib/api/admin/instance_clusters.rb @@ -2,7 +2,7 @@ module API module Admin - class InstanceClusters < Grape::API::Instance + class InstanceClusters < ::API::Base include PaginationParams before do diff --git a/lib/api/admin/sidekiq.rb b/lib/api/admin/sidekiq.rb index f4c84f2eee8..c2e9de5fb4e 100644 --- a/lib/api/admin/sidekiq.rb +++ b/lib/api/admin/sidekiq.rb @@ -2,7 +2,7 @@ module API module Admin - class Sidekiq < Grape::API::Instance + class Sidekiq < ::API::Base before { authenticated_as_admin! } namespace 'admin' do diff --git a/lib/api/api.rb b/lib/api/api.rb index 417d4d66aca..84b4d5a5835 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class API < Grape::API::Instance + class API < ::API::Base include APIGuard LOG_FILENAME = Rails.root.join("log", "api_json.log") diff --git a/lib/api/appearance.rb b/lib/api/appearance.rb index f98004af480..00b495bbc1e 100644 --- a/lib/api/appearance.rb +++ b/lib/api/appearance.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Appearance < Grape::API::Instance + class Appearance < ::API::Base before { authenticated_as_admin! } helpers do diff --git a/lib/api/applications.rb b/lib/api/applications.rb index 4f2c3ee79ef..2afe8763d9d 100644 --- a/lib/api/applications.rb +++ b/lib/api/applications.rb @@ -2,7 +2,7 @@ module API # External applications API - class Applications < Grape::API::Instance + class Applications < ::API::Base before { authenticated_as_admin! } resource :applications do diff --git a/lib/api/avatar.rb b/lib/api/avatar.rb index 9501e777fff..5a9b9940fcf 100644 --- a/lib/api/avatar.rb +++ b/lib/api/avatar.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Avatar < Grape::API::Instance + class Avatar < ::API::Base resource :avatar do desc 'Return avatar url for a user' do success Entities::Avatar diff --git a/lib/api/award_emoji.rb b/lib/api/award_emoji.rb index 0a3df3ed96e..6d40ae8f5ff 100644 --- a/lib/api/award_emoji.rb +++ b/lib/api/award_emoji.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class AwardEmoji < Grape::API::Instance + class AwardEmoji < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/badges.rb b/lib/api/badges.rb index f9728ffc446..fc00594c9ec 100644 --- a/lib/api/badges.rb +++ b/lib/api/badges.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Badges < Grape::API::Instance + class Badges < ::API::Base include PaginationParams before { authenticate_non_get! } diff --git a/lib/api/base.rb b/lib/api/base.rb new file mode 100644 index 00000000000..e174cef3bad --- /dev/null +++ b/lib/api/base.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +module API + class Base < Grape::API::Instance # rubocop:disable API/Base + end +end diff --git a/lib/api/boards.rb b/lib/api/boards.rb index 1f5086127a8..d2d1628aff4 100644 --- a/lib/api/boards.rb +++ b/lib/api/boards.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Boards < Grape::API::Instance + class Boards < ::API::Base include BoardsResponses include PaginationParams diff --git a/lib/api/branches.rb b/lib/api/branches.rb index 44f7610384e..37cce6eafba 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -3,7 +3,7 @@ require 'mime/types' module API - class Branches < Grape::API::Instance + class Branches < ::API::Base include PaginationParams BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(branch: API::NO_SLASH_URL_PART_REGEX) diff --git a/lib/api/broadcast_messages.rb b/lib/api/broadcast_messages.rb index dcf950d7a03..8ce7694bbfd 100644 --- a/lib/api/broadcast_messages.rb +++ b/lib/api/broadcast_messages.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class BroadcastMessages < Grape::API::Instance + class BroadcastMessages < ::API::Base include PaginationParams resource :broadcast_messages do diff --git a/lib/api/ci/pipeline_schedules.rb b/lib/api/ci/pipeline_schedules.rb index 1afdb0ad34c..18caf85f109 100644 --- a/lib/api/ci/pipeline_schedules.rb +++ b/lib/api/ci/pipeline_schedules.rb @@ -2,7 +2,7 @@ module API module Ci - class PipelineSchedules < Grape::API::Instance + class PipelineSchedules < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/ci/pipelines.rb b/lib/api/ci/pipelines.rb index 66bb676d02c..61e03ed1a95 100644 --- a/lib/api/ci/pipelines.rb +++ b/lib/api/ci/pipelines.rb @@ -2,7 +2,7 @@ module API module Ci - class Pipelines < Grape::API::Instance + class Pipelines < ::API::Base include PaginationParams before { authenticate_non_get! } diff --git a/lib/api/ci/runner.rb b/lib/api/ci/runner.rb index f86e18676c1..ef679147c9f 100644 --- a/lib/api/ci/runner.rb +++ b/lib/api/ci/runner.rb @@ -2,7 +2,7 @@ module API module Ci - class Runner < Grape::API::Instance + class Runner < ::API::Base helpers ::API::Helpers::Runner resource :runners do diff --git a/lib/api/ci/runners.rb b/lib/api/ci/runners.rb index 7bca72f8028..d37f10fe631 100644 --- a/lib/api/ci/runners.rb +++ b/lib/api/ci/runners.rb @@ -2,7 +2,7 @@ module API module Ci - class Runners < Grape::API::Instance + class Runners < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb index 9f5a6e87505..af103b8c1f8 100644 --- a/lib/api/commit_statuses.rb +++ b/lib/api/commit_statuses.rb @@ -3,7 +3,7 @@ require 'mime/types' module API - class CommitStatuses < Grape::API::Instance + class CommitStatuses < ::API::Base params do requires :id, type: String, desc: 'The ID of a project' end diff --git a/lib/api/commits.rb b/lib/api/commits.rb index aa7dc1eded1..582ccd41847 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -3,7 +3,7 @@ require 'mime/types' module API - class Commits < Grape::API::Instance + class Commits < ::API::Base include PaginationParams before do diff --git a/lib/api/composer_packages.rb b/lib/api/composer_packages.rb index 8ef9c02bfa7..1becbd668a3 100644 --- a/lib/api/composer_packages.rb +++ b/lib/api/composer_packages.rb @@ -2,7 +2,7 @@ # PHP composer support (https://getcomposer.org/) module API - class ComposerPackages < Grape::API::Instance + class ComposerPackages < ::API::Base helpers ::API::Helpers::PackagesManagerClientsHelpers helpers ::API::Helpers::RelatedResourcesHelpers helpers ::API::Helpers::Packages::BasicAuthHelpers diff --git a/lib/api/conan_instance_packages.rb b/lib/api/conan_instance_packages.rb index 209748d79fa..08265201328 100644 --- a/lib/api/conan_instance_packages.rb +++ b/lib/api/conan_instance_packages.rb @@ -2,7 +2,7 @@ # Conan Instance-Level Package Manager Client API module API - class ConanInstancePackages < Grape::API::Instance + class ConanInstancePackages < ::API::Base namespace 'packages/conan/v1' do include ConanPackageEndpoints end diff --git a/lib/api/conan_project_packages.rb b/lib/api/conan_project_packages.rb index c51992231a7..db8cd187811 100644 --- a/lib/api/conan_project_packages.rb +++ b/lib/api/conan_project_packages.rb @@ -2,7 +2,7 @@ # Conan Project-Level Package Manager Client API module API - class ConanProjectPackages < Grape::API::Instance + class ConanProjectPackages < ::API::Base params do requires :id, type: Integer, desc: 'The ID of a project', regexp: %r{\A[1-9]\d*\z} end diff --git a/lib/api/container_registry_event.rb b/lib/api/container_registry_event.rb index 0b7c35cadbd..6c4b80b612a 100644 --- a/lib/api/container_registry_event.rb +++ b/lib/api/container_registry_event.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ContainerRegistryEvent < Grape::API::Instance + class ContainerRegistryEvent < ::API::Base DOCKER_DISTRIBUTION_EVENTS_V1_JSON = 'application/vnd.docker.distribution.events.v1+json' before { authenticate_registry_notification! } diff --git a/lib/api/debian_group_packages.rb b/lib/api/debian_group_packages.rb index c56d84ed313..e3cacc4132f 100644 --- a/lib/api/debian_group_packages.rb +++ b/lib/api/debian_group_packages.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class DebianGroupPackages < Grape::API::Instance + class DebianGroupPackages < ::API::Base params do requires :id, type: String, desc: 'The ID of a group' end diff --git a/lib/api/debian_project_packages.rb b/lib/api/debian_project_packages.rb index 7cd796aac2b..bcb4e8c8cbc 100644 --- a/lib/api/debian_project_packages.rb +++ b/lib/api/debian_project_packages.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class DebianProjectPackages < Grape::API::Instance + class DebianProjectPackages < ::API::Base params do requires :id, type: String, desc: 'The ID of a project' end diff --git a/lib/api/deploy_keys.rb b/lib/api/deploy_keys.rb index ad37b7578ad..314f5b6ee1d 100644 --- a/lib/api/deploy_keys.rb +++ b/lib/api/deploy_keys.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class DeployKeys < Grape::API::Instance + class DeployKeys < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/deploy_tokens.rb b/lib/api/deploy_tokens.rb index 96aa2445f56..1c156b8b3bb 100644 --- a/lib/api/deploy_tokens.rb +++ b/lib/api/deploy_tokens.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class DeployTokens < Grape::API::Instance + class DeployTokens < ::API::Base include PaginationParams helpers do diff --git a/lib/api/deployments.rb b/lib/api/deployments.rb index 87144fd31cc..ff06bdbae16 100644 --- a/lib/api/deployments.rb +++ b/lib/api/deployments.rb @@ -2,7 +2,7 @@ module API # Deployments RESTful API endpoints - class Deployments < Grape::API::Instance + class Deployments < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/discussions.rb b/lib/api/discussions.rb index c431ec8e1e4..3d2608c8c5a 100644 --- a/lib/api/discussions.rb +++ b/lib/api/discussions.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Discussions < Grape::API::Instance + class Discussions < ::API::Base include PaginationParams helpers ::API::Helpers::NotesHelpers helpers ::RendersNotes diff --git a/lib/api/environments.rb b/lib/api/environments.rb index b825904e2c5..0e780d4ef36 100644 --- a/lib/api/environments.rb +++ b/lib/api/environments.rb @@ -2,7 +2,7 @@ module API # Environments RESTfull API endpoints - class Environments < Grape::API::Instance + class Environments < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/error_tracking.rb b/lib/api/error_tracking.rb index 64ec6f0a57a..03f83477954 100644 --- a/lib/api/error_tracking.rb +++ b/lib/api/error_tracking.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ErrorTracking < Grape::API::Instance + class ErrorTracking < ::API::Base before { authenticate! } params do diff --git a/lib/api/events.rb b/lib/api/events.rb index 0b79431a76d..43efacf9c0b 100644 --- a/lib/api/events.rb +++ b/lib/api/events.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Events < Grape::API::Instance + class Events < ::API::Base include PaginationParams include APIGuard helpers ::API::Helpers::EventsHelpers diff --git a/lib/api/feature_flag_scopes.rb b/lib/api/feature_flag_scopes.rb index 4a42dbc1aea..d77e243aa88 100644 --- a/lib/api/feature_flag_scopes.rb +++ b/lib/api/feature_flag_scopes.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class FeatureFlagScopes < Grape::API::Instance + class FeatureFlagScopes < ::API::Base include PaginationParams ENVIRONMENT_SCOPE_ENDPOINT_REQUIREMENTS = FeatureFlags::FEATURE_FLAG_ENDPOINT_REQUIREMENTS diff --git a/lib/api/feature_flags.rb b/lib/api/feature_flags.rb index 9e2be67f0de..613c3fb0f5b 100644 --- a/lib/api/feature_flags.rb +++ b/lib/api/feature_flags.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class FeatureFlags < Grape::API::Instance + class FeatureFlags < ::API::Base include PaginationParams FEATURE_FLAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS diff --git a/lib/api/feature_flags_user_lists.rb b/lib/api/feature_flags_user_lists.rb index 67aee3993f1..e5218cfd7f1 100644 --- a/lib/api/feature_flags_user_lists.rb +++ b/lib/api/feature_flags_user_lists.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class FeatureFlagsUserLists < Grape::API::Instance + class FeatureFlagsUserLists < ::API::Base include PaginationParams error_formatter :json, -> (message, _backtrace, _options, _env, _original_exception) { diff --git a/lib/api/features.rb b/lib/api/features.rb index 9d011d658f6..5d2e545abd6 100644 --- a/lib/api/features.rb +++ b/lib/api/features.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Features < Grape::API::Instance + class Features < ::API::Base before { authenticated_as_admin! } helpers do diff --git a/lib/api/files.rb b/lib/api/files.rb index 748bdfa894d..6833fc429e2 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Files < Grape::API::Instance + class Files < ::API::Base include APIGuard FILE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(file_path: API::NO_SLASH_URL_PART_REGEX) diff --git a/lib/api/freeze_periods.rb b/lib/api/freeze_periods.rb index b8254ee9ab4..a83e36165a2 100644 --- a/lib/api/freeze_periods.rb +++ b/lib/api/freeze_periods.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class FreezePeriods < Grape::API::Instance + class FreezePeriods < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/generic_packages.rb b/lib/api/generic_packages.rb index a0c29ada950..e053319c1c6 100644 --- a/lib/api/generic_packages.rb +++ b/lib/api/generic_packages.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GenericPackages < Grape::API::Instance + class GenericPackages < ::API::Base GENERIC_PACKAGES_REQUIREMENTS = { package_name: API::NO_SLASH_URL_PART_REGEX, file_name: API::NO_SLASH_URL_PART_REGEX diff --git a/lib/api/go_proxy.rb b/lib/api/go_proxy.rb index c0207f9169c..30f0cfb4dfd 100755 --- a/lib/api/go_proxy.rb +++ b/lib/api/go_proxy.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module API - class GoProxy < Grape::API::Instance + class GoProxy < ::API::Base helpers Gitlab::Golang helpers ::API::Helpers::PackagesHelpers diff --git a/lib/api/group_boards.rb b/lib/api/group_boards.rb index 7efc12121d2..d4574b22d99 100644 --- a/lib/api/group_boards.rb +++ b/lib/api/group_boards.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupBoards < Grape::API::Instance + class GroupBoards < ::API::Base include BoardsResponses include PaginationParams diff --git a/lib/api/group_clusters.rb b/lib/api/group_clusters.rb index 77095ee62e0..75429cf7a5c 100644 --- a/lib/api/group_clusters.rb +++ b/lib/api/group_clusters.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupClusters < Grape::API::Instance + class GroupClusters < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/group_container_repositories.rb b/lib/api/group_container_repositories.rb index 5b6a3bd36cf..1bb26b3931c 100644 --- a/lib/api/group_container_repositories.rb +++ b/lib/api/group_container_repositories.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupContainerRepositories < Grape::API::Instance + class GroupContainerRepositories < ::API::Base include PaginationParams helpers ::API::Helpers::PackagesHelpers diff --git a/lib/api/group_export.rb b/lib/api/group_export.rb index dc14813eefc..6ebaa8de185 100644 --- a/lib/api/group_export.rb +++ b/lib/api/group_export.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupExport < Grape::API::Instance + class GroupExport < ::API::Base helpers Helpers::RateLimiter before do diff --git a/lib/api/group_import.rb b/lib/api/group_import.rb index b82d9fc519a..e703a217fd5 100644 --- a/lib/api/group_import.rb +++ b/lib/api/group_import.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupImport < Grape::API::Instance + class GroupImport < ::API::Base helpers Helpers::FileUploadHelpers helpers do diff --git a/lib/api/group_labels.rb b/lib/api/group_labels.rb index 56f2b769464..8443ddf10ce 100644 --- a/lib/api/group_labels.rb +++ b/lib/api/group_labels.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupLabels < Grape::API::Instance + class GroupLabels < ::API::Base include PaginationParams helpers ::API::Helpers::LabelHelpers diff --git a/lib/api/group_milestones.rb b/lib/api/group_milestones.rb index 82f5df79356..aef9877b84c 100644 --- a/lib/api/group_milestones.rb +++ b/lib/api/group_milestones.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupMilestones < Grape::API::Instance + class GroupMilestones < ::API::Base include MilestoneResponses include PaginationParams diff --git a/lib/api/group_packages.rb b/lib/api/group_packages.rb index aa047e260f5..5b6290df0dd 100644 --- a/lib/api/group_packages.rb +++ b/lib/api/group_packages.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupPackages < Grape::API::Instance + class GroupPackages < ::API::Base include PaginationParams before do diff --git a/lib/api/group_variables.rb b/lib/api/group_variables.rb index e7b8cd10197..ee110d67fa5 100644 --- a/lib/api/group_variables.rb +++ b/lib/api/group_variables.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class GroupVariables < Grape::API::Instance + class GroupVariables < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/groups.rb b/lib/api/groups.rb index efd4b22a591..bf3d6c3c7e0 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Groups < Grape::API::Instance + class Groups < ::API::Base include PaginationParams include Helpers::CustomAttributes diff --git a/lib/api/import_bitbucket_server.rb b/lib/api/import_bitbucket_server.rb index df3235420e9..a0238c24f3b 100644 --- a/lib/api/import_bitbucket_server.rb +++ b/lib/api/import_bitbucket_server.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ImportBitbucketServer < Grape::API::Instance + class ImportBitbucketServer < ::API::Base helpers do def client @client ||= BitbucketServer::Client.new(credentials) diff --git a/lib/api/import_github.rb b/lib/api/import_github.rb index 0bab891eada..61fce7a2c1b 100644 --- a/lib/api/import_github.rb +++ b/lib/api/import_github.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ImportGithub < Grape::API::Instance + class ImportGithub < ::API::Base rescue_from Octokit::Unauthorized, with: :provider_unauthorized before do diff --git a/lib/api/internal/base.rb b/lib/api/internal/base.rb index ff687a57888..88162a58c5a 100644 --- a/lib/api/internal/base.rb +++ b/lib/api/internal/base.rb @@ -3,7 +3,7 @@ module API # Internal access API module Internal - class Base < Grape::API::Instance + class Base < ::API::Base before { authenticate_by_gitlab_shell_token! } before do diff --git a/lib/api/internal/kubernetes.rb b/lib/api/internal/kubernetes.rb index 6d5dfd086e7..8175b81f900 100644 --- a/lib/api/internal/kubernetes.rb +++ b/lib/api/internal/kubernetes.rb @@ -3,7 +3,7 @@ module API # Kubernetes Internal API module Internal - class Kubernetes < Grape::API::Instance + class Kubernetes < ::API::Base before do check_feature_enabled authenticate_gitlab_kas_request! diff --git a/lib/api/internal/lfs.rb b/lib/api/internal/lfs.rb index 57cd661197c..630f0ec77a8 100644 --- a/lib/api/internal/lfs.rb +++ b/lib/api/internal/lfs.rb @@ -2,7 +2,7 @@ module API module Internal - class Lfs < Grape::API::Instance + class Lfs < ::API::Base use Rack::Sendfile before { authenticate_by_gitlab_shell_token! } diff --git a/lib/api/internal/pages.rb b/lib/api/internal/pages.rb index 5f8d23f15fa..51136144c19 100644 --- a/lib/api/internal/pages.rb +++ b/lib/api/internal/pages.rb @@ -3,7 +3,7 @@ module API # Pages Internal API module Internal - class Pages < Grape::API::Instance + class Pages < ::API::Base before do authenticate_gitlab_pages_request! end diff --git a/lib/api/issue_links.rb b/lib/api/issue_links.rb index 6cc5b344f47..db4979c9052 100644 --- a/lib/api/issue_links.rb +++ b/lib/api/issue_links.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class IssueLinks < Grape::API::Instance + class IssueLinks < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 715b09d70db..143f9e40736 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Issues < Grape::API::Instance + class Issues < ::API::Base include PaginationParams helpers Helpers::IssuesHelpers helpers Helpers::RateLimiter diff --git a/lib/api/job_artifacts.rb b/lib/api/job_artifacts.rb index bc7bc956580..536b361b308 100644 --- a/lib/api/job_artifacts.rb +++ b/lib/api/job_artifacts.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class JobArtifacts < Grape::API::Instance + class JobArtifacts < ::API::Base before { authenticate_non_get! } # EE::API::JobArtifacts would override the following helpers diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index ad46d948f3b..bdb23b4a9be 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Jobs < Grape::API::Instance + class Jobs < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/keys.rb b/lib/api/keys.rb index c014641ca04..2e4568029b5 100644 --- a/lib/api/keys.rb +++ b/lib/api/keys.rb @@ -2,7 +2,7 @@ module API # Keys API - class Keys < Grape::API::Instance + class Keys < ::API::Base before { authenticate! } resource :keys do diff --git a/lib/api/labels.rb b/lib/api/labels.rb index edf4a8ca14e..0cc9f33bd07 100644 --- a/lib/api/labels.rb +++ b/lib/api/labels.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Labels < Grape::API::Instance + class Labels < ::API::Base include PaginationParams helpers ::API::Helpers::LabelHelpers diff --git a/lib/api/lint.rb b/lib/api/lint.rb index 3f071ef4a91..bfd152f70b1 100644 --- a/lib/api/lint.rb +++ b/lib/api/lint.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Lint < Grape::API::Instance + class Lint < ::API::Base namespace :ci do desc 'Validation of .gitlab-ci.yml content' params do diff --git a/lib/api/markdown.rb b/lib/api/markdown.rb index a0822271cca..97549abd273 100644 --- a/lib/api/markdown.rb +++ b/lib/api/markdown.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Markdown < Grape::API::Instance + class Markdown < ::API::Base params do requires :text, type: String, desc: "The markdown text to render" optional :gfm, type: Boolean, desc: "Render text using GitLab Flavored Markdown" diff --git a/lib/api/maven_packages.rb b/lib/api/maven_packages.rb index d1dd3babb8b..bcd5d8e4a83 100644 --- a/lib/api/maven_packages.rb +++ b/lib/api/maven_packages.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module API - class MavenPackages < Grape::API::Instance + class MavenPackages < ::API::Base MAVEN_ENDPOINT_REQUIREMENTS = { file_name: API::NO_SLASH_URL_PART_REGEX }.freeze diff --git a/lib/api/members.rb b/lib/api/members.rb index 309d3023c63..c28b3b1cc7c 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Members < Grape::API::Instance + class Members < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/merge_request_approvals.rb b/lib/api/merge_request_approvals.rb index 035ed9f0e04..14d6e3995ea 100644 --- a/lib/api/merge_request_approvals.rb +++ b/lib/api/merge_request_approvals.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class MergeRequestApprovals < ::Grape::API::Instance + class MergeRequestApprovals < ::API::Base before { authenticate_non_get! } helpers do diff --git a/lib/api/merge_request_diffs.rb b/lib/api/merge_request_diffs.rb index 3e43fe8b257..22023888bbd 100644 --- a/lib/api/merge_request_diffs.rb +++ b/lib/api/merge_request_diffs.rb @@ -2,7 +2,7 @@ module API # MergeRequestDiff API - class MergeRequestDiffs < Grape::API::Instance + class MergeRequestDiffs < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 4bd72b267a9..b24dd870c8b 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class MergeRequests < Grape::API::Instance + class MergeRequests < ::API::Base include PaginationParams CONTEXT_COMMITS_POST_LIMIT = 20 diff --git a/lib/api/metrics/dashboard/annotations.rb b/lib/api/metrics/dashboard/annotations.rb index e07762ac6d3..b6bc0af2202 100644 --- a/lib/api/metrics/dashboard/annotations.rb +++ b/lib/api/metrics/dashboard/annotations.rb @@ -3,7 +3,7 @@ module API module Metrics module Dashboard - class Annotations < Grape::API::Instance + class Annotations < ::API::Base desc 'Create a new monitoring dashboard annotation' do success Entities::Metrics::Dashboard::Annotation end diff --git a/lib/api/metrics/user_starred_dashboards.rb b/lib/api/metrics/user_starred_dashboards.rb index 263d2394276..cb6e7099247 100644 --- a/lib/api/metrics/user_starred_dashboards.rb +++ b/lib/api/metrics/user_starred_dashboards.rb @@ -2,7 +2,7 @@ module API module Metrics - class UserStarredDashboards < Grape::API::Instance + class UserStarredDashboards < ::API::Base resource :projects do desc 'Marks selected metrics dashboard as starred' do success Entities::Metrics::UserStarredDashboard diff --git a/lib/api/namespaces.rb b/lib/api/namespaces.rb index 2865b4a2737..f98a1f6dd1d 100644 --- a/lib/api/namespaces.rb +++ b/lib/api/namespaces.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Namespaces < Grape::API::Instance + class Namespaces < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/notes.rb b/lib/api/notes.rb index e4989243f3d..0db537ca616 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Notes < Grape::API::Instance + class Notes < ::API::Base include PaginationParams helpers ::API::Helpers::NotesHelpers diff --git a/lib/api/notification_settings.rb b/lib/api/notification_settings.rb index f8b621c1c38..bad3f5ead7a 100644 --- a/lib/api/notification_settings.rb +++ b/lib/api/notification_settings.rb @@ -2,7 +2,7 @@ module API # notification_settings API - class NotificationSettings < Grape::API::Instance + class NotificationSettings < ::API::Base before { authenticate! } helpers ::API::Helpers::MembersHelpers diff --git a/lib/api/npm_packages.rb b/lib/api/npm_packages.rb index 41238221aad..1443b28c1ee 100644 --- a/lib/api/npm_packages.rb +++ b/lib/api/npm_packages.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module API - class NpmPackages < Grape::API::Instance + class NpmPackages < ::API::Base helpers ::API::Helpers::PackagesHelpers helpers ::API::Helpers::Packages::DependencyProxyHelpers diff --git a/lib/api/nuget_packages.rb b/lib/api/nuget_packages.rb index c0c6efb66b5..0f2c956a9df 100644 --- a/lib/api/nuget_packages.rb +++ b/lib/api/nuget_packages.rb @@ -6,7 +6,7 @@ # called by the NuGet package manager client when users run commands # like `nuget install` or `nuget push`. module API - class NugetPackages < Grape::API::Instance + class NugetPackages < ::API::Base helpers ::API::Helpers::PackagesManagerClientsHelpers helpers ::API::Helpers::Packages::BasicAuthHelpers diff --git a/lib/api/package_files.rb b/lib/api/package_files.rb index 17b92df629c..c1fc9a6e4d8 100644 --- a/lib/api/package_files.rb +++ b/lib/api/package_files.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class PackageFiles < Grape::API::Instance + class PackageFiles < ::API::Base include PaginationParams before do diff --git a/lib/api/pages.rb b/lib/api/pages.rb index 79a6b527581..813307c498f 100644 --- a/lib/api/pages.rb +++ b/lib/api/pages.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Pages < Grape::API::Instance + class Pages < ::API::Base before do require_pages_config_enabled! authenticated_with_can_read_all_resources! diff --git a/lib/api/pages_domains.rb b/lib/api/pages_domains.rb index 7d27b575efa..00c51298c45 100644 --- a/lib/api/pages_domains.rb +++ b/lib/api/pages_domains.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class PagesDomains < Grape::API::Instance + class PagesDomains < ::API::Base include PaginationParams PAGES_DOMAINS_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(domain: API::NO_SLASH_URL_PART_REGEX) diff --git a/lib/api/project_clusters.rb b/lib/api/project_clusters.rb index 6f189110d76..46ccb4ba1a0 100644 --- a/lib/api/project_clusters.rb +++ b/lib/api/project_clusters.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectClusters < Grape::API::Instance + class ProjectClusters < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/project_container_repositories.rb b/lib/api/project_container_repositories.rb index e70960df78c..d565531d372 100644 --- a/lib/api/project_container_repositories.rb +++ b/lib/api/project_container_repositories.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectContainerRepositories < Grape::API::Instance + class ProjectContainerRepositories < ::API::Base include PaginationParams helpers ::API::Helpers::PackagesHelpers diff --git a/lib/api/project_events.rb b/lib/api/project_events.rb index 726e693826e..3765473bc0e 100644 --- a/lib/api/project_events.rb +++ b/lib/api/project_events.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectEvents < Grape::API::Instance + class ProjectEvents < ::API::Base include PaginationParams include APIGuard helpers ::API::Helpers::EventsHelpers diff --git a/lib/api/project_export.rb b/lib/api/project_export.rb index 6e4097fd76c..184f89200ab 100644 --- a/lib/api/project_export.rb +++ b/lib/api/project_export.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectExport < Grape::API::Instance + class ProjectExport < ::API::Base helpers Helpers::RateLimiter before do diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb index 61b5324a425..bc2d8c816a8 100644 --- a/lib/api/project_hooks.rb +++ b/lib/api/project_hooks.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectHooks < Grape::API::Instance + class ProjectHooks < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/project_import.rb b/lib/api/project_import.rb index 6ac7f02f305..5c4e1d73ee1 100644 --- a/lib/api/project_import.rb +++ b/lib/api/project_import.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectImport < Grape::API::Instance + class ProjectImport < ::API::Base include PaginationParams helpers Helpers::ProjectsHelpers diff --git a/lib/api/project_milestones.rb b/lib/api/project_milestones.rb index 2f8dd1085dc..a81118f44bd 100644 --- a/lib/api/project_milestones.rb +++ b/lib/api/project_milestones.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectMilestones < Grape::API::Instance + class ProjectMilestones < ::API::Base include PaginationParams include MilestoneResponses diff --git a/lib/api/project_packages.rb b/lib/api/project_packages.rb index 359514f1f78..b8d97b1243a 100644 --- a/lib/api/project_packages.rb +++ b/lib/api/project_packages.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectPackages < Grape::API::Instance + class ProjectPackages < ::API::Base include PaginationParams before do diff --git a/lib/api/project_repository_storage_moves.rb b/lib/api/project_repository_storage_moves.rb index c318907542b..1a8c4f8d148 100644 --- a/lib/api/project_repository_storage_moves.rb +++ b/lib/api/project_repository_storage_moves.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectRepositoryStorageMoves < Grape::API::Instance + class ProjectRepositoryStorageMoves < ::API::Base include PaginationParams before { authenticated_as_admin! } diff --git a/lib/api/project_snapshots.rb b/lib/api/project_snapshots.rb index 360000861fc..e19afb6e8e4 100644 --- a/lib/api/project_snapshots.rb +++ b/lib/api/project_snapshots.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectSnapshots < Grape::API::Instance + class ProjectSnapshots < ::API::Base helpers ::API::Helpers::ProjectSnapshotsHelpers before { authorize_read_git_snapshot! } diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb index e2d531d7854..b4de260fe49 100644 --- a/lib/api/project_snippets.rb +++ b/lib/api/project_snippets.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectSnippets < Grape::API::Instance + class ProjectSnippets < ::API::Base include PaginationParams before { check_snippets_enabled } diff --git a/lib/api/project_statistics.rb b/lib/api/project_statistics.rb index 2196801096f..1ead969fc81 100644 --- a/lib/api/project_statistics.rb +++ b/lib/api/project_statistics.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectStatistics < Grape::API::Instance + class ProjectStatistics < ::API::Base before do authenticate! authorize! :daily_statistics, user_project diff --git a/lib/api/project_templates.rb b/lib/api/project_templates.rb index 48c3dbed3b0..7d851de0237 100644 --- a/lib/api/project_templates.rb +++ b/lib/api/project_templates.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProjectTemplates < Grape::API::Instance + class ProjectTemplates < ::API::Base include PaginationParams TEMPLATE_TYPES = %w[dockerfiles gitignores gitlab_ci_ymls licenses metrics_dashboard_ymls issues merge_requests].freeze diff --git a/lib/api/projects.rb b/lib/api/projects.rb index abbdb11a3f7..5310f0c65f6 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -3,7 +3,7 @@ require_dependency 'declarative_policy' module API - class Projects < Grape::API::Instance + class Projects < ::API::Base include PaginationParams include Helpers::CustomAttributes diff --git a/lib/api/protected_branches.rb b/lib/api/protected_branches.rb index b0a7f898eec..a448682d8bd 100644 --- a/lib/api/protected_branches.rb +++ b/lib/api/protected_branches.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProtectedBranches < Grape::API::Instance + class ProtectedBranches < ::API::Base include PaginationParams BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX) diff --git a/lib/api/protected_tags.rb b/lib/api/protected_tags.rb index aaa31cb7cc6..dd3e407ffc9 100644 --- a/lib/api/protected_tags.rb +++ b/lib/api/protected_tags.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ProtectedTags < Grape::API::Instance + class ProtectedTags < ::API::Base include PaginationParams TAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX) diff --git a/lib/api/pypi_packages.rb b/lib/api/pypi_packages.rb index 55cea075243..29ace8c2ac1 100644 --- a/lib/api/pypi_packages.rb +++ b/lib/api/pypi_packages.rb @@ -6,7 +6,7 @@ # called by the PyPI package manager client when users run commands # like `pip install` or `twine upload`. module API - class PypiPackages < Grape::API::Instance + class PypiPackages < ::API::Base helpers ::API::Helpers::PackagesManagerClientsHelpers helpers ::API::Helpers::RelatedResourcesHelpers helpers ::API::Helpers::Packages::BasicAuthHelpers diff --git a/lib/api/release/links.rb b/lib/api/release/links.rb index 9624b8924e5..23de9f9fc9f 100644 --- a/lib/api/release/links.rb +++ b/lib/api/release/links.rb @@ -2,7 +2,7 @@ module API module Release - class Links < Grape::API::Instance + class Links < ::API::Base include PaginationParams RELEASE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS diff --git a/lib/api/releases.rb b/lib/api/releases.rb index bd00d9a2e05..3bd6ea77403 100644 --- a/lib/api/releases.rb +++ b/lib/api/releases.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Releases < Grape::API::Instance + class Releases < ::API::Base include PaginationParams RELEASE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS diff --git a/lib/api/remote_mirrors.rb b/lib/api/remote_mirrors.rb index d1def05808b..f63ea04a529 100644 --- a/lib/api/remote_mirrors.rb +++ b/lib/api/remote_mirrors.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class RemoteMirrors < Grape::API::Instance + class RemoteMirrors < ::API::Base include PaginationParams before do diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 81702f8f02a..38ac1f22a48 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -3,7 +3,7 @@ require 'mime/types' module API - class Repositories < Grape::API::Instance + class Repositories < ::API::Base include PaginationParams helpers ::API::Helpers::HeadersHelpers diff --git a/lib/api/resource_label_events.rb b/lib/api/resource_label_events.rb index a8d3419528c..d3a219f0810 100644 --- a/lib/api/resource_label_events.rb +++ b/lib/api/resource_label_events.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ResourceLabelEvents < Grape::API::Instance + class ResourceLabelEvents < ::API::Base include PaginationParams helpers ::API::Helpers::NotesHelpers diff --git a/lib/api/resource_milestone_events.rb b/lib/api/resource_milestone_events.rb index a8f221f8740..21411f68dd5 100644 --- a/lib/api/resource_milestone_events.rb +++ b/lib/api/resource_milestone_events.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ResourceMilestoneEvents < Grape::API::Instance + class ResourceMilestoneEvents < ::API::Base include PaginationParams helpers ::API::Helpers::NotesHelpers diff --git a/lib/api/resource_state_events.rb b/lib/api/resource_state_events.rb index 1c1a90c09a3..9bfda39be90 100644 --- a/lib/api/resource_state_events.rb +++ b/lib/api/resource_state_events.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class ResourceStateEvents < Grape::API::Instance + class ResourceStateEvents < ::API::Base include PaginationParams helpers ::API::Helpers::NotesHelpers diff --git a/lib/api/search.rb b/lib/api/search.rb index 8b6569dd57d..0091b3d5d80 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Search < Grape::API::Instance + class Search < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/services.rb b/lib/api/services.rb index 9ee1822339c..5f3d14010a8 100644 --- a/lib/api/services.rb +++ b/lib/api/services.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module API - class Services < Grape::API::Instance + class Services < ::API::Base services = Helpers::ServicesHelpers.services service_classes = Helpers::ServicesHelpers.service_classes diff --git a/lib/api/settings.rb b/lib/api/settings.rb index 04a8bf6861d..dc917d9c529 100644 --- a/lib/api/settings.rb +++ b/lib/api/settings.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Settings < Grape::API::Instance + class Settings < ::API::Base before { authenticated_as_admin! } helpers Helpers::SettingsHelpers diff --git a/lib/api/sidekiq_metrics.rb b/lib/api/sidekiq_metrics.rb index 77f2b1e871e..b025dbfab37 100644 --- a/lib/api/sidekiq_metrics.rb +++ b/lib/api/sidekiq_metrics.rb @@ -3,7 +3,7 @@ require 'sidekiq/api' module API - class SidekiqMetrics < Grape::API::Instance + class SidekiqMetrics < ::API::Base before { authenticated_as_admin! } helpers do diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb index 3acf8b2e944..2e67b9649bc 100644 --- a/lib/api/snippets.rb +++ b/lib/api/snippets.rb @@ -2,7 +2,7 @@ module API # Snippets API - class Snippets < Grape::API::Instance + class Snippets < ::API::Base include PaginationParams resource :snippets do diff --git a/lib/api/statistics.rb b/lib/api/statistics.rb index 3869fd3ac76..fa7176491ba 100644 --- a/lib/api/statistics.rb +++ b/lib/api/statistics.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Statistics < Grape::API::Instance + class Statistics < ::API::Base before { authenticated_as_admin! } COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue, diff --git a/lib/api/submodules.rb b/lib/api/submodules.rb index 34d21d3d7d8..e2ceb49c119 100644 --- a/lib/api/submodules.rb +++ b/lib/api/submodules.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Submodules < Grape::API::Instance + class Submodules < ::API::Base before { authenticate! } helpers do diff --git a/lib/api/subscriptions.rb b/lib/api/subscriptions.rb index 533663fb087..35a28da4736 100644 --- a/lib/api/subscriptions.rb +++ b/lib/api/subscriptions.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Subscriptions < Grape::API::Instance + class Subscriptions < ::API::Base helpers ::API::Helpers::LabelHelpers before { authenticate! } diff --git a/lib/api/suggestions.rb b/lib/api/suggestions.rb index 38e96c080f2..f23d279c3f4 100644 --- a/lib/api/suggestions.rb +++ b/lib/api/suggestions.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Suggestions < Grape::API::Instance + class Suggestions < ::API::Base before { authenticate! } resource :suggestions do diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb index 30f21499c6a..2820d305d0f 100644 --- a/lib/api/system_hooks.rb +++ b/lib/api/system_hooks.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class SystemHooks < Grape::API::Instance + class SystemHooks < ::API::Base include PaginationParams before do diff --git a/lib/api/tags.rb b/lib/api/tags.rb index c1fbd3ca7c6..b969394ec47 100644 --- a/lib/api/tags.rb +++ b/lib/api/tags.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Tags < Grape::API::Instance + class Tags < ::API::Base include PaginationParams TAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(tag_name: API::NO_SLASH_URL_PART_REGEX) diff --git a/lib/api/templates.rb b/lib/api/templates.rb index 80a97aae429..0b427bbf5b9 100644 --- a/lib/api/templates.rb +++ b/lib/api/templates.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Templates < Grape::API::Instance + class Templates < ::API::Base include PaginationParams GLOBAL_TEMPLATE_TYPES = { diff --git a/lib/api/terraform/state.rb b/lib/api/terraform/state.rb index 7063a3d08b5..4168cce21ef 100644 --- a/lib/api/terraform/state.rb +++ b/lib/api/terraform/state.rb @@ -4,7 +4,7 @@ require_dependency 'api/validations/validators/limit' module API module Terraform - class State < Grape::API::Instance + class State < ::API::Base include ::Gitlab::Utils::StrongMemoize default_format :json diff --git a/lib/api/terraform/state_version.rb b/lib/api/terraform/state_version.rb index 5a4bc620cf6..b4a0efd7a2b 100644 --- a/lib/api/terraform/state_version.rb +++ b/lib/api/terraform/state_version.rb @@ -2,7 +2,7 @@ module API module Terraform - class StateVersion < Grape::API::Instance + class StateVersion < ::API::Base default_format :json before do diff --git a/lib/api/todos.rb b/lib/api/todos.rb index 5eae92a251e..ce07d13cc9a 100644 --- a/lib/api/todos.rb +++ b/lib/api/todos.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Todos < Grape::API::Instance + class Todos < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/triggers.rb b/lib/api/triggers.rb index f398bbf3e32..960d004a04c 100644 --- a/lib/api/triggers.rb +++ b/lib/api/triggers.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Triggers < Grape::API::Instance + class Triggers < ::API::Base include PaginationParams HTTP_GITLAB_EVENT_HEADER = "HTTP_#{WebHookService::GITLAB_EVENT_HEADER}".underscore.upcase diff --git a/lib/api/unleash.rb b/lib/api/unleash.rb index 8db23c3aaec..907422118f1 100644 --- a/lib/api/unleash.rb +++ b/lib/api/unleash.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Unleash < Grape::API::Instance + class Unleash < ::API::Base include PaginationParams namespace :feature_flags do diff --git a/lib/api/usage_data.rb b/lib/api/usage_data.rb index a1512197ee1..6a6562521fe 100644 --- a/lib/api/usage_data.rb +++ b/lib/api/usage_data.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class UsageData < Grape::API::Instance + class UsageData < ::API::Base before { authenticate! } namespace 'usage_data' do diff --git a/lib/api/user_counts.rb b/lib/api/user_counts.rb index 90127ecbc73..6d9db53fec8 100644 --- a/lib/api/user_counts.rb +++ b/lib/api/user_counts.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class UserCounts < Grape::API::Instance + class UserCounts < ::API::Base resource :user_counts do desc 'Return the user specific counts' do detail 'Open MR Count' diff --git a/lib/api/users.rb b/lib/api/users.rb index 68869cc3781..e7c1d644324 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Users < Grape::API::Instance + class Users < ::API::Base include PaginationParams include APIGuard include Helpers::CustomAttributes diff --git a/lib/api/v3/github.rb b/lib/api/v3/github.rb index 08bf395fa98..aed88e6091c 100644 --- a/lib/api/v3/github.rb +++ b/lib/api/v3/github.rb @@ -7,7 +7,7 @@ # module API module V3 - class Github < Grape::API::Instance + class Github < ::API::Base NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze ENDPOINT_REQUIREMENTS = { namespace: NO_SLASH_URL_PART_REGEX, diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 0b3ec10f1b4..f5de3d844e6 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Variables < Grape::API::Instance + class Variables < ::API::Base include PaginationParams before { authenticate! } diff --git a/lib/api/version.rb b/lib/api/version.rb index 6a480fc2bd9..841b55f8d6c 100644 --- a/lib/api/version.rb +++ b/lib/api/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Version < Grape::API::Instance + class Version < ::API::Base helpers ::API::Helpers::GraphqlHelpers include APIGuard diff --git a/lib/api/wikis.rb b/lib/api/wikis.rb index 4eba12157bd..21f457046f1 100644 --- a/lib/api/wikis.rb +++ b/lib/api/wikis.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module API - class Wikis < Grape::API::Instance + class Wikis < ::API::Base helpers ::API::Helpers::WikisHelpers helpers do diff --git a/lib/gitlab/experimentation.rb b/lib/gitlab/experimentation.rb index b554d394681..1ce3ffe4c86 100644 --- a/lib/gitlab/experimentation.rb +++ b/lib/gitlab/experimentation.rb @@ -68,6 +68,9 @@ module Gitlab }, group_only_trials: { tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials' + }, + default_to_issues_board: { + tracking_category: 'Growth::Conversion::Experiment::DefaultToIssuesBoard' } }.freeze diff --git a/rubocop/cop/api/grape_api_instance.rb b/rubocop/cop/api/base.rb similarity index 50% rename from rubocop/cop/api/grape_api_instance.rb rename to rubocop/cop/api/base.rb index de11b9ef3f6..85b19e9a833 100644 --- a/rubocop/cop/api/grape_api_instance.rb +++ b/rubocop/cop/api/base.rb @@ -3,8 +3,8 @@ module RuboCop module Cop module API - class GrapeAPIInstance < RuboCop::Cop::Cop - # This cop checks that APIs subclass Grape::API::Instance with Grape v1.3+. + class Base < RuboCop::Cop::Cop + # This cop checks that APIs subclass API::Base. # # @example # @@ -14,19 +14,24 @@ module RuboCop # end # end # - # # good # module API # class Projects < Grape::API::Instance # end # end - MSG = 'Inherit from Grape::API::Instance instead of Grape::API. ' \ - 'For more details check the https://gitlab.com/gitlab-org/gitlab/-/issues/215230.' + # + # # good + # module API + # class Projects < ::API::Base + # end + # end + MSG = 'Inherit from ::API::Base instead of Grape::API::Instance or Grape::API. ' \ + 'For more details check https://gitlab.com/gitlab-org/gitlab/-/issues/215230.' + def_node_matcher :grape_api, '(const (const {nil? (cbase)} :Grape) :API)' def_node_matcher :grape_api_definition, <<~PATTERN (class (const _ _) - (const - (const nil? :Grape) :API) + {#grape_api (const #grape_api :Instance)} ... ) PATTERN @@ -36,6 +41,12 @@ module RuboCop add_offense(node.children[1]) end end + + def autocorrect(node) + lambda do |corrector| + corrector.replace(node, '::API::Base') + end + end end end end diff --git a/spec/controllers/concerns/redis_tracking_spec.rb b/spec/controllers/concerns/redis_tracking_spec.rb index 90d34e5692d..831f5ad7bb1 100644 --- a/spec/controllers/concerns/redis_tracking_spec.rb +++ b/spec/controllers/concerns/redis_tracking_spec.rb @@ -14,7 +14,8 @@ RSpec.describe RedisTracking do include RedisTracking skip_before_action :authenticate_user!, only: :show - track_redis_hll_event :index, :show, name: 'g_compliance_approval_rules', feature: :approval_rule, feature_default_enabled: true + track_redis_hll_event :index, :show, name: 'g_compliance_approval_rules', feature: :approval_rule, feature_default_enabled: true, + if: [:custom_condition_one?, :custom_condition_two?] def index render html: 'index' @@ -27,13 +28,32 @@ RSpec.describe RedisTracking do def show render html: 'show' end + + private + + def custom_condition_one? + true + end + + def custom_condition_two? + true + end + end + + def expect_tracking + expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event) + .with(instance_of(String), 'g_compliance_approval_rules') + end + + def expect_no_tracking + expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event) end context 'with feature disabled' do it 'does not track the event' do stub_feature_flags(feature => false) - expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event) + expect_no_tracking get :index end @@ -45,21 +65,57 @@ RSpec.describe RedisTracking do end context 'when user is logged in' do - it 'tracks the event' do + before do sign_in(user) + end - expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event) + it 'tracks the event' do + expect_tracking get :index end it 'passes default_enabled flag' do - sign_in(user) - expect(controller).to receive(:metric_feature_enabled?).with(feature.to_sym, true) get :index end + + it 'tracks the event if DNT is not enabled' do + request.headers['DNT'] = '0' + + expect_tracking + + get :index + end + + it 'does not track the event if DNT is enabled' do + request.headers['DNT'] = '1' + + expect_no_tracking + + get :index + end + + it 'does not track the event if the format is not HTML' do + expect_no_tracking + + get :index, format: :json + end + + it 'does not track the event if a custom condition returns false' do + expect(controller).to receive(:custom_condition_two?).and_return(false) + + expect_no_tracking + + get :index + end + + it 'does not track the event for untracked actions' do + expect_no_tracking + + get :new + end end context 'when user is not logged in and there is a visitor_id' do @@ -72,26 +128,18 @@ RSpec.describe RedisTracking do it 'tracks the event' do cookies[:visitor_id] = { value: visitor_id, expires: 24.months } - expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event) + expect_tracking get :show end end context 'when user is not logged in and there is no visitor_id' do - it 'does not tracks the event' do - expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event) + it 'does not track the event' do + expect_no_tracking get :index end end - - context 'for untracked action' do - it 'does not tracks the event' do - expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event) - - get :new - end - end end end diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index b998dee09b2..a56425c2a22 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -349,7 +349,7 @@ RSpec.describe Projects::BlobController do end it_behaves_like 'tracking unique hll events', :track_editor_edit_actions do - subject { put :update, params: default_params, format: format } + subject(:request) { put :update, params: default_params } let(:target_id) { 'g_edit_by_sfe' } let(:expected_type) { instance_of(Integer) } @@ -465,7 +465,7 @@ RSpec.describe Projects::BlobController do end it_behaves_like 'tracking unique hll events', :track_editor_edit_actions do - subject { post :create, params: default_params, format: format } + subject(:request) { post :create, params: default_params } let(:target_id) { 'g_edit_by_sfe' } let(:expected_type) { instance_of(Integer) } diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index e4374a8f104..0640f9e5724 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -213,13 +213,13 @@ RSpec.describe ProjectsController do expect(assigns(:issuable_meta_data)).not_to be_nil end - it 'shows customize workflow page if wiki and issues are disabled' do + it 'shows activity page if wiki and issues are disabled' do project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::DISABLED) project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED) get :show, params: { namespace_id: project.namespace, id: project } - expect(response).to render_template("projects/_customize_workflow") + expect(response).to render_template("projects/_activity") end it 'shows activity if enabled by user' do diff --git a/spec/controllers/registrations/experience_levels_controller_spec.rb b/spec/controllers/registrations/experience_levels_controller_spec.rb index ee1acf3d93d..4be67f29107 100644 --- a/spec/controllers/registrations/experience_levels_controller_spec.rb +++ b/spec/controllers/registrations/experience_levels_controller_spec.rb @@ -85,16 +85,49 @@ RSpec.describe Registrations::ExperienceLevelsController do end end - context 'when a namespace_path is sent' do - it { is_expected.to have_gitlab_http_status(:redirect) } - it { is_expected.to redirect_to(group_path(namespace)) } - end + describe 'redirection' do + let(:project) { build(:project, namespace: namespace, creator: user, path: 'project-path') } + let(:issues_board) { build(:board, id: 123, project: project) } - context 'when no namespace_path is sent' do - let(:params) { super().merge(namespace_path: nil) } + before do + stub_experiment_for_user( + onboarding_issues: true, + default_to_issues_board: default_to_issues_board_xp? + ) + allow_next_instance_of(LearnGitlab) do |learn_gitlab| + allow(learn_gitlab).to receive(:available?).and_return(learn_gitlab_available?) + allow(learn_gitlab).to receive(:project).and_return(project) + allow(learn_gitlab).to receive(:board).and_return(issues_board) + end + end - it { is_expected.to have_gitlab_http_status(:redirect) } - it { is_expected.to redirect_to(root_path) } + context 'when namespace_path param is missing' do + let(:params) { super().merge(namespace_path: nil) } + + where( + default_to_issues_board_xp?: [true, false], + learn_gitlab_available?: [true, false] + ) + + with_them do + it { is_expected.to redirect_to('/') } + end + end + + context 'when we have a namespace_path param' do + using RSpec::Parameterized::TableSyntax + + where(:default_to_issues_board_xp?, :learn_gitlab_available?, :path) do + true | true | '/group-path/project-path/-/boards/123' + true | false | '/group-path' + false | true | '/group-path' + false | false | '/group-path' + end + + with_them do + it { is_expected.to redirect_to(path) } + end + end end describe 'applying the chosen level' do diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb index f244392bbad..a0cb696828d 100644 --- a/spec/controllers/search_controller_spec.rb +++ b/spec/controllers/search_controller_spec.rb @@ -183,7 +183,7 @@ RSpec.describe SearchController do end it_behaves_like 'tracking unique hll events', :search_track_unique_users do - subject { get :show, params: { scope: 'projects', search: 'term' }, format: format } + subject(:request) { get :show, params: { scope: 'projects', search: 'term' } } let(:target_id) { 'i_search_total' } let(:expected_type) { instance_of(String) } diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index 8d3ca9d9fd1..467adb25a17 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -201,7 +201,7 @@ RSpec.describe 'Edit Project Settings' do visit project_path(project) - expect(page).to have_content "Customize your workflow!" + expect(page).to have_content "joined project" end it "hides project activity tabs" do diff --git a/spec/features/projects/user_sees_sidebar_spec.rb b/spec/features/projects/user_sees_sidebar_spec.rb index 040e8741b6e..616c5065c07 100644 --- a/spec/features/projects/user_sees_sidebar_spec.rb +++ b/spec/features/projects/user_sees_sidebar_spec.rb @@ -128,6 +128,59 @@ RSpec.describe 'Projects > User sees sidebar' do end end + context 'as anonymous' do + let(:project) { create(:project, :public) } + let!(:issue) { create(:issue, :opened, project: project, author: user) } + + describe 'project landing page' do + before do + project.project_feature.update!( + builds_access_level: ProjectFeature::DISABLED, + merge_requests_access_level: ProjectFeature::DISABLED, + repository_access_level: ProjectFeature::DISABLED, + issues_access_level: ProjectFeature::DISABLED, + wiki_access_level: ProjectFeature::DISABLED + ) + end + + it 'does not show the project file list landing page, but the activity' do + visit project_path(project) + + expect(page).not_to have_selector '.project-stats' + expect(page).not_to have_selector '.project-last-commit' + expect(page).not_to have_selector '.project-show-files' + expect(page).to have_selector '.project-show-activity' + end + + it 'shows the wiki when enabled' do + project.project_feature.update!(wiki_access_level: ProjectFeature::ENABLED) + + visit project_path(project) + + expect(page).to have_selector '.project-show-wiki' + end + + it 'shows the issues when enabled' do + project.project_feature.update!(issues_access_level: ProjectFeature::ENABLED) + + visit project_path(project) + + expect(page).to have_selector '.issues-list' + end + + it 'shows the wiki when wiki and issues are enabled' do + project.project_feature.update!( + issues_access_level: ProjectFeature::ENABLED, + wiki_access_level: ProjectFeature::ENABLED + ) + + visit project_path(project) + + expect(page).to have_selector '.project-show-wiki' + end + end + end + context 'as guest' do let(:guest) { create(:user) } let!(:issue) { create(:issue, :opened, project: project, author: guest) } @@ -194,13 +247,13 @@ RSpec.describe 'Projects > User sees sidebar' do expect(page).not_to have_selector '.project-stats' expect(page).not_to have_selector '.project-last-commit' expect(page).not_to have_selector '.project-show-files' - expect(page).to have_selector '.project-show-customize_workflow' + expect(page).to have_selector '.project-show-activity' end - it 'shows the customize workflow when issues and wiki are disabled' do + it 'shows the project activity when issues and wiki are disabled' do visit project_path(project) - expect(page).to have_selector '.project-show-customize_workflow' + expect(page).to have_selector '.project-show-activity' end it 'shows the wiki when enabled' do diff --git a/spec/presenters/project_presenter_spec.rb b/spec/presenters/project_presenter_spec.rb index 4b4d8ee85db..b7fee5253f8 100644 --- a/spec/presenters/project_presenter_spec.rb +++ b/spec/presenters/project_presenter_spec.rb @@ -38,14 +38,33 @@ RSpec.describe ProjectPresenter do context 'when repository is empty' do let_it_be(:project) { create(:project_empty_repo, :public) } - it 'returns activity if user has repository access' do + it 'returns wiki if user has repository access and can read wiki, which exists' do + allow(project).to receive(:wiki_repository_exists?).and_return(true) allow(presenter).to receive(:can?).with(nil, :download_code, project).and_return(true) + allow(presenter).to receive(:can?).with(nil, :read_wiki, project).and_return(true) + allow(presenter).to receive(:can?).with(nil, :read_issue, project).and_return(false) + + expect(presenter.default_view).to eq('wiki') + end + + it 'returns activity if user has repository access and can read wiki, which does not exist' do + allow(presenter).to receive(:can?).with(nil, :download_code, project).and_return(true) + allow(presenter).to receive(:can?).with(nil, :read_wiki, project).and_return(true) + allow(presenter).to receive(:can?).with(nil, :read_issue, project).and_return(false) expect(presenter.default_view).to eq('activity') end - it 'returns activity if user does not have repository access' do - allow(project).to receive(:can?).with(nil, :download_code, project).and_return(false) + it 'returns issues if user does not have repository access, but can read issues' do + allow(presenter).to receive(:can?).with(nil, :download_code, project).and_return(false) + allow(presenter).to receive(:can?).with(nil, :read_issue, project).and_call_original + + expect(presenter.default_view).to eq('projects/issues/issues') + end + + it 'returns activity if user can read neither wiki nor issues' do + allow(presenter).to receive(:can?).with(nil, :download_code, project).and_return(false) + allow(presenter).to receive(:can?).with(nil, :read_issue, project).and_return(false) expect(presenter.default_view).to eq('activity') end @@ -61,8 +80,18 @@ RSpec.describe ProjectPresenter do expect(presenter.default_view).to eq('files') end - it 'returns activity if user does not have repository access' do + it 'returns wiki if user does not have repository access and can read wiki, which exists' do + allow(project).to receive(:wiki_repository_exists?).and_return(true) allow(presenter).to receive(:can?).with(nil, :download_code, project).and_return(false) + allow(presenter).to receive(:can?).with(nil, :read_wiki, project).and_return(true) + + expect(presenter.default_view).to eq('wiki') + end + + it 'returns activity if user does not have repository or wiki access' do + allow(presenter).to receive(:can?).with(nil, :download_code, project).and_return(false) + allow(presenter).to receive(:can?).with(nil, :read_issue, project).and_return(false) + allow(presenter).to receive(:can?).with(nil, :read_wiki, project).and_return(false) expect(presenter.default_view).to eq('activity') end @@ -96,22 +125,25 @@ RSpec.describe ProjectPresenter do allow(presenter).to receive(:can?).with(user, :download_code, project).and_return(false) end - it 'returns wiki if the user has the right policy' do + it 'returns wiki if the user has the right policy and the wiki exists' do + allow(project).to receive(:wiki_repository_exists?).and_return(true) allow(presenter).to receive(:can?).with(user, :read_wiki, project).and_return(true) expect(presenter.default_view).to eq('wiki') end - it 'returns customize_workflow if the user does not have the right policy' do + it 'returns activity if the user does not have the right policy' do allow(presenter).to receive(:can?).with(user, :read_wiki, project).and_return(false) + allow(presenter).to receive(:can?).with(user, :read_issue, project).and_return(false) - expect(presenter.default_view).to eq('customize_workflow') + expect(presenter.default_view).to eq('activity') end end context 'with issues as a feature available' do it 'return issues' do allow(presenter).to receive(:can?).with(user, :download_code, project).and_return(false) + allow(presenter).to receive(:can?).with(user, :read_issue, project).and_return(true) allow(presenter).to receive(:can?).with(user, :read_wiki, project).and_return(false) expect(presenter.default_view).to eq('projects/issues/issues') @@ -119,12 +151,13 @@ RSpec.describe ProjectPresenter do end context 'with no activity, no wikies and no issues' do - it 'returns customize_workflow as default' do + it 'returns activity as default' do project.project_feature.update_attribute(:issues_access_level, 0) allow(presenter).to receive(:can?).with(user, :download_code, project).and_return(false) allow(presenter).to receive(:can?).with(user, :read_wiki, project).and_return(false) + allow(presenter).to receive(:can?).with(user, :read_issue, project).and_return(false) - expect(presenter.default_view).to eq('customize_workflow') + expect(presenter.default_view).to eq('activity') end end end diff --git a/spec/rubocop/cop/api/base_spec.rb b/spec/rubocop/cop/api/base_spec.rb new file mode 100644 index 00000000000..893bcf49627 --- /dev/null +++ b/spec/rubocop/cop/api/base_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' +require 'rubocop' +require 'rubocop/rspec/support' +require_relative '../../../../rubocop/cop/api/base' + +RSpec.describe RuboCop::Cop::API::Base, type: :rubocop do + include CopHelper + + subject(:cop) { described_class.new } + + let(:corrected) do + <<~CORRECTED + class SomeAPI < ::API::Base + end + CORRECTED + end + + ['Grape::API', '::Grape::API', 'Grape::API::Instance', '::Grape::API::Instance'].each do |offense| + it "adds an offense when inheriting from #{offense}" do + expect_offense(<<~CODE) + class SomeAPI < #{offense} + #{'^' * offense.length} #{described_class::MSG} + end + CODE + + expect_correction(corrected) + end + end + + it 'does not add an offense when inheriting from BaseAPI' do + expect_no_offenses(corrected) + end +end diff --git a/spec/rubocop/cop/api/grape_api_instance_spec.rb b/spec/rubocop/cop/api/grape_api_instance_spec.rb deleted file mode 100644 index 74f175cb707..00000000000 --- a/spec/rubocop/cop/api/grape_api_instance_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'fast_spec_helper' -require 'rubocop' -require_relative '../../../../rubocop/cop/api/grape_api_instance' - -RSpec.describe RuboCop::Cop::API::GrapeAPIInstance do - include CopHelper - - subject(:cop) { described_class.new } - - it 'adds an offense when inheriting from Grape::API' do - inspect_source(<<~CODE) - class SomeAPI < Grape::API - end - CODE - - expect(cop.offenses.size).to eq(1) - end - - it 'does not add an offense when inheriting from Grape::API::Instance' do - inspect_source(<<~CODE) - class SomeAPI < Grape::API::Instance - end - CODE - - expect(cop.offenses.size).to be_zero - end -end diff --git a/spec/support/shared_examples/controllers/unique_hll_events_examples.rb b/spec/support/shared_examples/controllers/unique_hll_events_examples.rb index 7e5a225f020..cf7ee17ea13 100644 --- a/spec/support/shared_examples/controllers/unique_hll_events_examples.rb +++ b/spec/support/shared_examples/controllers/unique_hll_events_examples.rb @@ -1,47 +1,24 @@ # frozen_string_literal: true +# +# Requires a context containing: +# - request +# - expected_type +# - target_id RSpec.shared_examples 'tracking unique hll events' do |feature_flag| - context 'when format is HTML' do - let(:format) { :html } + it 'tracks unique event' do + expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(expected_type, target_id) - it 'tracks unique event' do - expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(expected_type, target_id) - - subject - end - - it 'tracks unique event if DNT is not enabled' do - expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(expected_type, target_id) - request.headers['DNT'] = '0' - - subject - end - - it 'does not track unique event if DNT is enabled' do - expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event).with(expected_type, target_id) - request.headers['DNT'] = '1' - - subject - end - - context 'when feature flag is disabled' do - it 'does not track unique event' do - stub_feature_flags(feature_flag => false) - - expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event).with(expected_type, target_id) - - subject - end - end + request end - context 'when format is JSON' do - let(:format) { :json } + context 'when feature flag is disabled' do + it 'does not track unique event' do + stub_feature_flags(feature_flag => false) - it 'does not track unique event if the format is JSON' do - expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event).with(expected_type, target_id) + expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event) - subject + request end end end diff --git a/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb b/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb index 1cf31c47df8..a6ad8fc594c 100644 --- a/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb +++ b/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb @@ -15,10 +15,10 @@ RSpec.shared_examples 'wiki controller actions' do end describe 'GET #new' do - subject { get :new, params: routing_params } + subject(:request) { get :new, params: routing_params } it 'redirects to #show and appends a `random_title` param' do - subject + request expect(response).to be_redirect expect(response.redirect_url).to match(%r{ @@ -35,7 +35,7 @@ RSpec.shared_examples 'wiki controller actions' do end it 'redirects to the wiki container and displays an error message' do - subject + request expect(response).to redirect_to(container) expect(flash[:notice]).to eq('Could not create Wiki Repository at this time. Please try again later.') @@ -146,13 +146,13 @@ RSpec.shared_examples 'wiki controller actions' do let(:random_title) { nil } - subject { get :show, params: routing_params.merge(id: id, random_title: random_title) } + subject(:request) { get :show, params: routing_params.merge(id: id, random_title: random_title) } context 'when page exists' do let(:id) { wiki_title } it 'renders the page' do - subject + request expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template('shared/wikis/show') @@ -161,19 +161,26 @@ RSpec.shared_examples 'wiki controller actions' do expect(assigns(:sidebar_limited)).to be(false) end - it 'increases the page view counter' do - expect do - subject + context 'page view tracking' do + it_behaves_like 'tracking unique hll events', :track_unique_wiki_page_views do + let(:target_id) { 'wiki_action' } + let(:expected_type) { instance_of(String) } + end - expect(response).to have_gitlab_http_status(:ok) - end.to change { Gitlab::UsageDataCounters::WikiPageCounter.read(:view) }.by(1) + it 'increases the page view counter' do + expect do + request + + expect(response).to have_gitlab_http_status(:ok) + end.to change { Gitlab::UsageDataCounters::WikiPageCounter.read(:view) }.by(1) + end end context 'when page content encoding is invalid' do it 'sets flash error' do allow(controller).to receive(:valid_encoding?).and_return(false) - subject + request expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template('shared/wikis/show') @@ -187,7 +194,7 @@ RSpec.shared_examples 'wiki controller actions' do context 'when the user can create pages' do before do - subject + request expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template('shared/wikis/edit') @@ -212,7 +219,7 @@ RSpec.shared_examples 'wiki controller actions' do end it 'shows the empty state' do - subject + request expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template('shared/wikis/empty') @@ -229,7 +236,7 @@ RSpec.shared_examples 'wiki controller actions' do let(:id) { upload_file_to_wiki(wiki, user, file_name) } it 'delivers the file with the correct headers' do - subject + request expect(response).to have_gitlab_http_status(:ok) expect(response.headers['Content-Disposition']).to match(/^inline/) @@ -255,7 +262,7 @@ RSpec.shared_examples 'wiki controller actions' do let(:id_param) { 'invalid' } it 'redirects to show' do - subject + request expect(response).to redirect_to_wiki(wiki, 'invalid') end @@ -265,7 +272,7 @@ RSpec.shared_examples 'wiki controller actions' do let(:id_param) { ' ' } it 'redirects to the home page' do - subject + request expect(response).to redirect_to_wiki(wiki, 'home') end @@ -275,7 +282,7 @@ RSpec.shared_examples 'wiki controller actions' do it 'redirects to show' do allow(controller).to receive(:valid_encoding?).and_return(false) - subject + request expect(response).to redirect_to_wiki(wiki, wiki.list_pages.first) end @@ -288,7 +295,7 @@ RSpec.shared_examples 'wiki controller actions' do allow(page).to receive(:content).and_return(nil) allow(controller).to receive(:page).and_return(page) - subject + request expect(response).to redirect_to_wiki(wiki, page) end @@ -298,7 +305,7 @@ RSpec.shared_examples 'wiki controller actions' do describe 'GET #edit' do let(:id_param) { wiki_title } - subject { get(:edit, params: routing_params.merge(id: id_param)) } + subject(:request) { get(:edit, params: routing_params.merge(id: id_param)) } it_behaves_like 'edit action' @@ -306,7 +313,7 @@ RSpec.shared_examples 'wiki controller actions' do render_views it 'shows the edit page' do - subject + request expect(response).to have_gitlab_http_status(:ok) expect(response.body).to include(s_('Wiki|Edit Page')) @@ -319,7 +326,7 @@ RSpec.shared_examples 'wiki controller actions' do let(:new_content) { 'New content' } let(:id_param) { wiki_title } - subject do + subject(:request) do patch(:update, params: routing_params.merge( id: id_param, @@ -333,7 +340,7 @@ RSpec.shared_examples 'wiki controller actions' do render_views it 'updates the page' do - subject + request wiki_page = wiki.list_pages(load_content: true).first @@ -348,7 +355,7 @@ RSpec.shared_examples 'wiki controller actions' do end it 'renders the empty state' do - subject + request expect(response).to render_template('shared/wikis/empty') end @@ -359,7 +366,7 @@ RSpec.shared_examples 'wiki controller actions' do let(:new_title) { 'New title' } let(:new_content) { 'New content' } - subject do + subject(:request) do post(:create, params: routing_params.merge( wiki: { title: new_title, content: new_content } @@ -369,7 +376,7 @@ RSpec.shared_examples 'wiki controller actions' do context 'when page is valid' do it 'creates the page' do expect do - subject + request end.to change { wiki.list_pages.size }.by 1 wiki_page = wiki.find_page(new_title) @@ -384,7 +391,7 @@ RSpec.shared_examples 'wiki controller actions' do it 'renders the edit state' do expect do - subject + request end.not_to change { wiki.list_pages.size } expect(response).to render_template('shared/wikis/edit') @@ -395,7 +402,7 @@ RSpec.shared_examples 'wiki controller actions' do describe 'DELETE #destroy' do let(:id_param) { wiki_title } - subject do + subject(:request) do delete(:destroy, params: routing_params.merge( id: id_param @@ -405,7 +412,7 @@ RSpec.shared_examples 'wiki controller actions' do context 'when page exists' do it 'deletes the page' do expect do - subject + request end.to change { wiki.list_pages.size }.by(-1) end @@ -418,7 +425,7 @@ RSpec.shared_examples 'wiki controller actions' do it 'renders the edit state' do expect do - subject + request end.not_to change { wiki.list_pages.size } expect(response).to render_template('shared/wikis/edit') @@ -432,7 +439,7 @@ RSpec.shared_examples 'wiki controller actions' do it 'renders 404' do expect do - subject + request end.not_to change { wiki.list_pages.size } expect(response).to have_gitlab_http_status(:not_found)