From 25618c1e28302ca7c4a881b96f5e72d1070566e0 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 14 Oct 2021 00:12:08 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_manual_todo.yml | 1 - GITLAB_ELASTICSEARCH_INDEXER_VERSION | 2 +- .../concerns/packages/finder_helper.rb | 6 + app/finders/packages/group_packages_finder.rb | 4 +- ...e_events_i_package_debian_push_package.yml | 3 +- doc/administration/audit_events.md | 2 - .../package_information/defaults.md | 72 +++++------ doc/administration/user_settings.md | 62 ++++++---- doc/api/events.md | 8 -- doc/integration/saml.md | 9 +- doc/user/group/saml_sso/index.md | 9 +- doc/user/profile/index.md | 46 +++---- .../project/merge_requests/getting_started.md | 11 +- doc/user/project/merge_requests/index.md | 9 +- .../project/merge_requests/reviews/index.md | 4 +- doc/user/project/wiki/index.md | 16 ++- doc/user/shortcuts.md | 8 +- lib/api/api.rb | 10 +- .../grape_logging/loggers/context_logger.rb | 11 +- .../packages/group_packages_finder_spec.rb | 13 ++ spec/requests/api/api_spec.rb | 116 ++++++++++++++---- .../api/ci/runner/jobs_request_post_spec.rb | 6 +- .../api/ci/runner/runners_delete_spec.rb | 2 +- .../api/ci/runner/runners_post_spec.rb | 6 +- .../api/ci/runner/runners_verify_post_spec.rb | 2 +- spec/requests/api/ci/triggers_spec.rb | 6 +- spec/requests/api/internal/base_spec.rb | 8 +- spec/requests/api/projects_spec.rb | 2 +- ...ing_application_context_shared_examples.rb | 16 +++ 29 files changed, 307 insertions(+), 163 deletions(-) diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml index ebebcdba91c..a646f6ec950 100644 --- a/.rubocop_manual_todo.yml +++ b/.rubocop_manual_todo.yml @@ -741,7 +741,6 @@ RSpec/AnyInstanceOf: - 'spec/policies/ci/pipeline_policy_spec.rb' - 'spec/presenters/gitlab/blame_presenter_spec.rb' - 'spec/presenters/merge_request_presenter_spec.rb' - - 'spec/requests/api/api_spec.rb' - 'spec/requests/api/ci/runner/jobs_artifacts_spec.rb' - 'spec/requests/api/ci/runner/jobs_put_spec.rb' - 'spec/requests/api/ci/runner/jobs_request_post_spec.rb' diff --git a/GITLAB_ELASTICSEARCH_INDEXER_VERSION b/GITLAB_ELASTICSEARCH_INDEXER_VERSION index 68e69e405ee..75249069675 100644 --- a/GITLAB_ELASTICSEARCH_INDEXER_VERSION +++ b/GITLAB_ELASTICSEARCH_INDEXER_VERSION @@ -1 +1 @@ -2.15.0 +2.16.0 diff --git a/app/finders/concerns/packages/finder_helper.rb b/app/finders/concerns/packages/finder_helper.rb index d2784a1d270..0ae99782cd3 100644 --- a/app/finders/concerns/packages/finder_helper.rb +++ b/app/finders/concerns/packages/finder_helper.rb @@ -54,6 +54,12 @@ module Packages packages.search_by_name(params[:package_name]) end + def filter_by_exact_package_name(packages) + return packages unless params[:package_name].present? + + packages.with_name(params[:package_name]) + end + def filter_by_package_version(packages) return packages unless params[:package_version].present? diff --git a/app/finders/packages/group_packages_finder.rb b/app/finders/packages/group_packages_finder.rb index e753fa4d455..3ac5f00d518 100644 --- a/app/finders/packages/group_packages_finder.rb +++ b/app/finders/packages/group_packages_finder.rb @@ -4,7 +4,7 @@ module Packages class GroupPackagesFinder include ::Packages::FinderHelper - def initialize(current_user, group, params = { exclude_subgroups: false, order_by: 'created_at', sort: 'asc' }) + def initialize(current_user, group, params = { exclude_subgroups: false, exact_name: false, order_by: 'created_at', sort: 'asc' }) @current_user = current_user @group = group @params = params @@ -30,7 +30,7 @@ module Packages packages = filter_with_version(packages) packages = filter_by_package_type(packages) - packages = filter_by_package_name(packages) + packages = (params[:exact_name] ? filter_by_exact_package_name(packages) : filter_by_package_name(packages)) packages = filter_by_package_version(packages) installable_only ? packages.installable : filter_by_status(packages) end diff --git a/config/metrics/counts_all/20210216182917_package_events_i_package_debian_push_package.yml b/config/metrics/counts_all/20210216182917_package_events_i_package_debian_push_package.yml index 4fe173115ca..c6f23fe0c80 100644 --- a/config/metrics/counts_all/20210216182917_package_events_i_package_debian_push_package.yml +++ b/config/metrics/counts_all/20210216182917_package_events_i_package_debian_push_package.yml @@ -7,7 +7,8 @@ product_stage: package product_group: group::package product_category: package registry value_type: number -status: deprecated +status: removed +milestone_removed: "14.4" time_frame: all data_source: redis distribution: diff --git a/doc/administration/audit_events.md b/doc/administration/audit_events.md index 3ff5fb2635d..572c341f2b2 100644 --- a/doc/administration/audit_events.md +++ b/doc/administration/audit_events.md @@ -137,8 +137,6 @@ Project event queries are limited to a maximum of 30 days. ### Instance events **(PREMIUM SELF)** -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/2336) in GitLab 9.3. - Server-wide audit events introduce the ability to observe user actions across the entire instance of your GitLab server, making it easy to understand who changed what and when for audit purposes. diff --git a/doc/administration/package_information/defaults.md b/doc/administration/package_information/defaults.md index 0c104677206..95d6135c28c 100644 --- a/doc/administration/package_information/defaults.md +++ b/doc/administration/package_information/defaults.md @@ -14,42 +14,42 @@ the package will assume the defaults as noted below. See the table below for the list of ports that the Omnibus GitLab assigns by default: -| Component | On by default | Communicates via | Alternative | Connection port | -| :----------------------------------------------------: | :------------: | :--------------: | :---------: | :------------------------------------: | -| GitLab Rails | Yes | Port | X | 80 or 443 | -| GitLab Shell | Yes | Port | X | 22 | -| PostgreSQL | Yes | Socket | Port (5432) | X | -| Redis | Yes | Socket | Port (6379) | X | -| Puma | Yes | Socket | Port (8080) | X | -| GitLab Workhorse | Yes | Socket | Port (8181) | X | -| NGINX status | Yes | Port | X | 8060 | -| Prometheus | Yes | Port | X | 9090 | -| Node exporter | Yes | Port | X | 9100 | -| Redis exporter | Yes | Port | X | 9121 | -| PostgreSQL exporter | Yes | Port | X | 9187 | -| PgBouncer exporter | No | Port | X | 9188 | -| GitLab Exporter | Yes | Port | X | 9168 | -| Sidekiq exporter | Yes | Port | X | 8082 | -| Puma exporter | No | Port | X | 8083 | -| Geo PostgreSQL | No | Socket | Port (5431) | X | -| Redis Sentinel | No | Port | X | 26379 | -| Incoming email | No | Port | X | 143 | -| Elastic search | No | Port | X | 9200 | -| GitLab Pages | No | Port | X | 80 or 443 | -| GitLab Registry | No* | Port | X | 80, 443 or 5050 | -| GitLab Registry | No | Port | X | 5000 | -| LDAP | No | Port | X | Depends on the component configuration | -| Kerberos | No | Port | X | 8443 or 8088 | -| OmniAuth | Yes | Port | X | Depends on the component configuration | -| SMTP | No | Port | X | 465 | -| Remote syslog | No | Port | X | 514 | -| Mattermost | No | Port | X | 8065 | -| Mattermost | No | Port | X | 80 or 443 | -| PgBouncer | No | Port | X | 6432 | -| Consul | No | Port | X | 8300, 8301(UDP), 8500, 8600[^Consul-notes] | -| Patroni | No | Port | X | 8008 | -| GitLab KAS | No | Port | X | 8150 | -| Gitaly | No | Port | X | 8075 | +| Component | On by default | Communicates via | Alternative | Connection port | +|:-------------------:|:-------------:|:----------------:|:-----------:|:------------------------------------------:| +| GitLab Rails | Yes | Port | X | 80 or 443 | +| GitLab Shell | Yes | Port | X | 22 | +| PostgreSQL | Yes | Socket | Port (5432) | X | +| Redis | Yes | Socket | Port (6379) | X | +| Puma | Yes | Socket | Port (8080) | X | +| GitLab Workhorse | Yes | Socket | Port (8181) | X | +| NGINX status | Yes | Port | X | 8060 | +| Prometheus | Yes | Port | X | 9090 | +| Node exporter | Yes | Port | X | 9100 | +| Redis exporter | Yes | Port | X | 9121 | +| PostgreSQL exporter | Yes | Port | X | 9187 | +| PgBouncer exporter | No | Port | X | 9188 | +| GitLab Exporter | Yes | Port | X | 9168 | +| Sidekiq exporter | Yes | Port | X | 8082 | +| Puma exporter | No | Port | X | 8083 | +| Geo PostgreSQL | No | Socket | Port (5431) | X | +| Redis Sentinel | No | Port | X | 26379 | +| Incoming email | No | Port | X | 143 | +| Elastic search | No | Port | X | 9200 | +| GitLab Pages | No | Port | X | 80 or 443 | +| GitLab Registry | No* | Port | X | 80, 443 or 5050 | +| GitLab Registry | No | Port | X | 5000 | +| LDAP | No | Port | X | Depends on the component configuration | +| Kerberos | No | Port | X | 8443 or 8088 | +| OmniAuth | Yes | Port | X | Depends on the component configuration | +| SMTP | No | Port | X | 465 | +| Remote syslog | No | Port | X | 514 | +| Mattermost | No | Port | X | 8065 | +| Mattermost | No | Port | X | 80 or 443 | +| PgBouncer | No | Port | X | 6432 | +| Consul | No | Port | X | 8300, 8301(UDP), 8500, 8600[^Consul-notes] | +| Patroni | No | Port | X | 8008 | +| GitLab KAS | No | Port | X | 8150 | +| Gitaly | No | Port | X | 8075 | Legend: diff --git a/doc/administration/user_settings.md b/doc/administration/user_settings.md index 681ce87edb6..891c11afaf4 100644 --- a/doc/administration/user_settings.md +++ b/doc/administration/user_settings.md @@ -4,40 +4,56 @@ group: Access 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/#assignments --- -# Modifying global user settings +# Modify global user settings **(FREE SELF)** GitLab administrators can modify user settings for the entire GitLab instance. -## Disallow users creating top-level groups +## Prevent users from creating top-level groups -By default, new users can create top-level groups. To disable this, modify the appropriate configuration file, -and then [reconfigure and restart GitLab](restart_gitlab.md). +By default, new users can create top-level groups. To disable your users' +ability to create top-level groups: -For Omnibus installations, add the following to `/etc/gitlab/gitlab.rb`: +**Omnibus GitLab installations** -```ruby -gitlab_rails['gitlab_default_can_create_group'] = false -``` +1. Edit `/etc/gitlab/gitlab.rb` and add the following line: -For source installations, uncomment the following line in `config/gitlab.yml`: + ```ruby + gitlab_rails['gitlab_default_can_create_group'] = false + ``` -```yaml -# default_can_create_group: false # default: true -``` +1. [Reconfigure and restart GitLab](restart_gitlab.md#omnibus-installations). -## Disallow users changing usernames +**Source installations** -By default, new users can change their usernames. To disable this, modify the appropriate configuration file, -and then [reconfigure and restart GitLab](restart_gitlab.md). +1. Edit `config/gitlab.yml` and uncomment the following line: -For Omnibus installations, add the following to `/etc/gitlab/gitlab.rb`: + ```yaml + # default_can_create_group: false # default: true + ``` -```ruby -gitlab_rails['gitlab_username_changing_enabled'] = false -``` +1. [Restart GitLab](restart_gitlab.md#installations-from-source). -For source installations, uncomment the following line in `config/gitlab.yml`: +## Prevent users from changing their usernames -```yaml -# username_changing_enabled: false # default: true - User can change their username/namespace -``` +By default, new users can change their usernames. To disable your users' +ability to change their usernames: + +**Omnibus GitLab installations** + +1. Edit `/etc/gitlab/gitlab.rb` and add the following line: + + ```ruby + gitlab_rails['gitlab_username_changing_enabled'] = false + ``` + +1. [Reconfigure and restart GitLab](restart_gitlab.md#omnibus-installations). + +**Source installations** + +1. Edit `config/gitlab.yml` and uncomment the following line: + + ```yaml + # username_changing_enabled: false # default: true - User can change their username/namespace + ``` + +1. [Restart GitLab](restart_gitlab.md#installations-from-source). diff --git a/doc/api/events.md b/doc/api/events.md index 8800e7f7f9b..2d173f0053f 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -87,10 +87,6 @@ GitLab removes events older than 3 years from the events table for performance r ## List currently authenticated user's events ->**Notes:** -> This endpoint was introduced in GitLab 9.3. -> `read_user` access was introduced in GitLab 11.3. - Get a list of events for the authenticated user. Scope `read_user` or `api` is required. ```plaintext @@ -163,10 +159,6 @@ Example response: ### Get user contribution events ->**Notes:** -> Documentation was formerly located in the [Users API pages](users.md). -> `read_user` access was introduced in GitLab 11.3. - Get the contribution events for the specified user, sorted from newest to oldest. Scope `read_user` or `api` is required. ```plaintext diff --git a/doc/integration/saml.md b/doc/integration/saml.md index 79e2fd64634..1632359dedf 100644 --- a/doc/integration/saml.md +++ b/doc/integration/saml.md @@ -801,11 +801,12 @@ If you only require a SAML provider for testing, a [quick start guide to start a ### 500 error after login If you see a "500 error" in GitLab when you are redirected back from the SAML -sign-in page, this likely indicates that GitLab couldn't get the email address -for the SAML user. +sign-in page, this could indicate that: -Ensure the IdP provides a claim containing the user's email address, using the -claim name `email` or `mail`. +- GitLab couldn't get the email address for the SAML user. Ensure the IdP provides a claim containing the user's + email address using the claim name `email` or `mail`. +- The certificate set your `gitlab.rb` file for `idp_cert_fingerprint` or `idp_cert` file is incorrect. +- Your `gitlab.rb` file is set to enable `idp_cert_fingerprint`, and `idp_cert` is being provided, or the reverse. ### 422 error after login diff --git a/doc/user/group/saml_sso/index.md b/doc/user/group/saml_sso/index.md index 328d1fa506d..1c894550a14 100644 --- a/doc/user/group/saml_sso/index.md +++ b/doc/user/group/saml_sso/index.md @@ -361,7 +361,14 @@ To link the SAML groups from the `saml:AttributeStatement` example above: If a user is a member of multiple SAML groups mapped to the same GitLab group, the user gets the highest access level from the groups. For example, if one group is linked as `Guest` and another `Maintainer`, a user in both groups gets `Maintainer` -access. +access. + +Users granted: + +- A higher role with Group Sync are displayed as having + [direct membership](../../project/members/#display-direct-members) of the group. +- A lower or the same role with Group Sync are displayed as having + [inherited membership](../../project/members/#display-inherited-members) of the group. ### Automatic member removal diff --git a/doc/user/profile/index.md b/doc/user/profile/index.md index 24006e6f875..7f16c4e244e 100644 --- a/doc/user/profile/index.md +++ b/doc/user/profile/index.md @@ -15,25 +15,25 @@ Your profile also includes settings, which you use to customize your GitLab expe To access your profile: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select your name or username. ## Access your user settings To access your user settings: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. ## Change your password To change your password: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. On the left sidebar, select **Password**. -1. In the **Current password** field, enter your current password. -1. In the **New password** and **Password confirmation** field, enter your new password. +1. In the **Current password** text box, enter your current password. +1. In the **New password** and **Password confirmation** text box, enter your new password. 1. Select **Save password**. If you don't know your current password, select the **I forgot my password** link. @@ -53,7 +53,7 @@ Prerequisites: To change your username: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. On the left sidebar, select **Account**. 1. In the **Change username** section, enter a new username as the path. @@ -63,10 +63,10 @@ To change your username: To add new email to your account: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. On the left sidebar, select **Emails**. -1. In the **Email** box, enter the new email. +1. In the **Email** text box, enter the new email. 1. Select **Add email address**. 1. Verify your email address with the verification email received. @@ -76,7 +76,7 @@ You can make your user profile visible to only you and GitLab administrators. To make your profile private: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. Select the **Private profile** checkbox. 1. Select **Update profile settings**. @@ -107,7 +107,7 @@ They can help other users connect with you on other platforms. To add links to other accounts: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. In the **Main settings** section, add your information from: - Skype @@ -121,7 +121,7 @@ In the user contribution calendar graph and recent activity list, you can see yo To show private contributions: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. In the **Main settings** section, select the **Include private contributions on my profile** checkbox. 1. Select **Update profile settings**. @@ -135,9 +135,9 @@ your name in your profile. To specify your pronouns: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. -1. In the **Pronouns** field, enter your pronouns. +1. In the **Pronouns** text box, enter your pronouns. 1. Select **Update profile settings**. ## Add your name pronunciation @@ -149,9 +149,9 @@ your name. To add your name pronunciation: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. -1. In the **Pronunciation** field, enter how your name is pronounced. +1. In the **Pronunciation** text box, enter how your name is pronounced. 1. Select **Update profile settings**. ## Set your current status @@ -165,11 +165,11 @@ Your status is publicly visible even if your [profile is private](#make-your-use To set your current status: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Set status** or, if you have already set a status, **Edit status**. 1. Set the desired emoji and status message. Status messages must be plain text and 100 characters or less. They can also contain emoji codes like, `I'm on vacation :palm_tree:`. -1. Select a value from the **Clear status after** dropdown. +1. Select a value from the **Clear status after** dropdown list. 1. Select **Set status**. Alternatively, you can select **Remove status** to remove your user status entirely. You can also set your current status by [using the API](../../api/users.md#user-status). @@ -188,12 +188,12 @@ To indicate to others that you are busy, you can set an indicator. To set the busy status indicator, either: - Set it directly: - 1. In the top-right corner, select your avatar. + 1. On the top bar, in the top-right corner, select your avatar. 1. Select **Set status** or, if you have already set a status, **Edit status**. 1. Select the **Busy** checkbox. - Set it on your profile: - 1. In the top-right corner, select your avatar. + 1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. In the **Current status** section, select the **Busy** checkbox. @@ -221,7 +221,7 @@ To set the busy status indicator, either: To set your time zone: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. In the **Time settings** section, select your time zone from the dropdown list. @@ -236,7 +236,7 @@ To change your commit email: 1. In the top-right corner, select your avatar. 1. Select **Edit profile**. -1. In the **Commit email** list, select an email address. +1. In the **Commit email** dropdown list, select an email address. 1. Select **Update profile settings**. ### Use an automatically-generated private commit email @@ -246,9 +246,9 @@ so you can keep your email information private. To use a private commit email: -1. In the top-right corner, select your avatar. +1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. -1. In the **Commit email** list, select the **Use a private email** option. +1. In the **Commit email** dropdown list, select **Use a private email**. 1. Select **Update profile settings**. Every Git-related action uses the private commit email. diff --git a/doc/user/project/merge_requests/getting_started.md b/doc/user/project/merge_requests/getting_started.md index 72fcd7f36b0..cee4df1f61e 100644 --- a/doc/user/project/merge_requests/getting_started.md +++ b/doc/user/project/merge_requests/getting_started.md @@ -50,8 +50,9 @@ Learn the various ways to [create a merge request](creating_merge_requests.md). ## What you can do with merge requests When you start a new merge request, you can immediately include the following -options, or add them later by clicking the **Edit** button on the merge -request's page at the top-right side: +options. You can also add them later by either selecting **Edit** on the merge +request's page at the top-right side, or by using +[keyboard shortcuts for merge requests](../../shortcuts.md#issues-and-merge-requests): - [Assign](#assignee) the merge request to a colleague for review. With [multiple assignees](#multiple-assignees), you can assign it to more than one person at a time. - Set a [milestone](../milestones/index.md) to track time-sensitive changes. @@ -74,8 +75,10 @@ After you have created the merge request, you can also: - Add [code suggestions](reviews/suggestions.md) to change the content of merge requests directly into merge request threads, and easily apply them to the codebase directly from the UI. - Add a time estimation and the time spent with that merge request with [Time Tracking](../time_tracking.md#time-tracking). -Many of these can be set when pushing changes from the command line, -with [Git push options](../push_options.md). +Many of these options can be set: + +- From the merge request page, with [keyboard shortcuts](../../shortcuts.md#issues-and-merge-requests). +- When pushing changes from the command line, with [Git push options](../push_options.md). See also other [features associated to merge requests](reviews/index.md#associated-features). diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index b7e055ca749..2c062c2c592 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -40,14 +40,18 @@ important parts of the merge request: ## View merge requests -You can view merge requests for a specific project, or for all projects in a group: +To view a list of merge requests: -- **Specific project**: Go to your project and select **Merge requests**. +- **Merge requests for a project**: Go to your project and select **Merge requests**, or use + the g + m [keyboard shortcut](../../shortcuts.md) from a page in your project. - **All projects in a group**: Go to your group and select **Merge requests**. If your group contains subgroups, this view also displays merge requests from the subgroup projects. GitLab displays a count of open merge requests in the left sidebar, but [caches the value](reviews/index.md#cached-merge-request-count) for groups with a large number of open merge requests. +- **Merge requests assigned to you**: On any GitLab page, select **Merge requests** + in the top bar, or use the Shift + m + [global keyboard shortcut](../../shortcuts.md). GitLab displays open merge requests, with tabs to filter the list by open and closed status: @@ -153,3 +157,4 @@ For a web developer writing a webpage for your company's website: - [Review a merge request](reviews/index.md) - [Authorization for merge requests](authorization_for_merge_requests.md) - [Testing and reports](testing_and_reports_in_merge_requests.md) +- [GitLab keyboard shortcuts](../../shortcuts.md) diff --git a/doc/user/project/merge_requests/reviews/index.md b/doc/user/project/merge_requests/reviews/index.md index dbf3b0180e6..e6f84f1c357 100644 --- a/doc/user/project/merge_requests/reviews/index.md +++ b/doc/user/project/merge_requests/reviews/index.md @@ -158,7 +158,7 @@ Multiline comments display the comment's line numbers above the body of the comm Users with permission level of [Developer or higher](../../../permissions.md) can manage merge requests. -When bulk editing merge requests in a project, you can edit the following attributes: +When bulk-editing merge requests in a project, you can edit the following attributes: - Status (open/closed) - Assignee @@ -211,6 +211,8 @@ These features are associated with merge requests: GitLab can provide the option to resolve certain merge request conflicts in the GitLab UI. - [Revert changes](../revert_changes.md): Revert changes from any commit from a merge request. +- [Keyboard shortcuts](../../../shortcuts.md#issues-and-merge-requests): + Access and modify specific parts of a merge request with keyboard commands. ## Troubleshooting diff --git a/doc/user/project/wiki/index.md b/doc/user/project/wiki/index.md index f18e133ab9c..e2a8167b14c 100644 --- a/doc/user/project/wiki/index.md +++ b/doc/user/project/wiki/index.md @@ -13,8 +13,14 @@ in each GitLab project. Every wiki is a separate Git repository, so you can crea wiki pages in the web interface, or [locally using Git](#create-or-edit-wiki-pages-locally). To access the wiki for a project or group, go to the page for your project or group -and, in the left sidebar, select **Wiki**. If **Wiki** is not listed in the -left sidebar, a project administrator has [disabled it](#enable-or-disable-a-project-wiki). +and either: + +- In the left sidebar, select **Wiki**. +- On any page in the project, use the g + w + [wiki keyboard shortcut](../../shortcuts.md). + +If **Wiki** is not listed in the left sidebar of your project, a project administrator +has [disabled it](#enable-or-disable-a-project-wiki). GitLab wikis support Markdown, RDoc, AsciiDoc, and Org for content. Wiki pages written in Markdown support all [Markdown features](../../markdown.md), @@ -130,8 +136,9 @@ may not be able to check out the wiki locally afterward. You need at least the [Developer role](../../permissions.md) to edit a wiki page: 1. Go to your project or group and select **Wiki**. -1. Go to the page you want to edit. -1. Select the edit icon (**{pencil}**). +1. Go to the page you want to edit, and either: + - Use the e wiki [keyboard shortcut](../../shortcuts.md#wiki-pages). + - Select the edit icon (**{pencil}**). 1. Edit the content. 1. Select **Save changes**. @@ -355,3 +362,4 @@ For the status of the ongoing development for CommonMark and GitLab Flavored Mar - [Project wikis API](../../../api/wikis.md) - [Group repository storage moves API](../../../api/group_repository_storage_moves.md) - [Group wikis API](../../../api/group_wikis.md) +- [Wiki keyboard shortcuts](../../shortcuts.md#wiki-pages) diff --git a/doc/user/shortcuts.md b/doc/user/shortcuts.md index 37e89dd54db..f46c5428248 100644 --- a/doc/user/shortcuts.md +++ b/doc/user/shortcuts.md @@ -39,7 +39,7 @@ These shortcuts are available in most areas of GitLab: | Shift + s | Go to your Snippets page. | | s / / | Put cursor in the search bar. | | Shift + i | Go to your Issues page. | -| Shift + m | Go to your Merge requests page.| +| Shift + m | Go to your [Merge requests](project/merge_requests/index.md) page. | | Shift + t | Go to your To-Do List page. | | p + b | Show or hide the Performance Bar. | | g + x | Toggle between [GitLab](https://gitlab.com/) and [GitLab Next](https://next.gitlab.com/) (GitLab SaaS only). | @@ -77,17 +77,17 @@ relatively quickly to work, and they take you to another page in the project. | g + i | Go to the project issues list (**Issues > List**). | | i | Go to the New Issue page (**Issues**, select **New Issue** ). | | g + b | Go to the project issue boards list (**Issues > Boards**). | -| g + m | Go to the project merge requests list (**Merge Requests**). | +| g + m | Go to the project [merge requests](project/merge_requests/index.md) list (**Merge Requests**). | | g + j | Go to the CI/CD jobs list (**CI/CD > Jobs**). | | g + l | Go to the project metrics (**Monitor > Metrics**). | | g + e | Go to the project environments (**Deployments > Environments**). | | g + k | Go to the project Kubernetes cluster integration page (**Infrastructure > Kubernetes clusters**). Note that you must have at least [`maintainer` permissions](permissions.md) to access this page. | | g + s | Go to the project snippets list (**Snippets**). | -| g + w | Go to the project wiki (**Wiki**), if enabled. | +| g + w | Go to the [project wiki](project/wiki/index.md) (**Wiki**), if enabled. | ### Issues and merge requests -These shortcuts are available when viewing issues and merge requests: +These shortcuts are available when viewing issues and [merge requests](project/merge_requests/index.md): | Keyboard shortcut | Description | |------------------------------|-------------| diff --git a/lib/api/api.rb b/lib/api/api.rb index 9be515bcb09..a4d42c735cb 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -11,11 +11,12 @@ module API COMMIT_ENDPOINT_REQUIREMENTS = NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(sha: NO_SLASH_URL_PART_REGEX).freeze USER_REQUIREMENTS = { user_id: NO_SLASH_URL_PART_REGEX }.freeze LOG_FILTERS = ::Rails.application.config.filter_parameters + [/^output$/] + LOG_FORMATTER = Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp.new insert_before Grape::Middleware::Error, GrapeLogging::Middleware::RequestLogger, logger: Logger.new(LOG_FILENAME), - formatter: Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp.new, + formatter: LOG_FORMATTER, include: [ GrapeLogging::Loggers::FilterParameters.new(LOG_FILTERS), Gitlab::GrapeLogging::Loggers::ClientEnvLogger.new, @@ -49,16 +50,19 @@ module API before do coerce_nil_params_to_array! - api_endpoint = env['api.endpoint'] + api_endpoint = request.env[Grape::Env::API_ENDPOINT] feature_category = api_endpoint.options[:for].try(:feature_category_for_app, api_endpoint).to_s + # remote_ip is added here and the ContextLogger so that the + # client_id field is set correctly, as the user object does not + # survive between multiple context pushes. Gitlab::ApplicationContext.push( user: -> { @current_user }, project: -> { @project }, namespace: -> { @group }, runner: -> { @current_runner || @runner }, - caller_id: api_endpoint.endpoint_id, remote_ip: request.ip, + caller_id: api_endpoint.endpoint_id, feature_category: feature_category ) end diff --git a/lib/gitlab/grape_logging/loggers/context_logger.rb b/lib/gitlab/grape_logging/loggers/context_logger.rb index 468a296886e..1da96fdfdff 100644 --- a/lib/gitlab/grape_logging/loggers/context_logger.rb +++ b/lib/gitlab/grape_logging/loggers/context_logger.rb @@ -1,11 +1,18 @@ # frozen_string_literal: true -# This module adds additional correlation id the grape logger +# This class adds application context to the grape logger module Gitlab module GrapeLogging module Loggers class ContextLogger < ::GrapeLogging::Loggers::Base - def parameters(_, _) + def parameters(request, _) + # Add remote_ip if this request wasn't already handled. If we + # add it unconditionally we can break client_id due to the way + # the context inherits the user. + unless Gitlab::ApplicationContext.current_context_include?(:remote_ip) + Gitlab::ApplicationContext.push(remote_ip: request.ip) + end + Gitlab::ApplicationContext.current end end diff --git a/spec/finders/packages/group_packages_finder_spec.rb b/spec/finders/packages/group_packages_finder_spec.rb index d7f62bdfbb4..3254c436674 100644 --- a/spec/finders/packages/group_packages_finder_spec.rb +++ b/spec/finders/packages/group_packages_finder_spec.rb @@ -147,6 +147,19 @@ RSpec.describe Packages::GroupPackagesFinder do end end + context 'with exact package_name' do + let_it_be(:named_package) { create(:maven_package, project: project, name: 'maven') } + let_it_be(:other_package) { create(:maven_package, project: project, name: 'maventoo') } + + let(:params) { { exact_name: true, package_name: package_name } } + + context 'as complete name' do + let(:package_name) { 'maven' } + + it { is_expected.to match_array([named_package]) } + end + end + it_behaves_like 'concerning versionless param' it_behaves_like 'concerning package statuses' end diff --git a/spec/requests/api/api_spec.rb b/spec/requests/api/api_spec.rb index 81620fce448..95eb503c6bc 100644 --- a/spec/requests/api/api_spec.rb +++ b/spec/requests/api/api_spec.rb @@ -100,39 +100,105 @@ RSpec.describe API::API do end end - context 'application context' do - let_it_be(:project) { create(:project) } + describe 'logging', :aggregate_failures do + let_it_be(:project) { create(:project, :public) } let_it_be(:user) { project.owner } - it 'logs all application context fields' do - allow_any_instance_of(Gitlab::GrapeLogging::Loggers::ContextLogger).to receive(:parameters) do - Gitlab::ApplicationContext.current.tap do |log_context| - expect(log_context).to match('correlation_id' => an_instance_of(String), - 'meta.caller_id' => 'GET /api/:version/projects/:id/issues', - 'meta.remote_ip' => an_instance_of(String), - 'meta.project' => project.full_path, - 'meta.root_namespace' => project.namespace.full_path, - 'meta.user' => user.username, - 'meta.client_id' => an_instance_of(String), - 'meta.feature_category' => 'issue_tracking') + context 'when the endpoint is handled by the application' do + context 'when the endpoint supports all possible fields' do + it 'logs all application context fields and the route' do + expect(described_class::LOG_FORMATTER).to receive(:call) do |_severity, _datetime, _, data| + expect(data.stringify_keys) + .to include('correlation_id' => an_instance_of(String), + 'meta.caller_id' => 'GET /api/:version/projects/:id/issues', + 'meta.remote_ip' => an_instance_of(String), + 'meta.project' => project.full_path, + 'meta.root_namespace' => project.namespace.full_path, + 'meta.user' => user.username, + 'meta.client_id' => a_string_matching(%r{\Auser/.+}), + 'meta.feature_category' => 'issue_tracking', + 'route' => '/api/:version/projects/:id/issues') + end + + get(api("/projects/#{project.id}/issues", user)) + + expect(response).to have_gitlab_http_status(:ok) end end - get(api("/projects/#{project.id}/issues", user)) + it 'skips context fields that do not apply' do + expect(described_class::LOG_FORMATTER).to receive(:call) do |_severity, _datetime, _, data| + expect(data.stringify_keys) + .to include('correlation_id' => an_instance_of(String), + 'meta.caller_id' => 'GET /api/:version/broadcast_messages', + 'meta.remote_ip' => an_instance_of(String), + 'meta.client_id' => a_string_matching(%r{\Aip/.+}), + 'meta.feature_category' => 'navigation', + 'route' => '/api/:version/broadcast_messages') + + expect(data.stringify_keys).not_to include('meta.project', 'meta.root_namespace', 'meta.user') + end + + get(api('/broadcast_messages')) + + expect(response).to have_gitlab_http_status(:ok) + end end - it 'skips fields that do not apply' do - allow_any_instance_of(Gitlab::GrapeLogging::Loggers::ContextLogger).to receive(:parameters) do - Gitlab::ApplicationContext.current.tap do |log_context| - expect(log_context).to match('correlation_id' => an_instance_of(String), - 'meta.caller_id' => 'GET /api/:version/users', - 'meta.remote_ip' => an_instance_of(String), - 'meta.client_id' => an_instance_of(String), - 'meta.feature_category' => 'users') - end - end + context 'when there is an unsupported media type' do + it 'logs the route and context metadata for the client' do + expect(described_class::LOG_FORMATTER).to receive(:call) do |_severity, _datetime, _, data| + expect(data.stringify_keys) + .to include('correlation_id' => an_instance_of(String), + 'meta.remote_ip' => an_instance_of(String), + 'meta.client_id' => a_string_matching(%r{\Aip/.+}), + 'route' => '/api/:version/users/:id') - get(api('/users')) + expect(data.stringify_keys).not_to include('meta.caller_id', 'meta.feature_category', 'meta.user') + end + + put(api("/users/#{user.id}", user), params: { 'name' => 'Test' }, headers: { 'Content-Type' => 'image/png' }) + + expect(response).to have_gitlab_http_status(:unsupported_media_type) + end + end + + context 'when there is an OPTIONS request' do + it 'logs the route and context metadata for the client' do + expect(described_class::LOG_FORMATTER).to receive(:call) do |_severity, _datetime, _, data| + expect(data.stringify_keys) + .to include('correlation_id' => an_instance_of(String), + 'meta.remote_ip' => an_instance_of(String), + 'meta.client_id' => a_string_matching(%r{\Auser/.+}), + 'meta.user' => user.username, + 'meta.feature_category' => 'users', + 'route' => '/api/:version/users') + + expect(data.stringify_keys).not_to include('meta.caller_id') + end + + options(api('/users', user)) + + expect(response).to have_gitlab_http_status(:no_content) + end + end + + context 'when the API version is not matched' do + it 'logs the route and context metadata for the client' do + expect(described_class::LOG_FORMATTER).to receive(:call) do |_severity, _datetime, _, data| + expect(data.stringify_keys) + .to include('correlation_id' => an_instance_of(String), + 'meta.remote_ip' => an_instance_of(String), + 'meta.client_id' => a_string_matching(%r{\Aip/.+}), + 'route' => '/api/:version/*path') + + expect(data.stringify_keys).not_to include('meta.caller_id', 'meta.user') + end + + get('/api/v4_or_is_it') + + expect(response).to have_gitlab_http_status(:not_found) + end end end diff --git a/spec/requests/api/ci/runner/jobs_request_post_spec.rb b/spec/requests/api/ci/runner/jobs_request_post_spec.rb index adac81ff6f4..c3fbef9be48 100644 --- a/spec/requests/api/ci/runner/jobs_request_post_spec.rb +++ b/spec/requests/api/ci/runner/jobs_request_post_spec.rb @@ -816,7 +816,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do subject { request_job(id: job.id) } - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { user: user.username, project: project.full_path, client_id: "user/#{user.id}" } } end @@ -827,7 +827,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do end context 'when the runner is of project type' do - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { project: project.full_path, client_id: "runner/#{runner.id}" } } end @@ -841,7 +841,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do let(:group) { create(:group) } let(:runner) { create(:ci_runner, :group, groups: [group]) } - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { root_namespace: group.full_path_components.first, client_id: "runner/#{runner.id}" } } end diff --git a/spec/requests/api/ci/runner/runners_delete_spec.rb b/spec/requests/api/ci/runner/runners_delete_spec.rb index 6c6c465f161..9d1bae7cce8 100644 --- a/spec/requests/api/ci/runner/runners_delete_spec.rb +++ b/spec/requests/api/ci/runner/runners_delete_spec.rb @@ -51,7 +51,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do let(:params) { { token: runner.token } } end - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { client_id: "runner/#{runner.id}" } } end end diff --git a/spec/requests/api/ci/runner/runners_post_spec.rb b/spec/requests/api/ci/runner/runners_post_spec.rb index 17b988a60c5..b3a7d591c93 100644 --- a/spec/requests/api/ci/runner/runners_post_spec.rb +++ b/spec/requests/api/ci/runner/runners_post_spec.rb @@ -58,7 +58,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do expect(runner).to be_instance_type end - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do subject { request } let(:expected_params) { { client_id: "runner/#{::Ci::Runner.first.id}" } } @@ -84,7 +84,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do expect(runner).to be_project_type end - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do subject { request } let(:expected_params) { { project: project.full_path, client_id: "runner/#{::Ci::Runner.first.id}" } } @@ -190,7 +190,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do expect(runner).to be_group_type end - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do subject { request } let(:expected_params) { { root_namespace: group.full_path_components.first, client_id: "runner/#{::Ci::Runner.first.id}" } } diff --git a/spec/requests/api/ci/runner/runners_verify_post_spec.rb b/spec/requests/api/ci/runner/runners_verify_post_spec.rb index c2e97446738..4680076acae 100644 --- a/spec/requests/api/ci/runner/runners_verify_post_spec.rb +++ b/spec/requests/api/ci/runner/runners_verify_post_spec.rb @@ -45,7 +45,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do expect(response).to have_gitlab_http_status(:ok) end - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { client_id: "runner/#{runner.id}" } } end end diff --git a/spec/requests/api/ci/triggers_spec.rb b/spec/requests/api/ci/triggers_spec.rb index 410e2ae405e..d270a16d28d 100644 --- a/spec/requests/api/ci/triggers_spec.rb +++ b/spec/requests/api/ci/triggers_spec.rb @@ -131,7 +131,7 @@ RSpec.describe API::Ci::Triggers do let(:subject_proc) { proc { post api("/projects/#{project.id}/ref/master/trigger/pipeline?token=#{trigger_token}"), params: { ref: 'refs/heads/other-branch' } } } context 'when triggering a pipeline from a trigger token' do - it_behaves_like 'storing arguments in the application context' + it_behaves_like 'storing arguments in the application context for the API' it_behaves_like 'not executing any extra queries for the application context' end @@ -142,7 +142,7 @@ RSpec.describe API::Ci::Triggers do context 'when other job is triggered by a user' do let(:trigger_token) { create(:ci_build, :running, project: project, user: user).token } - it_behaves_like 'storing arguments in the application context' + it_behaves_like 'storing arguments in the application context for the API' it_behaves_like 'not executing any extra queries for the application context' end @@ -151,7 +151,7 @@ RSpec.describe API::Ci::Triggers do let(:runner) { create(:ci_runner) } let(:expected_params) { { client_id: "runner/#{runner.id}", project: project.full_path } } - it_behaves_like 'storing arguments in the application context' + it_behaves_like 'storing arguments in the application context for the API' it_behaves_like 'not executing any extra queries for the application context', 1 end end diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb index 49756df61c6..aeca4e435f4 100644 --- a/spec/requests/api/internal/base_spec.rb +++ b/spec/requests/api/internal/base_spec.rb @@ -609,7 +609,7 @@ RSpec.describe API::Internal::Base do end context 'with Project' do - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { user: key.user.username, project: project.full_path, caller_id: "POST /api/:version/internal/allowed" } } subject { push(key, project) } @@ -617,7 +617,7 @@ RSpec.describe API::Internal::Base do end context 'with PersonalSnippet' do - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { user: key.user.username, caller_id: "POST /api/:version/internal/allowed" } } subject { push(key, personal_snippet) } @@ -625,7 +625,7 @@ RSpec.describe API::Internal::Base do end context 'with ProjectSnippet' do - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { { user: key.user.username, project: project_snippet.project.full_path, caller_id: "POST /api/:version/internal/allowed" } } subject { push(key, project_snippet) } @@ -1197,7 +1197,7 @@ RSpec.describe API::Internal::Base do subject end - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let(:expected_params) { expected_context } end end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 0febc769729..b5d3dcee804 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -2591,7 +2591,7 @@ RSpec.describe API::Projects do end end - it_behaves_like 'storing arguments in the application context' do + it_behaves_like 'storing arguments in the application context for the API' do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :public) } let(:expected_params) { { user: user.username, project: project.full_path } } diff --git a/spec/support/shared_examples/requests/api/logging_application_context_shared_examples.rb b/spec/support/shared_examples/requests/api/logging_application_context_shared_examples.rb index cb06c9fa596..3e9c4a5eb68 100644 --- a/spec/support/shared_examples/requests/api/logging_application_context_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/logging_application_context_shared_examples.rb @@ -15,6 +15,22 @@ RSpec.shared_examples 'storing arguments in the application context' do end end +# For the API we need a slightly different approach as `client_id` is +# calculated in API logging code. +RSpec.shared_examples 'storing arguments in the application context for the API' do + it 'places the expected params in the application context' do + expect(::API::API::LOG_FORMATTER).to receive(:call) do + expect(Gitlab::ApplicationContext.current).to include(log_hash(expected_params)) + end + + subject + end + + def log_hash(hash) + hash.transform_keys! { |key| "meta.#{key}" } + end +end + RSpec.shared_examples 'not executing any extra queries for the application context' do |expected_extra_queries = 0| it 'does not execute more queries than without adding anything to the application context' do # Call the subject once to memoize all factories being used for the spec, so they won't