diff options
20 files changed, 226 insertions, 140 deletions
diff --git a/app/assets/javascripts/emoji/components/picker.vue b/app/assets/javascripts/emoji/components/picker.vue index 462420ba4e5..710cfad0f1c 100644 --- a/app/assets/javascripts/emoji/components/picker.vue +++ b/app/assets/javascripts/emoji/components/picker.vue @@ -94,6 +94,11 @@ export default { this.currentCategory = findLastIndex(Object.values(categories), ({ top }) => offset >= top); }, + onHide() { + this.currentCategory = 0; + this.searchValue = ''; + this.$emit('hidden'); + }, }, }; </script> @@ -111,7 +116,7 @@ export default { :right="right" lazy @shown="$emit('shown')" - @hidden="$emit('hidden')" + @hidden="onHide" > <template #button-content> <slot name="button-content"> diff --git a/app/services/personal_access_tokens/create_service.rb b/app/services/personal_access_tokens/create_service.rb index 31ba88af46c..095cfadf02c 100644 --- a/app/services/personal_access_tokens/create_service.rb +++ b/app/services/personal_access_tokens/create_service.rb @@ -41,7 +41,11 @@ module PersonalAccessTokens end def pat_expiration - params[:expires_at].presence || PersonalAccessToken::MAX_PERSONAL_ACCESS_TOKEN_LIFETIME_IN_DAYS.days.from_now + params[:expires_at].presence || max_expiry_date + end + + def max_expiry_date + PersonalAccessToken::MAX_PERSONAL_ACCESS_TOKEN_LIFETIME_IN_DAYS.days.from_now end def creation_permitted? diff --git a/db/post_migrate/20231122114135_add_index_on_sbom_occurrences_highest_severity.rb b/db/post_migrate/20231122114135_add_index_on_sbom_occurrences_highest_severity.rb new file mode 100644 index 00000000000..c7c5aef7160 --- /dev/null +++ b/db/post_migrate/20231122114135_add_index_on_sbom_occurrences_highest_severity.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddIndexOnSbomOccurrencesHighestSeverity < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.7' + + INDEX_NAME = 'index_sbom_occurrences_on_highest_severity' + INDEX_TO_BE_REMOVED = 'index_sbom_occurrences_on_project_id' + + def up + add_concurrent_index :sbom_occurrences, + [:project_id, :highest_severity], + order: { highest_severity: 'DESC NULLS LAST' }, + name: INDEX_NAME + + remove_concurrent_index_by_name :sbom_occurrences, INDEX_TO_BE_REMOVED + end + + def down + add_concurrent_index :sbom_occurrences, :project_id, name: INDEX_TO_BE_REMOVED + remove_concurrent_index_by_name :sbom_occurrences, INDEX_NAME + end +end diff --git a/db/schema_migrations/20231122114135 b/db/schema_migrations/20231122114135 new file mode 100644 index 00000000000..d2acff5726e --- /dev/null +++ b/db/schema_migrations/20231122114135 @@ -0,0 +1 @@ +ba955cf574974a0f1a5824159e8f00e7a8e85ed89f814fbc8c6e84009204d632
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 32b212e9d73..9fb23cc0cc4 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -34502,12 +34502,12 @@ CREATE INDEX index_sbom_occurrences_on_component_id_and_id ON sbom_occurrences U CREATE INDEX index_sbom_occurrences_on_component_version_id ON sbom_occurrences USING btree (component_version_id); +CREATE INDEX index_sbom_occurrences_on_highest_severity ON sbom_occurrences USING btree (project_id, highest_severity DESC NULLS LAST); + CREATE INDEX index_sbom_occurrences_on_licenses_spdx_identifier ON sbom_occurrences USING btree (project_id, ((licenses #> '{0,spdx_identifier}'::text[])), ((licenses #> '{1,spdx_identifier}'::text[]))); CREATE INDEX index_sbom_occurrences_on_pipeline_id ON sbom_occurrences USING btree (pipeline_id); -CREATE INDEX index_sbom_occurrences_on_project_id ON sbom_occurrences USING btree (project_id); - CREATE INDEX index_sbom_occurrences_on_project_id_and_component_id_and_id ON sbom_occurrences USING btree (project_id, component_id, id); CREATE INDEX index_sbom_occurrences_on_project_id_and_id ON sbom_occurrences USING btree (project_id, id); diff --git a/doc/administration/gitaly/index.md b/doc/administration/gitaly/index.md index 959b00d6dad..4744959ce13 100644 --- a/doc/administration/gitaly/index.md +++ b/doc/administration/gitaly/index.md @@ -171,6 +171,17 @@ Gitaly comes pre-configured with a Linux package installation, which is a config GitLab installations for more than 2000 active users performing daily Git write operation may be best suited by using Gitaly Cluster. +### Gitaly CLI + +The `gitaly` command is a command-line interface that provides additional subcommands for Gitaly administrators. For example, +the Gitaly CLI is used to: + +- [Configure custom Git hooks](../server_hooks.md) for a repository. +- Validate Gitaly configuration files. +- Verify the internal Gitaly API is accessible. + +For more information on the other subcommands, run `gitaly --help`. + ### Backing up repositories When backing up or syncing repositories using tools other than GitLab, you must [prevent writes](../../administration/backup_restore/backup_gitlab.md#prevent-writes-and-copy-the-git-repository-data) diff --git a/doc/administration/gitaly/troubleshooting.md b/doc/administration/gitaly/troubleshooting.md index cccec2b9310..7d0255a3efb 100644 --- a/doc/administration/gitaly/troubleshooting.md +++ b/doc/administration/gitaly/troubleshooting.md @@ -423,7 +423,7 @@ and: 1. [Reconfigure GitLab](../restart_gitlab.md#reconfigure-a-linux-package-installation) so the certificates are symlinked 1. Restart Gitaly manually `sudo gitlab-ctl restart gitaly` for the certificates to be loaded by the Gitaly process. -## Gitaly fails to fork processes stored on `noexec` file systems +### Gitaly fails to fork processes stored on `noexec` file systems Because of changes [introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/5999) in GitLab 14.10, applying the `noexec` option to a mount point (for example, `/var`) causes Gitaly to throw `permission denied` errors related to forking processes. For example: diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index b65b50dd66c..a30e6252f55 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -29942,6 +29942,8 @@ Values for sorting dependencies. | <a id="dependencysortname_desc"></a>`NAME_DESC` | Name by descending order. | | <a id="dependencysortpackager_asc"></a>`PACKAGER_ASC` | Packager by ascending order. | | <a id="dependencysortpackager_desc"></a>`PACKAGER_DESC` | Packager by descending order. | +| <a id="dependencysortseverity_asc"></a>`SEVERITY_ASC` | Severity by ascending order. | +| <a id="dependencysortseverity_desc"></a>`SEVERITY_DESC` | Severity by descending order. | ### `DeploymentApprovalSummaryStatus` diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 8e8ee1a8477..a852c7c0b96 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -83,6 +83,8 @@ Supported attributes: | `with_merge_status_recheck` | boolean | No | If `true`, this projection requests (but does not guarantee) that the `merge_status` field be recalculated asynchronously. Default is `false`.In GitLab 15.11 and later, enable the `restrict_merge_status_recheck` feature [flag](../administration/feature_flags.md) for this attribute to be ignored when requested by users without at least the Developer role. | | `wip` | string | No | Filter merge requests against their `wip` status. `yes` to return *only* draft merge requests, `no` to return *non-draft* merge requests. | +Example response: + ```json [ { @@ -210,13 +212,11 @@ Supported attributes: not proactively update `merge_status` (which also affects the `has_conflicts`), as this can be an expensive operation. If you need the value of these fields from this endpoint, set the `with_merge_status_recheck` parameter to `true` in the query. -- For notes on merge request object fields, read [Single merge request response notes](#single-merge-request-response-notes). +- For notes on merge request object fields, see [Single merge request response notes](#single-merge-request-response-notes). ## List project merge requests Get all merge requests for this project. -The `state` parameter can be used to get only merge requests with a given state (`opened`, `closed`, `locked`, or `merged`) or all of them (`all`). -The pagination parameters `page` and `per_page` can be used to restrict the list of merge requests. ```plaintext GET /projects/:id/merge_requests @@ -228,15 +228,6 @@ GET /projects/:id/merge_requests?labels=bug,reproduced GET /projects/:id/merge_requests?my_reaction_emoji=star ``` -`project_id` represents the ID of the project where the merge request resides. -`project_id` always equals `target_project_id`. - -In the case of a merge request from the same project, -`source_project_id`, `target_project_id` and `project_id` -are the same. In the case of a merge request from a fork, -`target_project_id` and `project_id` are the same and -`source_project_id` is the fork project's ID. - Supported attributes: | Attribute | Type | Required | Description | @@ -263,7 +254,7 @@ Supported attributes: | `search` | string | No | Search merge requests against their `title` and `description`. | | `sort` | string | No | Returns requests sorted in `asc` or `desc` order. Default is `desc`. | | `source_branch` | string | No | Returns merge requests with the given source branch. | -| `state` | string | No | Returns all merge requests or just those that are `opened`, `closed`, `locked`, or `merged`. | +| `state` | string | No | Returns all merge requests (`all`) or just those that are `opened`, `closed`, `locked`, or `merged`. | | `target_branch` | string | No | Returns merge requests with the given target branch. | | `updated_after` | datetime | No | Returns merge requests updated on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | | `updated_before` | datetime | No | Returns merge requests updated on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | @@ -272,6 +263,18 @@ Supported attributes: | `with_labels_details` | boolean | No | If `true`, response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. | | `with_merge_status_recheck` | boolean | No | If `true`, this projection requests (but does not guarantee) that the `merge_status` field be recalculated asynchronously. Default is `false`. In GitLab 15.11 and later, enable the `restrict_merge_status_recheck` feature [flag](../administration/feature_flags.md) for this attribute to be ignored when requested by users without at least the Developer role. | +In the response: + +- `project_id` represents the ID of the project where the merge request resides. + `project_id` always equals `target_project_id`. +- Use the pagination parameters `page` and `per_page` to restrict the list of merge requests. +- Project IDs vary depending on whether the merge request originates from the project, or a fork. + In merge requests originating from + - The same project: `target_project_id`, `project_id`, and `source_project_id` are the same. + - A fork: `target_project_id` and `project_id` are the same, but `source_project_id` is the fork project's ID. + +Example response: + ```json [ { @@ -395,13 +398,11 @@ Supported attributes: ] ``` -For important notes on response data, read [Merge requests list response notes](#merge-requests-list-response-notes). +For important notes on response data, see [Merge requests list response notes](#merge-requests-list-response-notes). ## List group merge requests Get all merge requests for this group and its subgroups. -The `state` parameter can be used to get only merge requests with a given state (`opened`, `closed`, `locked`, or `merged`) or all of them (`all`). -The pagination parameters `page` and `per_page` can be used to restrict the list of merge requests. ```plaintext GET /groups/:id/merge_requests @@ -412,8 +413,6 @@ GET /groups/:id/merge_requests?labels=bug,reproduced GET /groups/:id/merge_requests?my_reaction_emoji=star ``` -`group_id` represents the ID of the group which contains the project where the merge request resides. - Supported attributes: | Attribute | Type | Required | Description | @@ -440,7 +439,7 @@ Supported attributes: | `search` | string | No | Search merge requests against their `title` and `description`. | | `source_branch` | string | No | Returns merge requests with the given source branch. | | `sort` | string | No | Returns merge requests sorted in `asc` or `desc` order. Default is `desc`. | -| `state` | string | No | Returns all merge requests or just those that are `opened`, `closed`, `locked`, or `merged`. | +| `state` | string | No | Returns all merge requests (`all`) or just those that are `opened`, `closed`, `locked`, or `merged`. | | `target_branch` | string | No | Returns merge requests with the given target branch. | | `updated_after` | datetime | No | Returns merge requests updated on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | | `updated_before` | datetime | No | Returns merge requests updated on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | @@ -448,6 +447,12 @@ Supported attributes: | `with_labels_details` | boolean | No | If `true`, response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. | | `with_merge_status_recheck` | boolean | No | If `true`, this projection requests (but does not guarantee) that the `merge_status` field be recalculated asynchronously. Default is `false`. In GitLab 15.11 and later, enable the `restrict_merge_status_recheck` feature [flag](../administration/feature_flags.md) for this attribute to be ignored when requested by users without at least the Developer role. | +The pagination parameters `page` and `per_page` can be used to restrict the list of merge requests. + +In the response, `group_id` represents the ID of the group containing the project where the merge request resides. + +Example response: + ```json [ { @@ -569,17 +574,12 @@ Supported attributes: ] ``` -For important notes on response data, read [Merge requests list response notes](#merge-requests-list-response-notes). +For important notes on response data, see [Merge requests list response notes](#merge-requests-list-response-notes). ## Get single MR Shows information about a single merge request. -**Note**: the `changes_count` value in the response is a string, not an -integer. When an merge request has too many changes to display and store, -it is capped at 1,000. In that case, the API returns the string -`"1000+"` for the changes count. - ```plaintext GET /projects/:id/merge_requests/:merge_request_iid ``` @@ -598,24 +598,24 @@ Supported attributes: | Attribute | Type | Description | |----------------------------------|------|-------------| -| `approvals_before_merge`| integer | **(PREMIUM ALL)** Number of approvals required before this merge request can merge. To configure approval rules, see [Merge request approvals API](merge_request_approvals.md). [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/353097) in GitLab 16.0. | +| `approvals_before_merge`| integer | **(PREMIUM ALL)** Number of approvals required before this merge request can merge. To configure approval rules, see [Merge request approvals API](merge_request_approvals.md). [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/353097) in GitLab 16.0. | | `assignee` | object | First assignee of the merge request. | | `assignees` | array | Assignees of the merge request. | | `author` | object | User who created this merge request. | | `blocking_discussions_resolved` | boolean | Indicates if all discussions are resolved only if all are required before merge request can be merged. | -| `changes_count` | string | Number of changes made on the merge request. Empty when the merge request is created, and populates asynchronously. See [Empty API Fields for new merge requests](#empty-api-fields-for-new-merge-requests).| +| `changes_count` | string | Number of changes made on the merge request. Empty when the merge request is created, and populates asynchronously. A string, not an integer. When a merge request has too many changes to display and store, the value is capped at 1000 and returns the string `"1000+"`. See [Empty API Fields for new merge requests](#empty-api-fields-for-new-merge-requests).| | `closed_at` | datetime | Timestamp of when the merge request was closed. | | `closed_by` | object | User who closed this merge request. | | `created_at` | datetime | Timestamp of when the merge request was created. | | `description` | string | Description of the merge request. Contains Markdown rendered as HTML for caching. | -| `detailed_merge_status` | string | Detailed merge status of the merge request. Read [merge status](#merge-status) for a list of potential values. | +| `detailed_merge_status` | string | Detailed merge status of the merge request. See [merge status](#merge-status) for a list of potential values. | | `diff_refs` | object | References of the base SHA, the head SHA, and the start SHA for this merge request. Corresponds to the latest diff version of the merge request. Empty when the merge request is created, and populates asynchronously. See [Empty API fields for new merge requests](#empty-api-fields-for-new-merge-requests). | | `discussion_locked` | boolean | Indicates if comments on the merge request are locked to members only. | | `downvotes` | integer | Number of downvotes for the merge request. | | `draft` | boolean | Indicates if the merge request is a draft. | | `first_contribution` | boolean | Indicates if the merge request is the first contribution of the author. | | `first_deployed_to_production_at` | datetime | Timestamp of when the first deployment finished. | -| `force_remove_source_branch` | boolean | Indicates if the project settings will lead to source branch deletion after merge. | +| `force_remove_source_branch` | boolean | Indicates if the project settings lead to source branch deletion after merge. | | `has_conflicts` | boolean | Indicates if merge request has conflicts and cannot be merged. Dependent on the `merge_status` property. Returns `false` unless `merge_status` is `cannot_be_merged`. | | `head_pipeline` | object | Pipeline running on the branch HEAD of the merge request. Contains more complete information than `pipeline` and should be used instead of it. | | `id` | integer | ID of the merge request. | @@ -626,7 +626,7 @@ Supported attributes: | `merge_commit_sha` | string | SHA of the merge request commit. Returns `null` until merged. | | `merge_error` | string | Error message shown when a merge has failed. To check mergeability, use `detailed_merge_status` instead | | `merge_user` | object | The user who merged this merge request, the user who set it to auto-merge, or `null`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/349031) in GitLab 14.7. | -| `merge_status` | string | Status of the merge request. Can be `unchecked`, `checking`, `can_be_merged`, `cannot_be_merged`, or `cannot_be_merged_recheck`. Affects the `has_conflicts` property. For important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/3169#note_1162532204) in GitLab 15.6. Use `detailed_merge_status` instead. | +| `merge_status` | string | Status of the merge request. Can be `unchecked`, `checking`, `can_be_merged`, `cannot_be_merged`, or `cannot_be_merged_recheck`. Affects the `has_conflicts` property. For important notes on response data, see [Single merge request response notes](#single-merge-request-response-notes). [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/3169#note_1162532204) in GitLab 15.6. Use `detailed_merge_status` instead. | | `merge_when_pipeline_succeeds` | boolean | Indicates if the merge has been set to be merged when its pipeline succeeds. | | `merged_at` | datetime | Timestamp of when the merge request was merged. | | `merged_by` | object | User who merged this merge request or set it to auto-merge. [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/350534) in GitLab 14.7, and scheduled for removal in [API version 5](https://gitlab.com/groups/gitlab-org/-/epics/8115). Use `merge_user` instead. | @@ -638,13 +638,13 @@ Supported attributes: | `references` | object | Internal references of the merge request. Includes `short`, `relative`, and `full` references. `references.relative` is relative to the merge request's group or project. When fetched from the merge request's project, `relative` and `short` formats are identical. When requested across groups or projects, `relative` and `full` formats are identical.| | `reviewers` | array | Reviewers of the merge request. | | `sha` | string | Diff head SHA of the merge request. | -| `should_remove_source_branch` | boolean | Indicates if the source branch of the merge request will be deleted after merge. | +| `should_remove_source_branch` | boolean | Indicates if the source branch of the merge request should be deleted after merge. | | `source_branch` | string | Source branch of the merge request. | | `source_project_id` | integer | ID of the merge request source project. | | `squash` | boolean | Indicates if squash on merge is enabled. | | `squash_commit_sha` | string | SHA of the squash commit. Empty until merged. | | `state` | string | State of the merge request. Can be `opened`, `closed`, `merged` or `locked`. | -| `subscribed` | boolean | Indicates if the currently authenticated user is subscribed to this merge request. | +| `subscribed` | boolean | Indicates if the current authenticated user is subscribed to this merge request. | | `target_branch` | string | Target branch of the merge request. | | `target_project_id` | integer | ID of the merge request target project. | | `task_completion_status` | object | Completion status of tasks. | @@ -656,6 +656,8 @@ Supported attributes: | `web_url` | string | Web URL of the merge request. | | `work_in_progress` | boolean | Deprecated: Use `draft` instead. Indicates if the merge request is a draft. | +Example response: + ```json { "id": 155016530, @@ -801,10 +803,10 @@ Supported attributes: ### Single merge request response notes -- [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/29984) in GitLab 12.8, the mergeability (`merge_status`) - of each merge request is checked asynchronously when a request is made to this endpoint. Poll this API endpoint - to get updated status. This affects the `has_conflicts` property as it is dependent on the `merge_status`. It returns - `false` unless `merge_status` is `cannot_be_merged`. +The mergeability (`merge_status`) +of each merge request is checked asynchronously when a request is made to this endpoint. Poll this API endpoint +to get updated status. This affects the `has_conflicts` property as it is dependent on the `merge_status`. It returns +`false` unless `merge_status` is `cannot_be_merged`. ### Merge status @@ -856,6 +858,8 @@ Supported attributes: | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +Example response: + ```json [ { @@ -892,6 +896,8 @@ Supported attributes: | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +Example response: + ```json [ { @@ -936,6 +942,8 @@ Supported attributes: | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +Example response: + ```json [ { @@ -963,19 +971,10 @@ Supported attributes: WARNING: This endpoint was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/322117) in GitLab 15.7 -and will be removed in API v5. Use the [List merge request diffs](#list-merge-request-diffs) endpoint instead. +and is scheduled for removal in API v5. Use the [List merge request diffs](#list-merge-request-diffs) endpoint instead. Shows information about the merge request including its files and changes. -[Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46190) in GitLab 13.6, -diffs associated with the set of changes have the same size limitations applied as other diffs -returned by the API or viewed via the UI. When these limits impact the results, the `overflow` -field contains a value of `true`. Diff data without these limits applied can be retrieved by -adding the `access_raw_diffs` parameter, accessing diffs not from the database but from Gitaly directly. -This approach is generally slower and more resource-intensive, but isn't subject to size limits -placed on database-backed diffs. [Limits inherent to Gitaly](../development/merge_request_concepts/diffs/index.md#diff-limits) -still apply. - ```plaintext GET /projects/:id/merge_requests/:merge_request_iid/changes ``` @@ -986,9 +985,19 @@ Supported attributes: |---------------------|----------------|----------|-------------| | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | -| `access_raw_diffs` | boolean | No | Retrieve change diffs via Gitaly. | +| `access_raw_diffs` | boolean | No | Retrieve change diffs through Gitaly. | | `unidiff` | boolean | No | Present change diffs in the [unified diff](https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html) format. Default is false. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/130610) in GitLab 16.5. | +Diffs associated with the set of changes have the same size limitations applied as other diffs +returned by the API or viewed through the UI. When these limits impact the results, the `overflow` +field contains a value of `true`. Diff data without these limits applied can be retrieved by +adding the `access_raw_diffs` parameter, accessing diffs not from the database but from Gitaly directly. +This approach is generally slower and more resource-intensive, but isn't subject to size limits +placed on database-backed diffs. [Limits inherent to Gitaly](../development/merge_request_concepts/diffs/index.md#diff-limits) +still apply. + +Example response: + ```json { "id": 21, @@ -1168,8 +1177,7 @@ Merge requests that exceed the diff limits return limited results. ## List merge request pipelines -Get a list of merge request pipelines. The pagination parameters `page` and -`per_page` can be used to restrict the list of merge request pipelines. +Get a list of merge request pipelines. ```plaintext GET /projects/:id/merge_requests/:merge_request_iid/pipelines @@ -1182,6 +1190,11 @@ Supported attributes: | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +The pagination parameters `page` and +`per_page` can be used to restrict the list of merge request pipelines. + +Example response: + ```json [ { @@ -1196,7 +1209,7 @@ Supported attributes: ## Create merge request pipeline Create a new [pipeline for a merge request](../ci/pipelines/merge_request_pipelines.md). -A pipeline created via this endpoint doesn't run a regular branch/tag pipeline. +A pipeline created from this endpoint doesn't run a regular branch/tag pipeline. It requires `.gitlab-ci.yml` to be configured with `only: [merge_requests]` to create jobs. The new pipeline can be: @@ -1216,6 +1229,8 @@ Supported attributes: | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +Example response: + ```json { "id": 2, @@ -1278,10 +1293,12 @@ POST /projects/:id/merge_requests | `labels` | string | No | Labels for the merge request, as a comma-separated list. | | `milestone_id` | integer | No | The global ID of a milestone. | | `remove_source_branch` | boolean | No | Flag indicating if a merge request should remove the source branch when merging. | -| `reviewer_ids` | integer array | No | The ID of the users added as a reviewer to the merge request. If set to `0` or left empty, no reviewers are added. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49341) in GitLab 13.8. | +| `reviewer_ids` | integer array | No | The ID of the users added as a reviewer to the merge request. If set to `0` or left empty, no reviewers are added. | | `squash` | boolean | No | Indicates if the merge request is set to be squashed when merged. [Project settings](../user/project/merge_requests/squash_and_merge.md#configure-squash-options-for-a-project) might override this value. | | `target_project_id` | integer | No | Numeric ID of the target project. | +Example response: + ```json { "id": 1, @@ -1404,7 +1421,7 @@ POST /projects/:id/merge_requests } ``` -For important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). +For important notes on response data, see [Single merge request response notes](#single-merge-request-response-notes). ## Update MR @@ -1429,7 +1446,7 @@ PUT /projects/:id/merge_requests/:merge_request_iid | `milestone_id` | integer | No | The global ID of a milestone to assign the merge request to. Set to `0` or provide an empty value to unassign a milestone.| | `remove_labels` | string | No | Comma-separated label names to remove from a merge request. | | `remove_source_branch` | boolean | No | Flag indicating if a merge request should remove the source branch when merging. | -| `reviewer_ids` | integer array | No | The ID of the users set as a reviewer to the merge request. Set the value to `0` or provide an empty value to unset all reviewers. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49341) in GitLab 13.8. | +| `reviewer_ids` | integer array | No | The ID of the users set as a reviewer to the merge request. Set the value to `0` or provide an empty value to unset all reviewers. | | `squash` | boolean | No | Indicates if the merge request is set to be squashed when merged. [Project settings](../user/project/merge_requests/squash_and_merge.md#configure-squash-options-for-a-project) may override this value. | | `state_event` | string | No | New state (close/reopen). | | `target_branch` | string | No | The target branch. | @@ -1437,6 +1454,8 @@ PUT /projects/:id/merge_requests/:merge_request_iid Must include at least one non-required attribute from above. +Example response: + ```json { "id": 1, @@ -1575,7 +1594,7 @@ Must include at least one non-required attribute from above. } ``` -For important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). +For important notes on response data, see [Single merge request response notes](#single-merge-request-response-notes). ## Delete a merge request @@ -1591,7 +1610,8 @@ DELETE /projects/:id/merge_requests/:merge_request_iid | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | ```shell -curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request DELETE \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/4/merge_requests/85" ``` @@ -1616,6 +1636,19 @@ Supported attributes: | `squash_commit_message` | string | No | Custom squash commit message. | | `squash` | boolean | No | If `true`, the commits are squashed into a single commit on merge. | +This API returns specific HTTP status codes on failure: + +| HTTP Status | Message | Reason | +|-------------|--------------------------------------------|--------| +| `401` | `401 Unauthorized` | This user does not have permission to accept this merge request. | +| `405` | `405 Method Not Allowed` | The merge request is not able to be merged. | +| `409` | `SHA does not match HEAD of source branch` | The provided `sha` parameter does not match the HEAD of the source. | +| `422` | `Branch cannot be merged` | The merge request failed to merge. | + +For additional important notes on response data, see [Single merge request response notes](#single-merge-request-response-notes). + +Example response: + ```json { "id": 1, @@ -1754,17 +1787,6 @@ Supported attributes: } ``` -This API returns specific HTTP status codes on failure: - -| HTTP Status | Message | Reason | -|-------------|--------------------------------------------|--------| -| `401` | `Unauthorized` | This user does not have permission to accept this merge request. | -| `405` | `Method Not Allowed` | The merge request is not able to be merged. | -| `409` | `SHA does not match HEAD of source branch` | The provided `sha` parameter does not match the HEAD of the source. | -| `422` | `Branch cannot be merged` | The merge request failed to merge. | - -For additional important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). - ## Merge to default merge ref path Merge the changes between the merge request source and target branches into `refs/merge-requests/:iid/merge` @@ -1776,10 +1798,6 @@ This action isn't a regular merge action, because it doesn't change the merge re This ref (`refs/merge-requests/:iid/merge`) isn't necessarily overwritten when submitting requests to this API, though it makes sure the ref has the latest possible state. -If the merge request has conflicts, is empty or already merged, you receive a `400` and a descriptive error message. - -It returns the HEAD commit of `refs/merge-requests/:iid/merge` in the response body in case of `200`. - ```plaintext GET /projects/:id/merge_requests/:merge_request_iid/merge_ref ``` @@ -1791,21 +1809,24 @@ Supported attributes: | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +This API returns specific HTTP status codes: + +| HTTP Status | Message | Reason | +|-------------|----------------------------------|--------| +| `200` | _(none)_ | Success. Returns the HEAD commit of `refs/merge-requests/:iid/merge`. | +| `400` | `Merge request is not mergeable` | The merge request has conflicts. | +| `400` | `Merge ref cannot be updated` | | +| `400` | `Unsupported operation` | The GitLab database is in read-only mode. | + +Example response: + ```json { "commit_id": "854a3a7a17acbcc0bbbea170986df1eb60435f34" } ``` -## Cancel Merge When Pipeline Succeeds - -This API returns specific HTTP status codes on failure: - -| HTTP Status | Message | Reason | -|-------------|----------------------|-----------------------------------------------------------------------| -| `401` | `Unauthorized` | This user does not have permission to cancel this merge request. | -| `405` | `Method Not Allowed` | The merge request is already merged or closed. | -| `406` | `Not Acceptable` | The merge request is not set to be merged when the pipeline succeeds. | +## Cancel merge when pipeline succeeds ```plaintext POST /projects/:id/merge_requests/:merge_request_iid/cancel_merge_when_pipeline_succeeds @@ -1818,6 +1839,17 @@ Supported attributes: | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +This API returns specific HTTP status codes: + +| HTTP Status | Message | Reason | +|-------------|----------|--------| +| `201` | _(none)_ | Success, or the merge request has already merged. | +| `406` | `Can't cancel the automatic merge` | The merge request is closed. | + +For important notes on response data, see [Single merge request response notes](#single-merge-request-response-notes). + +Example response: + ```json { "id": 1, @@ -1956,16 +1988,11 @@ Supported attributes: } ``` -For important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). - ## Rebase a merge request Automatically rebase the `source_branch` of the merge request against its `target_branch`. -If you don't have permissions to push to the merge request's source branch - -you receive a `403 Forbidden` response. - ```plaintext PUT /projects/:id/merge_requests/:merge_request_iid/rebase ``` @@ -1977,12 +2004,20 @@ PUT /projects/:id/merge_requests/:merge_request_iid/rebase | `skip_ci` | boolean | No | Set to `true` to skip creating a CI pipeline. | ```shell -curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request PUT \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/76/merge_requests/1/rebase" ``` -This request is asynchronous. The API returns a `HTTP 202 Accepted` response -if the request is enqueued successfully, with a response containing: +This API returns specific HTTP status codes: + +| HTTP Status | Message | Reason | +|-------------|--------------------------------------------|--------| +| `202` | *(no message)* | Successfully enqueued. | +| `403` | <ul><li>`Source branch does not exist`</li><li>`Cannot push to source branch`</li><li>`Source branch is protected from force push`</li></ul> | You don't have permission to push to the merge request's source branch. | +| `409` | `Failed to enqueue the rebase operation` | A long-lived transaction might have blocked your request. | + +If the request is enqueued successfully, the response contains: ```json { @@ -2024,7 +2059,7 @@ If the rebase operation fails, the response includes the following: ## Comments on merge requests -Comments are done via the [notes](notes.md) resource. +Comments are created by the [notes](notes.md) resource. ## List issues that close on merge @@ -2104,8 +2139,7 @@ Example response when an external issue tracker (for example, Jira) is used: ## Subscribe to a merge request -Subscribes the authenticated user to a merge request to receive notification. If the user is already subscribed to the merge request, the -status code `HTTP 304 Not Modified` is returned. +Subscribes the authenticated user to a merge request to receive notification. ```plaintext POST /projects/:id/merge_requests/:merge_request_iid/subscribe @@ -2116,8 +2150,12 @@ POST /projects/:id/merge_requests/:merge_request_iid/subscribe | `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +If the user is already subscribed to the merge request, the +status code `HTTP 304 Not Modified` is returned. + ```shell -curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request POST \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/17/subscribe" ``` @@ -2260,13 +2298,12 @@ Example response: } ``` -For important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). +For important notes on response data, see [Single merge request response notes](#single-merge-request-response-notes). ## Unsubscribe from a merge request Unsubscribes the authenticated user from a merge request to not receive -notifications from that merge request. If the user is -not subscribed to the merge request, the status code `HTTP 304 Not Modified` is returned. +notifications from that merge request. ```plaintext POST /projects/:id/merge_requests/:merge_request_iid/unsubscribe @@ -2278,10 +2315,13 @@ POST /projects/:id/merge_requests/:merge_request_iid/unsubscribe | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | ```shell -curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request POST \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/17/unsubscribe" ``` +If the user is not subscribed to the merge request, the status code `HTTP 304 Not Modified` is returned. + Example response: ```json @@ -2421,7 +2461,7 @@ Example response: } ``` -For important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). +For important notes on response data, see [Single merge request response notes](#single-merge-request-response-notes). ## Create a to-do item @@ -2439,7 +2479,8 @@ POST /projects/:id/merge_requests/:merge_request_iid/todo | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | ```shell -curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request POST \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/27/todo" ``` @@ -2555,8 +2596,7 @@ Example response: ## Get merge request diff versions -Get a list of merge request diff versions. For an explanation of the SHAs in the response, -read [SHAs in the API response](#shas-in-the-api-response). +Get a list of merge request diff versions. ```plaintext GET /projects/:id/merge_requests/:merge_request_iid/versions @@ -2567,6 +2607,9 @@ GET /projects/:id/merge_requests/:merge_request_iid/versions | `id` | String | Yes | The ID of the project. | | `merge_request_iid` | integer | Yes | The internal ID of the merge request. | +For an explanation of the SHAs in the response, +see [SHAs in the API response](#shas-in-the-api-response). + ```shell curl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/versions" @@ -2608,8 +2651,7 @@ Example response: ## Get a single merge request diff version -Get a single merge request diff version. For an explanation of the SHAs in the response, -read [SHAs in the API response](#shas-in-the-api-response). +Get a single merge request diff version. ```plaintext GET /projects/:id/merge_requests/:merge_request_iid/versions/:version_id @@ -2622,6 +2664,9 @@ GET /projects/:id/merge_requests/:merge_request_iid/versions/:version_id | `version_id` | integer | Yes | The ID of the merge request diff version. | | `unidiff` | boolean | No | Present diffs in the [unified diff](https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html) format. Default is false. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/130610) in GitLab 16.5. | +For an explanation of the SHAs in the response, +see [SHAs in the API response](#shas-in-the-api-response). + ```shell curl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/versions/1" @@ -2693,7 +2738,8 @@ POST /projects/:id/merge_requests/:merge_request_iid/time_estimate | `duration` | string | Yes | The duration in human format, such as `3h30m`. | ```shell -curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request POST \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/time_estimate?duration=3h30m" ``` @@ -2722,7 +2768,8 @@ POST /projects/:id/merge_requests/:merge_request_iid/reset_time_estimate | `merge_request_iid` | integer | Yes | The internal ID of a project's merge request. | ```shell -curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request POST \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/reset_time_estimate" ``` @@ -2753,7 +2800,8 @@ POST /projects/:id/merge_requests/:merge_request_iid/add_spent_time | `summary` | string | No | A summary of how the time was spent. | ```shell -curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request POST \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/add_spent_time?duration=1h" ``` @@ -2782,7 +2830,8 @@ POST /projects/:id/merge_requests/:merge_request_iid/reset_spent_time | `merge_request_iid` | integer | Yes | The internal ID of a project's merge request. | ```shell -curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ +curl --request POST \ + --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/reset_spent_time" ``` @@ -2826,7 +2875,7 @@ Example response: ## Approvals -For approvals, see [Merge request approvals](merge_request_approvals.md) +For approvals, see [Merge request approvals](merge_request_approvals.md). ## List merge request state events diff --git a/lib/sidebars/groups/super_sidebar_menus/analyze_menu.rb b/lib/sidebars/groups/super_sidebar_menus/analyze_menu.rb index a053288ccea..0724b6d00c3 100644 --- a/lib/sidebars/groups/super_sidebar_menus/analyze_menu.rb +++ b/lib/sidebars/groups/super_sidebar_menus/analyze_menu.rb @@ -18,7 +18,6 @@ module Sidebars def configure_menu_items [ :analytics_dashboards, - :dashboards_analytics, :cycle_analytics, :ci_cd_analytics, :contribution_analytics, diff --git a/locale/gitlab.pot b/locale/gitlab.pot index edd2e11a2e9..6860ce72a93 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -5751,6 +5751,9 @@ msgstr "" msgid "Analytics|Users" msgstr "" +msgid "Analytics|Value Streams Dashboard" +msgstr "" + msgid "Analytics|View available dashboards" msgstr "" @@ -5898,9 +5901,6 @@ msgstr "" msgid "Application ID" msgstr "" -msgid "Application analytics" -msgstr "" - msgid "Application limits saved successfully" msgstr "" @@ -15480,9 +15480,6 @@ msgstr "" msgid "DashboardProjects|Personal" msgstr "" -msgid "Dashboards" -msgstr "" - msgid "Dashboard|%{firstProject} and %{secondProject}" msgstr "" diff --git a/spec/features/admin/admin_mode/login_spec.rb b/spec/features/admin/admin_mode/login_spec.rb index 72c7083f459..f2262464386 100644 --- a/spec/features/admin/admin_mode/login_spec.rb +++ b/spec/features/admin/admin_mode/login_spec.rb @@ -30,7 +30,7 @@ RSpec.describe 'Admin Mode Login', feature_category: :system_access do repeated_otp = user.current_otp enter_code(repeated_otp) - gitlab_enable_admin_mode_sign_in(user) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) @@ -47,7 +47,7 @@ RSpec.describe 'Admin Mode Login', feature_category: :system_access do expect(page).to have_content('Enter verification code') enter_code(user.current_otp) - gitlab_enable_admin_mode_sign_in(user) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) end diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb index 7a33256e7a8..584151726a6 100644 --- a/spec/features/admin/admin_mode/logout_spec.rb +++ b/spec/features/admin/admin_mode/logout_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do # TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See # this issue to look into why: https://gitlab.com/gitlab-org/gitlab/-/issues/331851 sign_in(user) - gitlab_enable_admin_mode_sign_in(user) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) visit admin_root_path end diff --git a/spec/features/admin/admin_mode_spec.rb b/spec/features/admin/admin_mode_spec.rb index b1b44ce143f..2a655cdb1f4 100644 --- a/spec/features/admin/admin_mode_spec.rb +++ b/spec/features/admin/admin_mode_spec.rb @@ -69,7 +69,7 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do context 'when in admin_mode' do before do - gitlab_enable_admin_mode_sign_in(admin) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end it 'contains link to leave admin mode' do diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index a443ba62abb..77707a67d58 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - gitlab_enable_admin_mode_sign_in(admin) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end context 'General page' do diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index b8dc725c17f..d0110b3e013 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do before do sign_in(current_user) - gitlab_enable_admin_mode_sign_in(current_user) + gitlab_enable_admin_mode_sign_in(current_user, use_mock_admin_mode: false) end describe 'GET /admin/users/:id' do diff --git a/spec/lib/sidebars/groups/super_sidebar_menus/analyze_menu_spec.rb b/spec/lib/sidebars/groups/super_sidebar_menus/analyze_menu_spec.rb index cc2809df85f..0ff9bbebdc3 100644 --- a/spec/lib/sidebars/groups/super_sidebar_menus/analyze_menu_spec.rb +++ b/spec/lib/sidebars/groups/super_sidebar_menus/analyze_menu_spec.rb @@ -16,7 +16,6 @@ RSpec.describe Sidebars::Groups::SuperSidebarMenus::AnalyzeMenu, feature_categor expect(items.map(&:class).uniq).to eq([Sidebars::NilMenuItem]) expect(items.map(&:item_id)).to eq([ :analytics_dashboards, - :dashboards_analytics, :cycle_analytics, :ci_cd_analytics, :contribution_analytics, diff --git a/spec/support/helpers/database/duplicate_indexes.yml b/spec/support/helpers/database/duplicate_indexes.yml index 5ae529ea8ef..e7f45db326d 100644 --- a/spec/support/helpers/database/duplicate_indexes.yml +++ b/spec/support/helpers/database/duplicate_indexes.yml @@ -156,18 +156,8 @@ sbom_component_versions: sbom_occurrences: index_sbom_occurrences_for_input_file_path_search: - index_sbom_occurrences_on_project_id_component_id - - index_sbom_occurrences_on_project_id - idx_sbom_occurrences_on_project_id_and_source_id: - - index_sbom_occurrences_on_project_id - index_sbom_occurrences_on_project_id_and_id: - - index_sbom_occurrences_on_project_id - index_sbom_occurrences_on_project_id_component_id: - - index_sbom_occurrences_on_project_id index_sbom_occurrences_on_project_id_and_component_id_and_id: - index_sbom_occurrences_on_project_id_component_id - - index_sbom_occurrences_on_project_id - index_sbom_occurrences_on_project_id_and_package_manager: - - index_sbom_occurrences_on_project_id search_namespace_index_assignments: index_search_namespace_index_assignments_uniqueness_index_type: - index_search_namespace_index_assignments_on_namespace_id diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb index d35fa801638..913316c8622 100644 --- a/spec/support/helpers/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb @@ -3,6 +3,7 @@ require_relative 'devise_helpers' module LoginHelpers + include AdminModeHelper include DeviseHelpers # Overriding Devise::Test::IntegrationHelpers#sign_in to store @current_user @@ -48,12 +49,16 @@ module LoginHelpers @current_user = user end - def gitlab_enable_admin_mode_sign_in(user) - visit new_admin_session_path - fill_in 'user_password', with: user.password - click_button 'Enter admin mode' + def gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: true) + if use_mock_admin_mode + enable_admin_mode!(user) + else + visit new_admin_session_path + fill_in 'user_password', with: user.password + click_button 'Enter admin mode' - wait_for_requests + wait_for_requests + end end def gitlab_sign_in_via(provider, user, uid, saml_response = nil) diff --git a/spec/support/shared_examples/features/inviting_members_shared_examples.rb b/spec/support/shared_examples/features/inviting_members_shared_examples.rb index 178f85cb85b..b479d71b274 100644 --- a/spec/support/shared_examples/features/inviting_members_shared_examples.rb +++ b/spec/support/shared_examples/features/inviting_members_shared_examples.rb @@ -181,6 +181,7 @@ RSpec.shared_examples 'inviting members' do |snowplow_invite_label| visit subentity_members_page_path click_on _('Invite members') + wait_for_requests page.within invite_modal_selector do choose_options(role, nil) |