Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot
2025-05-29 09:09:24 +00:00
parent 7fd5fde09b
commit 6967a7faa2
15 changed files with 136 additions and 49 deletions

View File

@ -136,7 +136,6 @@ export default {
:items="items"
:toggle-text="toggleText"
:header-text="s__('WorkItem|Select template')"
size="small"
:selected="selectedTemplateValue"
:loading="loading"
data-testid="template-dropdown"

View File

@ -46,10 +46,13 @@ module AlertManagement
end
def filter_by_type
return unless params[:type_identifier]
return unless TYPE_IDENTIFIERS.include?(params[:type_identifier])
requested_types = Array.wrap(params[:type_identifier])
types = TYPE_IDENTIFIERS.slice(*requested_types).keys
@collection = collection.for_type(params[:type_identifier])
# simplify SQL query when selecting all types
return if types.none? || types == TYPE_IDENTIFIERS.keys
@collection = collection.for_type(types)
end
end
end

View File

@ -11,31 +11,40 @@ module Resolvers
required: false,
description: 'ID of the integration.'
argument :types, [Types::AlertManagement::IntegrationTypeEnum],
as: :type_identifier,
default_value: [:http],
required: false,
description: 'Types of integrations to return. Default is `[HTTP]`.'
type Types::AlertManagement::HttpIntegrationType.connection_type, null: true
def resolve(id: nil)
def resolve(id: nil, **args)
return [] unless Ability.allowed?(current_user, :admin_operations, project)
if id
integrations_by(gid: id)
integrations_by(gid: id, **args)
else
http_integrations
http_integrations(args)
end
end
private
def integrations_by(gid:)
def integrations_by(gid:, type_identifier: [])
object = GitlabSchema.find_by_gid(gid)
defer { object }.then do |integration|
ret = integration if project == integration&.project
Array.wrap(ret)
next [] if integration.nil?
next [] if project != integration.project
next [] if type_identifier&.any? && type_identifier.exclude?(integration.type_identifier.to_sym)
[integration]
end
end
def http_integrations
::AlertManagement::HttpIntegrationsFinder.new(project, { type_identifier: :http }).execute
def http_integrations(args)
::AlertManagement::HttpIntegrationsFinder.new(project, args).execute
end
end
end

View File

@ -11,7 +11,7 @@ module Types
authorize :admin_operations
def type
:http
object.type_identifier.to_sym
end
def api_url

View File

@ -15,5 +15,10 @@ class CreateNoteDiffFileWorker # rubocop:disable Scalability/IdempotentWorker
diff_note = DiffNote.find_by_id(diff_note_id)
diff_note&.create_diff_file
rescue DiffNote::NoteDiffFileCreationError => e
# We rescue DiffNote::NoteDiffFileCreationError since we don't want to
# fail the job and retry as it won't make any difference if we can't find
# the diff or diff line.
Gitlab::ErrorTracking.track_exception(e, diff_note_id: diff_note_id)
end
end

View File

@ -1,9 +0,0 @@
---
name: snippet_ip_restrictions
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/511506
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180331
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/517917
milestone: '17.9'
type: beta
group: group::source code
default_enabled: true

View File

@ -0,0 +1,23 @@
# frozen_string_literal: true
class RenameCiRunnerMachinesIndexes < Gitlab::Database::Migration[2.3]
milestone '18.1'
INDEXES = [
%w[index_ci_runner_machines_on_major_version_trigram index_ci_runner_machines_on_major_version],
%w[index_ci_runner_machines_on_minor_version_trigram index_ci_runner_machines_on_minor_version],
%w[index_ci_runner_machines_on_patch_version_trigram index_ci_runner_machines_on_patch_version]
]
def up
INDEXES.each do |old_name, new_name|
execute "ALTER INDEX IF EXISTS #{old_name} RENAME TO #{new_name}"
end
end
def down
INDEXES.each do |old_name, new_name|
execute "ALTER INDEX IF EXISTS #{new_name} RENAME TO #{old_name}"
end
end
end

View File

@ -0,0 +1 @@
f22d835c24bd980195bbfdb031d424d46808547059c56658cdc7ddfc0d416308

View File

@ -33125,15 +33125,15 @@ CREATE INDEX index_ci_runner_machines_on_version ON ONLY ci_runner_machines USIN
CREATE INDEX group_type_ci_runner_machines_687967fa8a_version_idx ON group_type_ci_runner_machines USING btree (version);
CREATE INDEX index_ci_runner_machines_on_major_version_trigram ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id);
CREATE INDEX index_ci_runner_machines_on_major_version ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id);
CREATE INDEX group_type_ci_runner_machines_6_substring_version_runner_id_idx ON group_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id);
CREATE INDEX index_ci_runner_machines_on_minor_version_trigram ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id);
CREATE INDEX index_ci_runner_machines_on_minor_version ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id);
CREATE INDEX group_type_ci_runner_machines__substring_version_runner_id_idx1 ON group_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id);
CREATE INDEX index_ci_runner_machines_on_patch_version_trigram ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id);
CREATE INDEX index_ci_runner_machines_on_patch_version ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id);
CREATE INDEX group_type_ci_runner_machines__substring_version_runner_id_idx2 ON group_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id);
@ -40865,11 +40865,11 @@ ALTER INDEX index_ci_runner_machines_on_sharding_key_id_when_not_null ATTACH PAR
ALTER INDEX index_ci_runner_machines_on_version ATTACH PARTITION group_type_ci_runner_machines_687967fa8a_version_idx;
ALTER INDEX index_ci_runner_machines_on_major_version_trigram ATTACH PARTITION group_type_ci_runner_machines_6_substring_version_runner_id_idx;
ALTER INDEX index_ci_runner_machines_on_major_version ATTACH PARTITION group_type_ci_runner_machines_6_substring_version_runner_id_idx;
ALTER INDEX index_ci_runner_machines_on_minor_version_trigram ATTACH PARTITION group_type_ci_runner_machines__substring_version_runner_id_idx1;
ALTER INDEX index_ci_runner_machines_on_minor_version ATTACH PARTITION group_type_ci_runner_machines__substring_version_runner_id_idx1;
ALTER INDEX index_ci_runner_machines_on_patch_version_trigram ATTACH PARTITION group_type_ci_runner_machines__substring_version_runner_id_idx2;
ALTER INDEX index_ci_runner_machines_on_patch_version ATTACH PARTITION group_type_ci_runner_machines__substring_version_runner_id_idx2;
ALTER INDEX ci_runner_machines_pkey ATTACH PARTITION group_type_ci_runner_machines_pkey;
@ -41029,11 +41029,11 @@ ALTER INDEX p_ci_builds_name_id_idx ATTACH PARTITION index_security_ci_builds_on
ALTER INDEX index_ci_runner_machines_on_runner_id_and_type_and_system_xid ATTACH PARTITION instance_type_ci_runner_machi_runner_id_runner_type_system__idx;
ALTER INDEX index_ci_runner_machines_on_minor_version_trigram ATTACH PARTITION instance_type_ci_runner_machin_substring_version_runner_id_idx1;
ALTER INDEX index_ci_runner_machines_on_minor_version ATTACH PARTITION instance_type_ci_runner_machin_substring_version_runner_id_idx1;
ALTER INDEX index_ci_runner_machines_on_patch_version_trigram ATTACH PARTITION instance_type_ci_runner_machin_substring_version_runner_id_idx2;
ALTER INDEX index_ci_runner_machines_on_patch_version ATTACH PARTITION instance_type_ci_runner_machin_substring_version_runner_id_idx2;
ALTER INDEX index_ci_runner_machines_on_major_version_trigram ATTACH PARTITION instance_type_ci_runner_machine_substring_version_runner_id_idx;
ALTER INDEX index_ci_runner_machines_on_major_version ATTACH PARTITION instance_type_ci_runner_machine_substring_version_runner_id_idx;
ALTER INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ATTACH PARTITION instance_type_ci_runner_machines_687967fa8a_contacted_at_id_idx;
@ -41189,9 +41189,9 @@ ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION proje
ALTER INDEX index_ci_runner_machines_on_runner_id_and_type_and_system_xid ATTACH PARTITION project_type_ci_runner_machin_runner_id_runner_type_system__idx;
ALTER INDEX index_ci_runner_machines_on_minor_version_trigram ATTACH PARTITION project_type_ci_runner_machine_substring_version_runner_id_idx1;
ALTER INDEX index_ci_runner_machines_on_minor_version ATTACH PARTITION project_type_ci_runner_machine_substring_version_runner_id_idx1;
ALTER INDEX index_ci_runner_machines_on_patch_version_trigram ATTACH PARTITION project_type_ci_runner_machine_substring_version_runner_id_idx2;
ALTER INDEX index_ci_runner_machines_on_patch_version ATTACH PARTITION project_type_ci_runner_machine_substring_version_runner_id_idx2;
ALTER INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ATTACH PARTITION project_type_ci_runner_machines_687967fa8a_contacted_at_id_idx;
@ -41203,7 +41203,7 @@ ALTER INDEX index_ci_runner_machines_on_version ATTACH PARTITION project_type_ci
ALTER INDEX ci_runner_machines_pkey ATTACH PARTITION project_type_ci_runner_machines_pkey;
ALTER INDEX index_ci_runner_machines_on_major_version_trigram ATTACH PARTITION project_type_ci_runner_machines_substring_version_runner_id_idx;
ALTER INDEX index_ci_runner_machines_on_major_version ATTACH PARTITION project_type_ci_runner_machines_substring_version_runner_id_idx;
ALTER INDEX index_ci_runners_on_active_and_id ATTACH PARTITION project_type_ci_runners_e59bb2812d_active_id_idx;

View File

@ -35733,6 +35733,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="projectalertmanagementhttpintegrationsid"></a>`id` | [`AlertManagementHttpIntegrationID`](#alertmanagementhttpintegrationid) | ID of the integration. |
| <a id="projectalertmanagementhttpintegrationstypes"></a>`types` | [`[AlertManagementIntegrationType!]`](#alertmanagementintegrationtype) | Types of integrations to return. Default is `[HTTP]`. |
##### `Project.alertManagementIntegrations`

View File

@ -15,21 +15,13 @@ For detailed instructions on setting up GitLab Duo licensing in your development
See [GitLab Duo licensing for local development](ai_development_license.md).
## Required: Install AI gateway
### Required: Install AI gateway
**Why:** Duo features (except for Duo Workflow) route LLM requests through the AI gateway.
**How:**
Follow [these instructions](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/gitlab_ai_gateway.md#install)
to install the AI gateway with GDK. Installing through GDK is the best route for most users.
You can also install AI gateway by:
1. [Cloning the repository directly](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist).
1. [Running the server locally](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#how-to-run-the-server-locally).
We only recommend this for users who have a specific reason for *not* running
the AI gateway through GDK.
Follow [these instructions](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/gitlab_ai_gateway.md)
to install the AI gateway with GDK.
### Required: Run `gitlab:duo:setup` script

View File

@ -32,14 +32,13 @@ features. Premium gets access to only a subset of GitLab Duo features.
1. Follow [the process to obtain a Premium/Ultimate license](https://handbook.gitlab.com/handbook/engineering/developer-onboarding/#working-on-gitlab-ee-developer-licenses)
for your local instance
1. On the page with the subscription activation code, select the ellipse menu … > Buy Duo Pro add-on to buy Duo seats. Duo Enterprise is not available but you can set that up with the GDK script.
1. [Upload the EE license](../../administration/license_file.md).
1. [Set environment variables](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/runit.md#using-environment-variables) in GDK:
```shell
export GITLAB_LICENSE_MODE=test
export CUSTOMER_PORTAL_URL=https://customers.staging.gitlab.com
export GITLAB_SIMULATE_SAAS=0
export CLOUD_CONNECTOR_SELF_SIGN_TOKENS=1
```
## (Alternatively) Connect to staging AI Gateway
@ -66,11 +65,12 @@ Ai::Setting.instance.update!(ai_gateway_url: 'https://cloud.staging.gitlab.com/a
If you're having issues with your Duo license setup:
- Run the [Duo health check](../../user/gitlab_duo/setup.md#run-a-health-check-for-gitlab-duo) to identify specific issues
- Run the [Duo health check](../../user/gitlab_duo/setup.md#run-a-health-check-for-gitlab-duo) to identify specific issues. Note that if you have Duo licenses that were generated from a setup script locally, this will show "Cloud Connector access token is missing" but that is OK.
- Verify your license is active by checking the Admin Area
- Ensure your user has a Duo seat assigned. The GDK setup scripts assign a Duo
seat to the `root` user only. If you want to test with other users, make sure
to [assign them a seat](../../subscriptions/subscription-add-ons.md#assign-gitlab-duo-seats).
- To more deeply debug why the root user cannot access a feature like Duo Chat, you can run `GlobalPolicy.new(User.first, User.first).debug(:access_duo_chat)`. This [Declarative Policy debug output](../policies.md#scores-order-performance) will help you dive into the specific access logic for more granular debugging.
- Check logs for any authentication or license validation errors
- For cloud license issues, reach out to `#s_fulfillment_engineering` in Slack
- For AI Gateway connection issues, reach out to `#g_ai_framework` in Slack

View File

@ -66,17 +66,29 @@ RSpec.describe AlertManagement::HttpIntegrationsFinder, feature_category: :incid
it { is_expected.to contain_exactly(prometheus_integration) }
end
context 'but unknown' do
context 'but is unknown' do
let(:params) { { type_identifier: :unknown } }
it { is_expected.to contain_exactly(integration, prometheus_integration) }
end
context 'but includes unknown' do
let(:params) { { type_identifier: [:http, :unknown] } }
it { is_expected.to contain_exactly(integration) }
end
context 'but blank' do
let(:params) { { type_identifier: nil } }
it { is_expected.to contain_exactly(integration, prometheus_integration) }
end
context 'but empty' do
let(:params) { { type_identifier: [] } }
it { is_expected.to contain_exactly(integration, prometheus_integration) }
end
end
context 'project has no integrations' do

View File

@ -52,6 +52,36 @@ RSpec.describe Resolvers::AlertManagement::HttpIntegrationsResolver, feature_cat
it { is_expected.to be_empty }
end
context 'when integration does not match expected type' do
let(:params) { { id: global_id_of(inactive_http_integration), types: ['PROMETHEUS'] } }
it { is_expected.to be_empty }
end
end
context 'when all types are given' do
let(:params) { { types: %w[HTTP PROMETHEUS] } }
it { is_expected.to contain_exactly(active_http_integration, migrated_integration) }
end
context 'when types value is explictly excluded' do
let(:params) { { types: nil } }
it { is_expected.to contain_exactly(active_http_integration, migrated_integration) }
end
context 'when types value is explictly emptied' do
let(:params) { { types: [] } }
it { is_expected.to contain_exactly(active_http_integration, migrated_integration) }
end
context 'when types value is filtered' do
let(:params) { { types: ['PROMETHEUS'] } }
it { is_expected.to contain_exactly(migrated_integration) }
end
end

View File

@ -32,5 +32,26 @@ RSpec.describe CreateNoteDiffFileWorker, feature_category: :code_review_workflow
described_class.new.perform(nil)
end
end
context 'when DiffNote::NoteDiffFileCreationError is raised' do
before do
allow_next_found_instance_of(DiffNote) do |diff_note|
allow(diff_note)
.to receive(:create_diff_file)
.and_raise(DiffNote::NoteDiffFileCreationError)
end
end
it 'tracks exception' do
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
.with(
an_instance_of(DiffNote::NoteDiffFileCreationError),
diff_note_id: diff_note.id
).and_call_original
described_class.new.perform(diff_note.id)
end
end
end
end