Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
85770eb3a2
commit
25618c1e28
|
@ -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'
|
||||
|
|
|
@ -1 +1 @@
|
|||
2.15.0
|
||||
2.16.0
|
||||
|
|
|
@ -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?
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -15,41 +15,41 @@ 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 |
|
||||
| :----------------------------------------------------: | :------------: | :--------------: | :---------: | :------------------------------------: |
|
||||
| <a name="gitlab-rails"></a> GitLab Rails | Yes | Port | X | 80 or 443 |
|
||||
| <a name="gitlab-shell"></a> GitLab Shell | Yes | Port | X | 22 |
|
||||
| <a name="postgresql"></a> PostgreSQL | Yes | Socket | Port (5432) | X |
|
||||
| <a name="redis"></a> Redis | Yes | Socket | Port (6379) | X |
|
||||
| <a name="puma"></a> Puma | Yes | Socket | Port (8080) | X |
|
||||
| <a name="gitlab-workhorse"></a> GitLab Workhorse | Yes | Socket | Port (8181) | X |
|
||||
| <a name="nginx-status"></a> NGINX status | Yes | Port | X | 8060 |
|
||||
| <a name="prometheus"></a> Prometheus | Yes | Port | X | 9090 |
|
||||
| <a name="node-exporter"></a> Node exporter | Yes | Port | X | 9100 |
|
||||
| <a name="redis-exporter"></a> Redis exporter | Yes | Port | X | 9121 |
|
||||
| <a name="postgres-exporter"></a> PostgreSQL exporter | Yes | Port | X | 9187 |
|
||||
| <a name="pgbouncer-exporter"></a> PgBouncer exporter | No | Port | X | 9188 |
|
||||
| <a name="gitlab-exporter"></a> GitLab Exporter | Yes | Port | X | 9168 |
|
||||
| <a name="sidekiq-exporter"></a> Sidekiq exporter | Yes | Port | X | 8082 |
|
||||
| <a name="puma-exporter"></a> Puma exporter | No | Port | X | 8083 |
|
||||
| <a name="geo-postgresql"></a> Geo PostgreSQL | No | Socket | Port (5431) | X |
|
||||
| <a name="redis-sentinel"></a> Redis Sentinel | No | Port | X | 26379 |
|
||||
| <a name="incoming-email"></a> Incoming email | No | Port | X | 143 |
|
||||
| <a name="elasticsearch"></a> Elastic search | No | Port | X | 9200 |
|
||||
| <a name="gitlab-pages"></a> GitLab Pages | No | Port | X | 80 or 443 |
|
||||
| <a name="gitlab-registry-web"></a> GitLab Registry | No* | Port | X | 80, 443 or 5050 |
|
||||
| <a name="gitlab-registry"></a> GitLab Registry | No | Port | X | 5000 |
|
||||
| <a name="ldap"></a> LDAP | No | Port | X | Depends on the component configuration |
|
||||
| <a name="kerberos"></a> Kerberos | No | Port | X | 8443 or 8088 |
|
||||
| <a name="omniauth"></a> OmniAuth | Yes | Port | X | Depends on the component configuration |
|
||||
| <a name="smtp"></a> SMTP | No | Port | X | 465 |
|
||||
| <a name="remote-syslog"></a> Remote syslog | No | Port | X | 514 |
|
||||
| <a name="mattermost"></a> Mattermost | No | Port | X | 8065 |
|
||||
| <a name="mattermost-web"></a> Mattermost | No | Port | X | 80 or 443 |
|
||||
| <a name="pgbouncer"></a> PgBouncer | No | Port | X | 6432 |
|
||||
| <a name="consul"></a> Consul | No | Port | X | 8300, 8301(UDP), 8500, 8600[^Consul-notes] |
|
||||
| <a name="patroni"></a> Patroni | No | Port | X | 8008 |
|
||||
| <a name="gitlab-kas"></a> GitLab KAS | No | Port | X | 8150 |
|
||||
| <a name="gitaly"></a> Gitaly | No | Port | X | 8075 |
|
||||
|:-------------------:|:-------------:|:----------------:|:-----------:|:------------------------------------------:|
|
||||
| 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:
|
||||
|
||||
|
|
|
@ -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**
|
||||
|
||||
1. Edit `/etc/gitlab/gitlab.rb` and add the following line:
|
||||
|
||||
```ruby
|
||||
gitlab_rails['gitlab_default_can_create_group'] = false
|
||||
```
|
||||
|
||||
For source installations, uncomment the following line in `config/gitlab.yml`:
|
||||
1. [Reconfigure and restart GitLab](restart_gitlab.md#omnibus-installations).
|
||||
|
||||
**Source installations**
|
||||
|
||||
1. Edit `config/gitlab.yml` and uncomment the following line:
|
||||
|
||||
```yaml
|
||||
# default_can_create_group: false # default: true
|
||||
```
|
||||
|
||||
## Disallow users changing usernames
|
||||
1. [Restart GitLab](restart_gitlab.md#installations-from-source).
|
||||
|
||||
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).
|
||||
## Prevent users from changing their usernames
|
||||
|
||||
For Omnibus installations, add the following to `/etc/gitlab/gitlab.rb`:
|
||||
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
|
||||
```
|
||||
|
||||
For source installations, uncomment the following line in `config/gitlab.yml`:
|
||||
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).
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -363,6 +363,13 @@ the user gets the highest access level from the groups. For example, if one grou
|
|||
is linked as `Guest` and another `Maintainer`, a user in both groups gets `Maintainer`
|
||||
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
|
||||
|
||||
After a group sync, users who are not members of a mapped SAML group are removed from
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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).
|
||||
|
||||
|
|
|
@ -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 <kbd>g</kbd> + <kbd>m</kbd> [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 <kbd>Shift</kbd> + <kbd>m</kbd>
|
||||
[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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <kbd>g</kbd> + <kbd>w</kbd>
|
||||
[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 <kbd>e</kbd> 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)
|
||||
|
|
|
@ -39,7 +39,7 @@ These shortcuts are available in most areas of GitLab:
|
|||
| <kbd>Shift</kbd> + <kbd>s</kbd> | Go to your Snippets page. |
|
||||
| <kbd>s</kbd> / <kbd>/</kbd> | Put cursor in the search bar. |
|
||||
| <kbd>Shift</kbd> + <kbd>i</kbd> | Go to your Issues page. |
|
||||
| <kbd>Shift</kbd> + <kbd>m</kbd> | Go to your Merge requests page.|
|
||||
| <kbd>Shift</kbd> + <kbd>m</kbd> | Go to your [Merge requests](project/merge_requests/index.md) page. |
|
||||
| <kbd>Shift</kbd> + <kbd>t</kbd> | Go to your To-Do List page. |
|
||||
| <kbd>p</kbd> + <kbd>b</kbd> | Show or hide the Performance Bar. |
|
||||
| <kbd>g</kbd> + <kbd>x</kbd> | 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.
|
|||
| <kbd>g</kbd> + <kbd>i</kbd> | Go to the project issues list (**Issues > List**). |
|
||||
| <kbd>i</kbd> | Go to the New Issue page (**Issues**, select **New Issue** ). |
|
||||
| <kbd>g</kbd> + <kbd>b</kbd> | Go to the project issue boards list (**Issues > Boards**). |
|
||||
| <kbd>g</kbd> + <kbd>m</kbd> | Go to the project merge requests list (**Merge Requests**). |
|
||||
| <kbd>g</kbd> + <kbd>m</kbd> | Go to the project [merge requests](project/merge_requests/index.md) list (**Merge Requests**). |
|
||||
| <kbd>g</kbd> + <kbd>j</kbd> | Go to the CI/CD jobs list (**CI/CD > Jobs**). |
|
||||
| <kbd>g</kbd> + <kbd>l</kbd> | Go to the project metrics (**Monitor > Metrics**). |
|
||||
| <kbd>g</kbd> + <kbd>e</kbd> | Go to the project environments (**Deployments > Environments**). |
|
||||
| <kbd>g</kbd> + <kbd>k</kbd> | 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. |
|
||||
| <kbd>g</kbd> + <kbd>s</kbd> | Go to the project snippets list (**Snippets**). |
|
||||
| <kbd>g</kbd> + <kbd>w</kbd> | Go to the project wiki (**Wiki**), if enabled. |
|
||||
| <kbd>g</kbd> + <kbd>w</kbd> | 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 |
|
||||
|------------------------------|-------------|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
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' => an_instance_of(String),
|
||||
'meta.feature_category' => 'issue_tracking')
|
||||
end
|
||||
'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
|
||||
|
||||
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',
|
||||
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' => an_instance_of(String),
|
||||
'meta.feature_category' => 'users')
|
||||
'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
|
||||
|
||||
get(api('/users'))
|
||||
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')
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}" } }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 } }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue