Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-09-26 15:10:20 +00:00
parent cd5179ede2
commit 5608dbe14d
44 changed files with 943 additions and 640 deletions

View File

@ -77,7 +77,7 @@ Note: Please make sure to run the chatops commands in the slack channel that get
- [ ] Deploy the feature flag at a percentage (recommended percentage: 50%)
- If the feature flag in code has [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform **actor-based** rollout.
- [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --actors --dev --staging --staging-ref`
- If the feature flag in code does **NOT** have [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform time-based rollout (**random** rollout).
- [Deprecated] If the feature flag in code does **NOT** have [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform time-based rollout (**random** rollout).
- [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --random --dev --staging --staging-ref`
- [ ] Monitor that the error rates did not increase (repeat with a different percentage as necessary)
<!-- End of block for deletes -->
@ -128,9 +128,9 @@ For visibility, all `/chatops` commands that target production should be execute
- [ ] [Incrementally roll out](https://docs.gitlab.com/ee/development/feature_flags/controls.html#process) the feature.
- [ ] Between every step wait for at least 15 minutes and monitor the appropriate graphs on https://dashboards.gitlab.net.
- If the feature flag in code has [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform **actor-based** rollout.
- If the feature flag in code has [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform **actor-based** rollout. For a reference on how to choose the percentages, see [here](https://docs.gitlab.com/ee/development/feature_flags/controls.html#process)
- [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --actors`
- If the feature flag in code does **NOT** have [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform time-based rollout (**random** rollout).
- [Deprecated] If the feature flag in code does **NOT** have [an actor](https://docs.gitlab.com/ee/development/feature_flags/#feature-actors), perform time-based rollout (**random** rollout).
- [ ] `/chatops run feature set <feature-flag-name> <rollout-percentage> --random`
- Enable the feature globally on production environment.
- [ ] `/chatops run feature set <feature-flag-name> true`

View File

@ -49,6 +49,8 @@ AllCops:
- 'shared/packages/**/*'
- 'spec/support/*.git/**/*' # e.g. spec/support/gitlab-git-test.git
- 'db/ci_migrate/*.rb' # since the `db/ci_migrate` is a symlinked to `db/migrate`
# projects_controller.rb is used for testing LLM response and is very sensitive to whitespaces.
- 'ee/spec/fixtures/llm/projects_controller.rb'
# Adding this specifically for a large revert: !118368
<% File.readlines('.rubocop_revert_ignores.txt').map(&:chomp).each do |f| %>
- '<%= f %>'

View File

@ -1335,7 +1335,6 @@ Layout/LineLength:
- 'ee/spec/controllers/projects/pipelines_controller_spec.rb'
- 'ee/spec/controllers/projects/protected_environments_controller_spec.rb'
- 'ee/spec/controllers/projects/push_rules_controller_spec.rb'
- 'ee/spec/controllers/projects/runners_controller_spec.rb'
- 'ee/spec/controllers/projects/security/configuration_controller_spec.rb'
- 'ee/spec/controllers/projects/security/vulnerabilities_controller_spec.rb'
- 'ee/spec/controllers/projects/subscriptions_controller_spec.rb'
@ -3178,7 +3177,6 @@ Layout/LineLength:
- 'spec/controllers/projects/prometheus/metrics_controller_spec.rb'
- 'spec/controllers/projects/registry/tags_controller_spec.rb'
- 'spec/controllers/projects/repositories_controller_spec.rb'
- 'spec/controllers/projects/runners_controller_spec.rb'
- 'spec/controllers/projects/settings/ci_cd_controller_spec.rb'
- 'spec/controllers/projects/settings/operations_controller_spec.rb'
- 'spec/controllers/projects/settings/repository_controller_spec.rb'

View File

@ -26,7 +26,6 @@ RSpec/BeforeAllRoleAssignment:
- 'ee/spec/controllers/groups/issues_analytics_controller_spec.rb'
- 'ee/spec/controllers/groups/merge_requests_controller_spec.rb'
- 'ee/spec/controllers/groups/push_rules_controller_spec.rb'
- 'ee/spec/controllers/groups/runners_controller_spec.rb'
- 'ee/spec/controllers/groups/seat_usage_controller_spec.rb'
- 'ee/spec/controllers/groups/security/policies_controller_spec.rb'
- 'ee/spec/controllers/groups/todos_controller_spec.rb'
@ -775,7 +774,6 @@ RSpec/BeforeAllRoleAssignment:
- 'spec/controllers/groups/group_members_controller_spec.rb'
- 'spec/controllers/groups/imports_controller_spec.rb'
- 'spec/controllers/groups/labels_controller_spec.rb'
- 'spec/controllers/groups/runners_controller_spec.rb'
- 'spec/controllers/groups/settings/applications_controller_spec.rb'
- 'spec/controllers/groups/settings/ci_cd_controller_spec.rb'
- 'spec/controllers/groups/settings/integrations_controller_spec.rb'
@ -817,7 +815,6 @@ RSpec/BeforeAllRoleAssignment:
- 'spec/controllers/projects/registry/repositories_controller_spec.rb'
- 'spec/controllers/projects/repositories_controller_spec.rb'
- 'spec/controllers/projects/runner_projects_controller_spec.rb'
- 'spec/controllers/projects/runners_controller_spec.rb'
- 'spec/controllers/projects/settings/ci_cd_controller_spec.rb'
- 'spec/controllers/projects/settings/integrations_controller_spec.rb'
- 'spec/controllers/projects/settings/slacks_controller_spec.rb'

View File

@ -100,7 +100,6 @@ RSpec/ExpectInHook:
- 'qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb'
- 'qa/qa/specs/features/ee/browser_ui/11_fulfillment/license/cloud_activation_spec.rb'
- 'spec/commands/metrics_server/metrics_server_spec.rb'
- 'spec/controllers/admin/runners_controller_spec.rb'
- 'spec/controllers/autocomplete_controller_spec.rb'
- 'spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb'
- 'spec/controllers/concerns/spammable_actions/captcha_check/html_format_actions_support_spec.rb'

View File

@ -1239,11 +1239,10 @@ class MergeRequest < ApplicationRecord
)
check_mergeability(sync_retry_lease: check_mergeability_retry_lease)
can_be_merged? && (!should_be_rebased? || skip_rebase_check)
mergeable_git_state?(skip_rebase_check: skip_rebase_check)
end
def mergeability_checks
def mergeable_state_checks
# We want to have the cheapest checks first in the list, that way we can
# fail fast before running the more expensive ones.
#
@ -1256,8 +1255,20 @@ class MergeRequest < ApplicationRecord
]
end
def mergeable_git_state_checks
[
::MergeRequests::Mergeability::CheckConflictStatusService,
::MergeRequests::Mergeability::CheckRebaseStatusService
]
end
def all_mergeability_checks
mergeable_state_checks + mergeable_git_state_checks
end
def mergeable_state?(skip_ci_check: false, skip_discussions_check: false, skip_approved_check: false)
additional_checks = execute_merge_checks(
mergeable_state_checks,
params: {
skip_ci_check: skip_ci_check,
skip_discussions_check: skip_discussions_check,
@ -1267,6 +1278,17 @@ class MergeRequest < ApplicationRecord
additional_checks.success?
end
def mergeable_git_state?(skip_rebase_check: false)
checks = execute_merge_checks(
mergeable_git_state_checks,
params: {
skip_rebase_check: skip_rebase_check
}
)
checks.success?
end
def ff_merge_possible?
project.repository.ancestor?(target_branch_sha, diff_head_sha)
end
@ -2081,9 +2103,11 @@ class MergeRequest < ApplicationRecord
false # Overridden in EE
end
def execute_merge_checks(params: {})
def execute_merge_checks(checks, params: {})
# rubocop: disable CodeReuse/ServiceClass
MergeRequests::Mergeability::RunChecksService.new(merge_request: self, params: params).execute
MergeRequests::Mergeability::RunChecksService
.new(merge_request: self, params: params)
.execute(checks)
# rubocop: enable CodeReuse/ServiceClass
end

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
module MergeRequests
module Mergeability
class CheckConflictStatusService < CheckBaseService
def execute
if merge_request.can_be_merged?
success
else
failure(reason: failure_reason)
end
end
def skip?
false
end
def cacheable?
false
end
private
def failure_reason
:conflict
end
end
end
end

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
module MergeRequests
module Mergeability
class CheckRebaseStatusService < CheckBaseService
def execute
if merge_request.should_be_rebased?
failure(reason: failure_reason)
else
success
end
end
def skip?
params[:skip_rebase_check].present?
end
def cacheable?
false
end
private
def failure_reason
:need_rebase
end
end
end
end

View File

@ -46,7 +46,11 @@ module MergeRequests
def check_results
strong_memoize(:check_results) do
merge_request.execute_merge_checks(params: { skip_ci_check: true })
merge_request
.execute_merge_checks(
merge_request.mergeable_state_checks,
params: { skip_ci_check: true }
)
end
end

View File

@ -9,8 +9,8 @@ module MergeRequests
@params = params
end
def execute
@results = merge_request.mergeability_checks.each_with_object([]) do |check_class, result_hash|
def execute(checks)
@results = checks.each_with_object([]) do |check_class, result_hash|
check = check_class.new(merge_request: merge_request, params: params)
next if check.skip?

View File

@ -874,6 +874,9 @@ Gitlab.ee do
Settings.cron_jobs['package_metadata_advisories_sync_worker'] ||= {}
Settings.cron_jobs['package_metadata_advisories_sync_worker']['cron'] ||= "*/5 * * * *"
Settings.cron_jobs['package_metadata_advisories_sync_worker']['job_class'] = 'PackageMetadata::AdvisoriesSyncWorker'
Settings.cron_jobs['okr_checkin_reminder_emails'] ||= {}
Settings.cron_jobs['okr_checkin_reminder_emails']['cron'] ||= "0 1 * * *"
Settings.cron_jobs['okr_checkin_reminder_emails']['job_class'] = 'Okrs::CheckinReminderEmailsCronWorker'
Gitlab.com do
Settings.cron_jobs['disable_legacy_open_source_license_for_inactive_projects'] ||= {}

View File

@ -14,6 +14,8 @@ options:
prefix: web_ide
event: commits_count
include_usage_prefix: false
events:
- name: web_ide_commit_created
distribution:
- ce
- ee

View File

@ -13,6 +13,8 @@ instrumentation_class: RedisMetric
options:
prefix: note
event: create_commit
events:
- name: commit_note_created
distribution:
- ce
- ee

View File

@ -13,6 +13,8 @@ instrumentation_class: RedisMetric
options:
prefix: source_code
event: pushes
events:
- name: source_code_pushed
distribution:
- ce
- ee

View File

@ -14,6 +14,8 @@ instrumentation_class: RedisMetric
options:
prefix: package_events
event: i_package_pull_package_by_guest
events:
- name: package_pulled_by_guest
distribution:
- ee
- ce

View File

@ -14,6 +14,8 @@ instrumentation_class: RedisMetric
options:
prefix: package_events
event: i_package_push_package_by_deploy_token
events:
- name: package_pushed_using_deploy_token
distribution:
- ee
- ce

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddOkrReminderLastSentToWorkItemProgresses < Gitlab::Database::Migration[2.1]
def change
add_column :work_item_progresses, :last_reminder_sent_at, :datetime_with_timezone
end
end

View File

@ -0,0 +1 @@
8ff68d23e22306e024017ba7e2d45837e86da60434bd968df5696bc137155e29

View File

@ -25339,7 +25339,8 @@ CREATE TABLE work_item_progresses (
end_value double precision DEFAULT 100.0 NOT NULL,
current_value double precision DEFAULT 0.0 NOT NULL,
rollup_progress boolean DEFAULT true NOT NULL,
reminder_frequency smallint DEFAULT 0 NOT NULL
reminder_frequency smallint DEFAULT 0 NOT NULL,
last_reminder_sent_at timestamp with time zone
);
CREATE TABLE work_item_types (

View File

@ -28,13 +28,8 @@ a single-node Geo site or a multi-node Geo site.
### Single-node Geo sites
If both Geo sites are based on the [1K reference architecture](../../reference_architectures/1k_users.md):
1. Set up the database replication based on your choice of PostgreSQL instances (`primary (read-write) <-> secondary (read-only)` topology):
- [Using Linux package PostgreSQL instances](database.md) .
- [Using external PostgreSQL instances](external_database.md)
1. [Configure GitLab](../replication/configuration.md) to set the **primary** and **secondary** sites.
1. Follow the [Using a Geo Site](../replication/usage.md) guide.
If both Geo sites are based on the [1K reference architecture](../../reference_architectures/1k_users.md), follow
[Set up Geo for two single-node sites](two_single_node_sites.md).
Depending on your GitLab deployment, [additional configuration](#additional-configuration) for LDAP, object storage, and the Container Registry might be required.
@ -45,6 +40,16 @@ If one or more of your sites is using the [2K reference architecture](../../refe
Depending on your GitLab deployment, [additional configuration](#additional-configuration) for LDAP, object storage, and the Container Registry might be required.
### General steps for reference
1. Set up the database replication based on your choice of PostgreSQL instances (`primary (read-write) <-> secondary (read-only)` topology):
- [Using Linux package PostgreSQL instances](database.md) .
- [Using external PostgreSQL instances](external_database.md)
1. [Configure GitLab](../replication/configuration.md) to set the **primary** and **secondary** sites.
1. Follow the [Using a Geo Site](../replication/usage.md) guide.
Depending on your GitLab deployment, [additional configuration](#additional-configuration) for LDAP, object storage, and the Container Registry might be required.
### Additional configuration
Depending on how you use GitLab, the following configuration might be required:

View File

@ -41,6 +41,9 @@ databases. Some examples:
To migrate existing data from the `main` database to the `ci` database, you can
copy the database across.
NOTE:
If something unexpected happens during the migration, it is safe to start over.
### Existing self-compiled installation
1. [Disable background migrations](../../development/database/batched_background_migrations.md#enable-or-disable-background-migrations)

View File

@ -26742,6 +26742,14 @@ Agent token statuses.
| <a id="agenttokenstatusactive"></a>`ACTIVE` | Active agent token. |
| <a id="agenttokenstatusrevoked"></a>`REVOKED` | Revoked agent token. |
### `AiAction`
Action to subscribe to.
| Value | Description |
| ----- | ----------- |
| <a id="aiactionchat"></a>`CHAT` | Chat action. |
### `AiMessageRole`
Possible message roles for AI features.

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,8 @@ make sure a new fixture is generated and committed together with the change.
The GraphQL Subscription for Chat behaves slightly different because it's user-centric. A user could have Chat open on multiple browser tabs, or also on their IDE.
We therefore need to broadcast messages to multiple clients to keep them in sync. The `aiAction` mutation with the `chat` action behaves the following:
1. All complete Chat messages (including messages from the user) are broadcasted with the `userId` and the `resourceId` from the mutation as identifier, ignoring the `clientSubscriptionId`.
1. Chunks from streamed Chat messages are broadcasted with the `userId`, `resourceId`, and `clientSubscriptionId` as identifier.
1. All complete Chat messages (including messages from the user) are broadcasted with the `userId`, `aiAction: "chat"` as identifier.
1. Chunks from streamed Chat messages and currently used tools are broadcasted with the `userId`, `resourceId`, and the `clientSubscriptionId` from the mutation as identifier.
To truly sync messages between all clients of a user, we need to remove the `resourceId` as well, which will be fixed by [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/420296).
Note that we still broadcast chat messages and currently used tools using the `userId` and `resourceId` as identifier.
However, this is deprecated and should no longer be used. We want to remove `resourceId` on the subscription as part of [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/420296).

View File

@ -190,6 +190,8 @@ Feature.enabled?(:feature_ice_cold_projects, project)
If you are not certain what percentages to use, use the following steps:
1. 1%
1. 10%
1. 25%
1. 50%
1. 75%

View File

@ -47,7 +47,7 @@ If the highest number stable branch is unclear, check the [GitLab blog](https://
|:------------------------|:----------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Ruby](#2-ruby) | `3.0.x` | From GitLab 15.10, Ruby 3.0 is required. You must use the standard MRI implementation of Ruby. We love [JRuby](https://www.jruby.org/) and [Rubinius](https://github.com/rubinius/rubinius#the-rubinius-language-platform), but GitLab needs several Gems that have native extensions. |
| [RubyGems](#3-rubygems) | `3.4.x` | A specific RubyGems version is not fully needed, but it's recommended to update so you can enjoy some known performance improvements. |
| [Go](#4-go) | `1.19.x` | From GitLab 16.1, Go 1.19 or later is required. |
| [Go](#4-go) | `1.20.x` | From GitLab 16.4, Go 1.20 or later is required. |
| [Git](#git) | `2.41.x` | From GitLab 16.2, Git 2.41.x and later is required. You should use the [Git version provided by Gitaly](#git). |
| [Node.js](#5-node) | `18.17.x` | From GitLab 16.3, Node.js 18.17 or later is required. |
@ -247,11 +247,11 @@ Linux. You can find downloads for other platforms at the
# Remove former Go installation folder
sudo rm -rf /usr/local/go
curl --remote-name --location --progress-bar "https://go.dev/dl/go1.19.10.linux-amd64.tar.gz"
echo '8b045a483d3895c6edba2e90a9189262876190dbbd21756870cdd63821810677 go1.19.10.linux-amd64.tar.gz' | shasum -a256 -c - && \
sudo tar -C /usr/local -xzf go1.19.10.linux-amd64.tar.gz
curl --remote-name --location --progress-bar "https://go.dev/dl/go1.20.8.linux-amd64.tar.gz"
echo 'cc97c28d9c252fbf28f91950d830201aa403836cbed702a05932e63f7f0c7bc4 go1.20.8.linux-amd64.tar.gz' | shasum -a256 -c - && \
sudo tar -C /usr/local -xzf go1.20.8.linux-amd64.tar.gz
sudo ln -sf /usr/local/go/bin/{go,gofmt} /usr/local/bin/
rm go1.19.10.linux-amd64.tar.gz
rm go1.20.8.linux-amd64.tar.gz
```
## 5. Node

View File

@ -193,7 +193,7 @@ When upgrading:
GitLab instances with multiple web nodes) > [`15.4.6`](versions/gitlab_15_changes.md#1540) >
[`15.11.13`](versions/gitlab_15_changes.md#15110).
- GitLab 16: [`16.0.x`](versions/gitlab_16_changes.md#1600) (only
[instances with lots of users](versions/gitlab_16_changes.md#long-running-user-type-data-change)) > [`16.3`](versions/gitlab_16_changes.md#1630) > [latest `16.Y.Z`](https://gitlab.com/gitlab-org/gitlab/-/releases).
[instances with lots of users](versions/gitlab_16_changes.md#long-running-user-type-data-change)) > [`16.1`](versions/gitlab_16_changes.md#1610)(instances with NPM packages in their Package Registry) > [`16.3`](versions/gitlab_16_changes.md#1630) > [latest `16.Y.Z`](https://gitlab.com/gitlab-org/gitlab/-/releases).
1. Check for [required upgrade stops](#required-upgrade-stops).
1. Consult the [version-specific upgrade instructions](#version-specific-upgrading-instructions).

View File

@ -95,11 +95,11 @@ Download and install Go (for Linux, 64-bit):
# Remove former Go installation folder
sudo rm -rf /usr/local/go
curl --remote-name --location --progress-bar "https://go.dev/dl/go1.19.10.linux-amd64.tar.gz"
echo '8b045a483d3895c6edba2e90a9189262876190dbbd21756870cdd63821810677 go1.19.10.linux-amd64.tar.gz' | shasum -a256 -c - && \
sudo tar -C /usr/local -xzf go1.19.10.linux-amd64.tar.gz
curl --remote-name --location --progress-bar "https://go.dev/dl/go1.20.8.linux-amd64.tar.gz"
echo 'cc97c28d9c252fbf28f91950d830201aa403836cbed702a05932e63f7f0c7bc4 go1.20.8.linux-amd64.tar.gz' | shasum -a256 -c - && \
sudo tar -C /usr/local -xzf go1.20.8.linux-amd64.tar.gz
sudo ln -sf /usr/local/go/bin/{go,gofmt} /usr/local/bin/
rm go1.19.10.linux-amd64.tar.gz
rm go1.20.8.linux-amd64.tar.gz
```
### 6. Update Git

View File

@ -84,6 +84,8 @@ For more information about upgrading GitLab Helm Chart, see [the release notes f
## 16.3.0
- A unique index was added to ensure that theres no duplicate NPM packages in the database. If you have duplicate NPM packages, you need to upgrade to 16.1 first, or you are likely to run into the following error: `PG::UniqueViolation: ERROR: could not create unique index "idx_packages_on_project_id_name_version_unique_when_npm"`.
- For Go applications, [`crypto/tls`: verifying certificate chains containing large RSA keys is slow (CVE-2023-29409)](https://github.com/golang/go/issues/61460)
introduced a hard limit of 8192 bits for RSA keys. In the context of Go applications at GitLab, RSA keys can be configured for:
@ -199,6 +201,7 @@ Specific information applies to installations using Geo:
[backfill `prepared_at` values on the `merge_requests` table](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111865). This
migration may take multiple days to complete on larger GitLab instances. Make sure the migration
has completed successfully before upgrading to 16.1.0.
- GitLab 16.1.0 includes a [batched background migration](../background_migrations.md#batched-background-migrations) `MarkDuplicateNpmPackagesForDestruction` to mark duplicate NPM packages for destruction. Make sure the migration has completed successfully before upgrading to 16.3.0 or later.
### Self-compiled installations

View File

@ -28,7 +28,6 @@ You can use two types of labels in GitLab:
## Assign and unassign labels
> - Unassigning labels with the **X** button [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216881) in GitLab 13.5.
> - Real-time updates in the sidebar [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/241538) in GitLab 14.10 with a [feature flag](../../administration/feature_flags.md) named `realtime_labels`, disabled by default.
> - Real-time updates in the sidebar [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/357370#note_991987201) in GitLab 15.1.
> - Real-time updates in the sidebar [enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/357370) in GitLab 15.5.
@ -65,8 +64,6 @@ You can also assign and unassign labels with [quick actions](quick_actions.md):
### View project labels
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/241990) in GitLab 13.5: the label list in a project also shows all inherited labels.
To view the **project's labels**:
1. On the left sidebar, select **Search or go to** and find your project.
@ -184,7 +181,8 @@ To edit a **project** label:
1. On the left sidebar, select **Search or go to** and find your project.
1. Select **Manage > Labels**.
1. Next to the label you want to edit, select **Edit** (**{pencil}**).
1. Next to the label you want to edit, select the vertical ellipsis (**{ellipsis_v}**), and then select **Edit**.
1. Select **Save changes**.
### Edit a group label
@ -192,7 +190,8 @@ To edit a **group** label:
1. On the left sidebar, select **Search or go to** and find your group.
1. Select **Manage > Labels**.
1. Next to the label you want to edit, select **Edit** (**{pencil}**).
1. Next to the label you want to edit, select the vertical ellipsis (**{ellipsis_v}**), and then select **Edit**.
1. Select **Save changes**.
## Delete a label
@ -210,12 +209,7 @@ To delete a **project** label:
1. On the left sidebar, select **Search or go to** and find your project.
1. Select **Manage > Labels**.
1. Either:
- Next to the **Subscribe** button, select (**{ellipsis_v}**).
- Next to the label you want to edit, select **Edit** (**{pencil}**).
1. Select **Delete**.
1. Next to the **Subscribe** button, select (**{ellipsis_v}**), and then select **Delete**.
### Delete a group label
@ -232,8 +226,6 @@ To delete a **group** label:
## Promote a project label to a group label
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/231472) in GitLab 13.6: promoting a project label keeps that label's ID and changes it into a group label. Previously, promoting a project label created a new group label with a new ID and deleted the old label.
You might want to make a project label available for other
projects in the same group. Then, you can promote the label to a group label.
@ -455,6 +447,34 @@ The labels higher in the list get higher priority.
To learn what happens when you sort by priority or label priority, see
[Sorting and ordering issue lists](issues/sorting_issue_lists.md).
## Lock labels when a merge request is merged **(BETA)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/408676) in GitLab 16.3 [with a flag](../../administration/feature_flags.md) named `enforce_locked_labels_on_merge`. This feature is [Beta](../../policy/experiment-beta-support.md).
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available per group or per project, an administrator can [enable the feature flag](../../administration/feature_flags.md) named `enforce_locked_labels_on_merge`.
On GitLab.com, this feature is only available for use by GitLab Inc.
To comply with certain auditing requirements, you can set labels to be locked.
When a merge request with locked labels gets merged, nobody can remove them from the MR.
When you add locked labels to issues or epics, they behave like regular labels.
Prerequisites:
- You must have at least the Reporter role for the project or group.
WARNING:
After you set a label as locked, nobody can undo it or delete the label.
To set a label to get locked on merge:
1. On the left sidebar, select **Search or go to** and find your group or project.
1. Select **Manage > Labels**.
1. Next to the label you want to edit, select the vertical ellipsis (**{ellipsis_v}**), and then select **Edit**.
1. Select the **Lock label after a merge request is merged** checkbox.
1. Select **Save changes**.
## Related topics
Practice working with labels in the following tutorials:

View File

@ -94,7 +94,7 @@ Filling in the form and selecting the **Add status check** button creates a new
### Update a status check service
Within the **Status checks** sub-section, select the **Edit** button
Within the **Status checks** sub-section, select **Edit** (**{pencil}**)
next to the status check you want to edit.
The **Update status check** form is then shown.
@ -137,7 +137,7 @@ you can select the **All branches** option.
## Delete a status check service
Within the **Status checks** sub-section, select the **Remove...** button
Within the **Status checks** sub-section, select **Remove** (**{remove}**)
next to the status check you want to delete.
The **Remove status check?** modal is then shown.

View File

@ -28,13 +28,7 @@ module Gitlab
def to_context
return unless %w[redis redis_hll].include?(data_source)
event_name = if data_source == 'redis_hll'
options[:events].first
elsif data_source == 'redis'
Gitlab::Usage::Metrics::Instrumentations::RedisMetric.new(attributes).redis_key
end
Gitlab::Tracking::ServicePingContext.new(data_source: data_source, event: event_name)
Gitlab::Tracking::ServicePingContext.new(data_source: data_source, event: events.each_key.first)
end
def to_h
@ -110,7 +104,7 @@ module Gitlab
end
def context_for(key_path)
definitions[key_path].to_context
definitions[key_path]&.to_context
end
def schemer

View File

@ -32250,6 +32250,12 @@ msgstr ""
msgid "OK"
msgstr ""
msgid "OKRs|%{author_link}'s OKR %{work_item_link} requires an update."
msgstr ""
msgid "OKRs|An update is due on: %{update_due_date}"
msgstr ""
msgid "OKR|Existing key result"
msgstr ""

View File

@ -56,9 +56,9 @@ module QA
# Checks if a resource already exists
#
# @return [Boolean] true if the resource returns HTTP status code 200
def exists?
def exists?(**args)
request = Runtime::API::Request.new(api_client, api_get_path)
response = get(request.url)
response = get(request.url, args)
response.code == HTTP_STATUS_OK
end

View File

@ -507,7 +507,7 @@ module QA
sleep_interval: 1,
message: "Waiting for #{self.class.name} to be removed"
) do
!exists?
!exists?(max_redirects: 0)
rescue InternalServerError
# Retry on transient errors that are likely to be due to race conditions between concurrent delete operations
# when parts of a resource are stored in multiple tables

View File

@ -203,4 +203,34 @@ RSpec.describe QA::Resource::ApiFabricator do
end
end
end
describe '#exists?' do
let(:resource) { resource_with_api_support }
let(:request) { double('GET request', url: 'new-url') }
let(:args) { { max_redirects: 0 } }
before do
allow(QA::Runtime::API::Request).to receive(:new).and_return(request)
end
context 'when request is successful' do
let(:response) { double('GET response', code: 200) }
it 'returns true' do
expect(subject).to receive(:get).with(request.url, args).and_return(response)
expect(subject.exists?(**args)).to eq(true)
end
end
context 'when request is unsuccessful' do
let(:response) { double('GET response', code: 404) }
it 'returns false' do
expect(subject).to receive(:get).with(request.url, args).and_return(response)
expect(subject.exists?(**args)).to eq(false)
end
end
end
end

View File

@ -106,13 +106,11 @@ RSpec.describe Admin::RunnersController, feature_category: :runner_fleet do
subject(:request) { post :update, params: runner_params }
context 'with update succeeding' do
before do
it 'updates the runner and ticks the queue' do
expect_next_instance_of(Ci::Runners::UpdateRunnerService, runner) do |service|
expect(service).to receive(:execute).with(anything).and_call_original
end
end
it 'updates the runner and ticks the queue' do
expect { request }.to change { runner.ensure_runner_queue_value }
runner.reload
@ -123,13 +121,11 @@ RSpec.describe Admin::RunnersController, feature_category: :runner_fleet do
end
context 'with update failing' do
before do
it 'does not update runner or tick the queue' do
expect_next_instance_of(Ci::Runners::UpdateRunnerService, runner) do |service|
expect(service).to receive(:execute).with(anything).and_return(ServiceResponse.error(message: 'failure'))
end
end
it 'does not update runner or tick the queue' do
expect { request }.not_to change { runner.ensure_runner_queue_value }
expect { request }.not_to change { runner.reload.description }

View File

@ -49,7 +49,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when the user is a maintainer' do
before do
before_all do
group.add_maintainer(user)
end
@ -64,7 +64,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when the user is an owner' do
before do
before_all do
group.add_owner(user)
end
@ -79,7 +79,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not maintainer' do
before do
before_all do
group.add_developer(user)
end
@ -89,7 +89,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
describe '#new' do
context 'when user is owner' do
before do
before_all do
group.add_owner(user)
end
@ -102,7 +102,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not owner' do
before do
before_all do
group.add_maintainer(user)
end
@ -118,7 +118,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
subject(:register) { get :register, params: { group_id: group, id: new_runner } }
context 'when user is owner' do
before do
before_all do
group.add_owner(user)
end
@ -145,7 +145,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not owner' do
before do
before_all do
group.add_maintainer(user)
end
@ -163,7 +163,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
describe '#show' do
context 'when user is maintainer' do
before do
before_all do
group.add_maintainer(user)
end
@ -190,7 +190,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not maintainer' do
before do
before_all do
group.add_developer(user)
end
@ -216,7 +216,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
describe '#edit' do
context 'when user is owner' do
before do
before_all do
group.add_owner(user)
end
@ -248,7 +248,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is maintainer' do
before do
before_all do
group.add_maintainer(user)
end
@ -273,7 +273,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not maintainer' do
before do
before_all do
group.add_developer(user)
end
@ -329,7 +329,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is owner' do
before do
before_all do
group.add_owner(user)
end
@ -353,7 +353,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is maintainer' do
before do
before_all do
group.add_maintainer(user)
end
@ -377,7 +377,7 @@ RSpec.describe Groups::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not maintainer' do
before do
before_all do
group.add_developer(user)
end

View File

@ -17,7 +17,6 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
before do
sign_in(user)
project.add_maintainer(user)
end
describe '#new' do
@ -29,7 +28,7 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
context 'when user is maintainer' do
before do
before_all do
project.add_maintainer(user)
end
@ -42,7 +41,7 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not maintainer' do
before do
before_all do
project.add_developer(user)
end
@ -55,15 +54,19 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
describe '#register' do
subject(:register) { get :register, params: { namespace_id: project.namespace, project_id: project, id: new_runner } }
subject(:register) do
get :register, params: { namespace_id: project.namespace, project_id: project, id: new_runner }
end
context 'when user is maintainer' do
before do
before_all do
project.add_maintainer(user)
end
context 'when runner can be registered after creation' do
let_it_be(:new_runner) { create(:ci_runner, :project, projects: [project], registration_type: :authenticated_user) }
let_it_be(:new_runner) do
create(:ci_runner, :project, projects: [project], registration_type: :authenticated_user)
end
it 'renders a :register template' do
register
@ -85,12 +88,14 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
context 'when user is not maintainer' do
before do
before_all do
project.add_developer(user)
end
context 'when runner can be registered after creation' do
let_it_be(:new_runner) { create(:ci_runner, :project, projects: [project], registration_type: :authenticated_user) }
let_it_be(:new_runner) do
create(:ci_runner, :project, projects: [project], registration_type: :authenticated_user)
end
it 'returns :not_found' do
register
@ -102,6 +107,10 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
describe '#update' do
before_all do
project.add_maintainer(user)
end
it 'updates the runner and ticks the queue' do
new_desc = runner.description.swapcase
@ -117,6 +126,10 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
describe '#destroy' do
before_all do
project.add_maintainer(user)
end
it 'destroys the runner' do
expect_next_instance_of(Ci::Runners::UnregisterRunnerService, runner, user) do |service|
expect(service).to receive(:execute).once.and_call_original
@ -130,6 +143,10 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
describe '#resume' do
before_all do
project.add_maintainer(user)
end
it 'marks the runner as active and ticks the queue' do
runner.update!(active: false)
@ -145,6 +162,10 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
describe '#pause' do
before_all do
project.add_maintainer(user)
end
it 'marks the runner as inactive and ticks the queue' do
runner.update!(active: true)
@ -160,9 +181,14 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
end
describe '#toggle_shared_runners' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
before do
project.add_maintainer(user) # rubocop: disable RSpec/BeforeAllRoleAssignment
end
it 'toggles shared_runners_enabled when the group allows shared runners' do
project.update!(shared_runners_enabled: true)
@ -196,7 +222,8 @@ RSpec.describe Projects::RunnersController, feature_category: :runner_fleet do
expect(response).to have_gitlab_http_status(:unauthorized)
expect(project.shared_runners_enabled).to eq(false)
expect(json_response['error']).to eq('Shared runners enabled cannot be enabled because parent group does not allow it')
expect(json_response['error'])
.to eq('Shared runners enabled cannot be enabled because parent group does not allow it')
end
end
end

View File

@ -126,11 +126,13 @@ RSpec.describe Gitlab::Usage::MetricDefinition, feature_category: :service_ping
context 'with data_source redis metric' do
before do
attributes[:data_source] = 'redis'
attributes[:options] = { prefix: 'web_ide', event: 'views_count', include_usage_prefix: false }
attributes[:events] = [
{ name: 'web_ide_viewed' }
]
end
it 'returns a ServicePingContext with redis key as event_name' do
expect(subject.to_h[:data][:event_name]).to eq('WEB_IDE_VIEWS_COUNT')
it 'returns a ServicePingContext with first event as event_name' do
expect(subject.to_h[:data][:event_name]).to eq('web_ide_viewed')
end
end

View File

@ -0,0 +1,46 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe MergeRequests::Mergeability::CheckConflictStatusService, feature_category: :code_review_workflow do
subject(:check_conflict_status) { described_class.new(merge_request: merge_request, params: {}) }
let(:merge_request) { build(:merge_request) }
describe '#execute' do
let(:result) { check_conflict_status.execute }
before do
allow(merge_request).to receive(:can_be_merged?).and_return(can_be_merged)
end
context 'when MergeRequest#can_be_merged is true' do
let(:can_be_merged) { true }
it 'returns a check result with status success' do
expect(result.status).to eq Gitlab::MergeRequests::Mergeability::CheckResult::SUCCESS_STATUS
end
end
context 'when MergeRequest#can_be_merged is false' do
let(:can_be_merged) { false }
it 'returns a check result with status failed' do
expect(result.status).to eq Gitlab::MergeRequests::Mergeability::CheckResult::FAILED_STATUS
expect(result.payload[:reason]).to eq(:conflict)
end
end
end
describe '#skip?' do
it 'returns false' do
expect(check_conflict_status.skip?).to eq false
end
end
describe '#cacheable?' do
it 'returns false' do
expect(check_conflict_status.cacheable?).to eq false
end
end
end

View File

@ -0,0 +1,60 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe MergeRequests::Mergeability::CheckRebaseStatusService, feature_category: :code_review_workflow do
subject(:check_rebase_status) { described_class.new(merge_request: merge_request, params: params) }
let(:merge_request) { build(:merge_request) }
let(:params) { { skip_rebase_check: skip_check } }
let(:skip_check) { false }
describe '#execute' do
let(:result) { check_rebase_status.execute }
before do
allow(merge_request).to receive(:should_be_rebased?).and_return(should_be_rebased)
end
context 'when the merge request should be rebased' do
let(:should_be_rebased) { true }
it 'returns a check result with status failed' do
expect(result.status).to eq Gitlab::MergeRequests::Mergeability::CheckResult::FAILED_STATUS
expect(result.payload[:reason]).to eq :need_rebase
end
end
context 'when the merge request should not be rebased' do
let(:should_be_rebased) { false }
it 'returns a check result with status success' do
expect(result.status).to eq Gitlab::MergeRequests::Mergeability::CheckResult::SUCCESS_STATUS
end
end
end
describe '#skip?' do
context 'when skip check is true' do
let(:skip_check) { true }
it 'returns true' do
expect(check_rebase_status.skip?).to eq true
end
end
context 'when skip check is false' do
let(:skip_check) { false }
it 'returns false' do
expect(check_rebase_status.skip?).to eq false
end
end
end
describe '#cacheable?' do
it 'returns false' do
expect(check_rebase_status.cacheable?).to eq false
end
end
end

View File

@ -3,10 +3,12 @@
require 'spec_helper'
RSpec.describe MergeRequests::Mergeability::RunChecksService, :clean_gitlab_redis_cache, feature_category: :code_review_workflow do
let(:checks) { merge_request.all_mergeability_checks }
subject(:run_checks) { described_class.new(merge_request: merge_request, params: {}) }
describe '#execute' do
subject(:execute) { run_checks.execute }
subject(:execute) { run_checks.execute(checks) }
let_it_be(:merge_request) { create(:merge_request) }
@ -29,7 +31,7 @@ RSpec.describe MergeRequests::Mergeability::RunChecksService, :clean_gitlab_redi
context 'when a check is skipped' do
it 'does not execute the check' do
merge_request.mergeability_checks.each do |check|
checks.each do |check|
allow_next_instance_of(check) do |service|
allow(service).to receive(:skip?).and_return(false)
allow(service).to receive(:execute).and_return(success_result)
@ -50,7 +52,7 @@ RSpec.describe MergeRequests::Mergeability::RunChecksService, :clean_gitlab_redi
let(:merge_check) { instance_double(MergeRequests::Mergeability::CheckCiStatusService) }
before do
merge_request.mergeability_checks.each do |check|
checks.each do |check|
allow_next_instance_of(check) do |service|
allow(service).to receive(:skip?).and_return(true)
end
@ -114,7 +116,7 @@ RSpec.describe MergeRequests::Mergeability::RunChecksService, :clean_gitlab_redi
context 'when the execute method has been executed' do
before do
run_checks.execute
run_checks.execute(checks)
end
context 'when all the checks succeed' do
@ -126,7 +128,7 @@ RSpec.describe MergeRequests::Mergeability::RunChecksService, :clean_gitlab_redi
context 'when one check fails' do
before do
allow(merge_request).to receive(:open?).and_return(false)
run_checks.execute
run_checks.execute(checks)
end
it 'returns false' do
@ -151,7 +153,7 @@ RSpec.describe MergeRequests::Mergeability::RunChecksService, :clean_gitlab_redi
context 'when the execute method has been executed' do
context 'when all the checks succeed' do
before do
run_checks.execute
run_checks.execute(checks)
end
it 'returns nil' do
@ -162,7 +164,7 @@ RSpec.describe MergeRequests::Mergeability::RunChecksService, :clean_gitlab_redi
context 'when one check fails' do
before do
allow(merge_request).to receive(:open?).and_return(false)
run_checks.execute
run_checks.execute(checks)
end
it 'returns the open reason' do

View File

@ -26,7 +26,6 @@
- './ee/spec/controllers/admin/licenses/usage_exports_controller_spec.rb'
- './ee/spec/controllers/admin/projects_controller_spec.rb'
- './ee/spec/controllers/admin/push_rules_controller_spec.rb'
- './ee/spec/controllers/admin/runners_controller_spec.rb'
- './ee/spec/controllers/admin/users_controller_spec.rb'
- './ee/spec/controllers/autocomplete_controller_spec.rb'
- './ee/spec/controllers/concerns/ee/routable_actions/sso_enforcement_redirect_spec.rb'
@ -87,7 +86,6 @@
- './ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb'
- './ee/spec/controllers/groups/push_rules_controller_spec.rb'
- './ee/spec/controllers/groups/roadmap_controller_spec.rb'
- './ee/spec/controllers/groups/runners_controller_spec.rb'
- './ee/spec/controllers/groups/saml_group_links_controller_spec.rb'
- './ee/spec/controllers/groups/saml_providers_controller_spec.rb'
- './ee/spec/controllers/groups/scim_oauth_controller_spec.rb'
@ -142,7 +140,6 @@
- './ee/spec/controllers/projects/quality/test_cases_controller_spec.rb'
- './ee/spec/controllers/projects/repositories_controller_spec.rb'
- './ee/spec/controllers/projects/requirements_management/requirements_controller_spec.rb'
- './ee/spec/controllers/projects/runners_controller_spec.rb'
- './ee/spec/controllers/projects/security/api_fuzzing_configuration_controller_spec.rb'
- './ee/spec/controllers/projects/security/configuration_controller_spec.rb'
- './ee/spec/controllers/projects/security/dashboard_controller_spec.rb'
@ -3277,7 +3274,6 @@
- './spec/controllers/admin/jobs_controller_spec.rb'
- './spec/controllers/admin/plan_limits_controller_spec.rb'
- './spec/controllers/admin/projects_controller_spec.rb'
- './spec/controllers/admin/runners_controller_spec.rb'
- './spec/controllers/admin/sessions_controller_spec.rb'
- './spec/controllers/admin/spam_logs_controller_spec.rb'
- './spec/controllers/admin/topics/avatars_controller_spec.rb'
@ -3348,7 +3344,6 @@
- './spec/controllers/groups/packages_controller_spec.rb'
- './spec/controllers/groups/registry/repositories_controller_spec.rb'
- './spec/controllers/groups/releases_controller_spec.rb'
- './spec/controllers/groups/runners_controller_spec.rb'
- './spec/controllers/groups/settings/applications_controller_spec.rb'
- './spec/controllers/groups/settings/ci_cd_controller_spec.rb'
- './spec/controllers/groups/settings/integrations_controller_spec.rb'
@ -3474,7 +3469,6 @@
- './spec/controllers/projects/releases_controller_spec.rb'
- './spec/controllers/projects/releases/evidences_controller_spec.rb'
- './spec/controllers/projects/repositories_controller_spec.rb'
- './spec/controllers/projects/runners_controller_spec.rb'
- './spec/controllers/projects/security/configuration_controller_spec.rb'
- './spec/controllers/projects/service_desk_controller_spec.rb'
- './spec/controllers/projects/service_ping_controller_spec.rb'