Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-07-04 21:08:43 +00:00
parent f2f95cc1ba
commit f9269785d9
38 changed files with 189 additions and 225 deletions

View File

@ -21,6 +21,9 @@ export const SNIPPET_VISIBILITY = {
label: __('Public'),
icon: 'earth',
description: __('The snippet can be accessed without any authentication.'),
description_project: __(
'The snippet can be accessed without any authentication. To embed snippets, a project must be public.',
),
},
};

View File

@ -111,13 +111,6 @@ module Types
null: true,
description: 'Assignees of the alert.'
field :metrics_dashboard_url,
GraphQL::Types::String,
null: true,
description: 'URL for metrics embed for the alert.',
deprecated: { reason: 'Returns no data. Underlying feature was removed in 16.0',
milestone: '16.0' }
field :runbook,
GraphQL::Types::String,
null: true,
@ -143,12 +136,6 @@ module Types
method: :details_url,
null: false,
description: 'URL of the alert.'
def metrics_dashboard_url
return if Feature.enabled?(:remove_monitor_metrics)
object.metrics_dashboard_url
end
end
end
end

View File

@ -10,7 +10,7 @@ module AlertManagement
MARKDOWN_LINE_BREAK = " \n"
HORIZONTAL_LINE = "\n\n---\n\n"
delegate :metrics_dashboard_url, :runbook, to: :parsed_payload
delegate :runbook, to: :parsed_payload
def initialize(alert, **attributes)
super
@ -60,8 +60,7 @@ module AlertManagement
def issue_summary_markdown
<<~MARKDOWN.chomp
#{metadata_list}
#{metric_embed_for_alert}
#{metadata_list}\n
MARKDOWN
end
@ -80,10 +79,6 @@ module AlertManagement
metadata.join(MARKDOWN_LINE_BREAK)
end
def metric_embed_for_alert
"\n[](#{metrics_dashboard_url})" if metrics_dashboard_url
end
def list_item(key, value)
"**#{key}:** #{value}".strip
end

View File

@ -0,0 +1,11 @@
---
table_name: merge_request_review_llm_summaries
classes:
- MergeRequest::ReviewLlmSummary
feature_categories:
- code_review_workflow
description: This is the table that stores information about the review summaries
produced from different LLM's.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124402
milestone: '16.2'
gitlab_schema: gitlab_main

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class CreateMergeRequestReviewLlmSummary < Gitlab::Database::Migration[2.1]
INDEX_NAME = "index_merge_request_review_llm_summaries_on_mr_diff_id"
def change
create_table :merge_request_review_llm_summaries do |t|
t.references :user, null: true, index: true
t.references :review, null: false, index: true
t.references :merge_request_diff, null: false, index: { name: INDEX_NAME }
t.timestamps_with_timezone null: false
t.integer :provider, null: false, limit: 2
t.text :content, null: false, limit: 2056
end
end
end

View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
class AddUserForeignKeyToMergeRequestReviewLlmSummary < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
add_concurrent_foreign_key :merge_request_review_llm_summaries, :users, column: :user_id, on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key :merge_request_review_llm_summaries, column: :user_id
end
end
end

View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
class AddReviewForeignKeyToMergeRequestReviewLlmSummary < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
add_concurrent_foreign_key :merge_request_review_llm_summaries, :reviews, column: :review_id, on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key :merge_request_review_llm_summaries, column: :review_id
end
end
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddMergeRequestDiffForeignKeyToMergeRequestReviewLlmSummary < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
add_concurrent_foreign_key :merge_request_review_llm_summaries, :merge_request_diffs,
column: :merge_request_diff_id,
on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key :merge_request_review_llm_summaries, column: :merge_request_diff_id
end
end
end

View File

@ -0,0 +1,21 @@
# frozen_string_literal: true
class AddIndexToPoolRepositories < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
TABLE_NAME = :pool_repositories
OLD_INDEX_NAME = :index_pool_repositories_on_disk_path
NEW_INDEX_NAME = :unique_pool_repositories_on_disk_path_and_shard_id
def up
add_concurrent_index(TABLE_NAME, [:disk_path, :shard_id], name: NEW_INDEX_NAME, unique: true)
remove_concurrent_index_by_name(TABLE_NAME, OLD_INDEX_NAME)
end
def down
add_concurrent_index(TABLE_NAME, [:disk_path], name: OLD_INDEX_NAME, unique: true)
remove_concurrent_index_by_name(TABLE_NAME, NEW_INDEX_NAME)
end
end

View File

@ -0,0 +1 @@
b95691099886021c131b3ef04ce21a5610a31a635e9a95eee1d31a558b7dae8b

View File

@ -0,0 +1 @@
c171fb3fd46cd8b015bc173e94e3e413aefb9a2afa58d556e357454717978313

View File

@ -0,0 +1 @@
be537d6f8024b067c302cd96429d1bccca410c13c9ea4392c0642af4ddd4eb19

View File

@ -0,0 +1 @@
6d6e5a996e7a7abcf5f1b6e019a8e86a3d4e9aab0052c6f7620ff02091527229

View File

@ -0,0 +1 @@
22ab53f5c190f37f37a3e3e57742b1dde3c0c724492b63f938bfdcb7c2a09fa1

View File

@ -18220,6 +18220,27 @@ CREATE SEQUENCE merge_request_predictions_merge_request_id_seq
ALTER SEQUENCE merge_request_predictions_merge_request_id_seq OWNED BY merge_request_predictions.merge_request_id;
CREATE TABLE merge_request_review_llm_summaries (
id bigint NOT NULL,
user_id bigint,
review_id bigint NOT NULL,
merge_request_diff_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
provider smallint NOT NULL,
content text NOT NULL,
CONSTRAINT check_72802358e9 CHECK ((char_length(content) <= 2056))
);
CREATE SEQUENCE merge_request_review_llm_summaries_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE merge_request_review_llm_summaries_id_seq OWNED BY merge_request_review_llm_summaries.id;
CREATE TABLE merge_request_reviewers (
id bigint NOT NULL,
user_id bigint NOT NULL,
@ -25548,6 +25569,8 @@ ALTER TABLE ONLY merge_request_metrics ALTER COLUMN id SET DEFAULT nextval('merg
ALTER TABLE ONLY merge_request_predictions ALTER COLUMN merge_request_id SET DEFAULT nextval('merge_request_predictions_merge_request_id_seq'::regclass);
ALTER TABLE ONLY merge_request_review_llm_summaries ALTER COLUMN id SET DEFAULT nextval('merge_request_review_llm_summaries_id_seq'::regclass);
ALTER TABLE ONLY merge_request_reviewers ALTER COLUMN id SET DEFAULT nextval('merge_request_reviewers_id_seq'::regclass);
ALTER TABLE ONLY merge_request_user_mentions ALTER COLUMN id SET DEFAULT nextval('merge_request_user_mentions_id_seq'::regclass);
@ -27744,6 +27767,9 @@ ALTER TABLE ONLY merge_request_metrics
ALTER TABLE ONLY merge_request_predictions
ADD CONSTRAINT merge_request_predictions_pkey PRIMARY KEY (merge_request_id);
ALTER TABLE ONLY merge_request_review_llm_summaries
ADD CONSTRAINT merge_request_review_llm_summaries_pkey PRIMARY KEY (id);
ALTER TABLE ONLY merge_request_reviewers
ADD CONSTRAINT merge_request_reviewers_pkey PRIMARY KEY (id);
@ -31789,6 +31815,12 @@ CREATE INDEX index_merge_request_metrics_on_pipeline_id ON merge_request_metrics
CREATE INDEX index_merge_request_metrics_on_target_project_id ON merge_request_metrics USING btree (target_project_id);
CREATE INDEX index_merge_request_review_llm_summaries_on_mr_diff_id ON merge_request_review_llm_summaries USING btree (merge_request_diff_id);
CREATE INDEX index_merge_request_review_llm_summaries_on_review_id ON merge_request_review_llm_summaries USING btree (review_id);
CREATE INDEX index_merge_request_review_llm_summaries_on_user_id ON merge_request_review_llm_summaries USING btree (user_id);
CREATE UNIQUE INDEX index_merge_request_reviewers_on_merge_request_id_and_user_id ON merge_request_reviewers USING btree (merge_request_id, user_id);
CREATE INDEX index_merge_request_reviewers_on_user_id ON merge_request_reviewers USING btree (user_id);
@ -32339,8 +32371,6 @@ CREATE INDEX index_pm_package_version_licenses_on_pm_package_version_id ON pm_pa
CREATE INDEX index_pm_package_versions_on_pm_package_id ON pm_package_versions USING btree (pm_package_id);
CREATE UNIQUE INDEX index_pool_repositories_on_disk_path ON pool_repositories USING btree (disk_path);
CREATE INDEX index_pool_repositories_on_shard_id ON pool_repositories USING btree (shard_id);
CREATE UNIQUE INDEX index_pool_repositories_on_source_project_id_and_shard_id ON pool_repositories USING btree (source_project_id, shard_id);
@ -33695,6 +33725,8 @@ CREATE UNIQUE INDEX unique_organizations_on_path ON organizations USING btree (p
CREATE UNIQUE INDEX unique_packages_project_id_and_name_and_version_when_debian ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 9) AND (status <> 4));
CREATE UNIQUE INDEX unique_pool_repositories_on_disk_path_and_shard_id ON pool_repositories USING btree (disk_path, shard_id);
CREATE UNIQUE INDEX unique_postgres_async_fk_validations_name_and_table_name ON postgres_async_foreign_key_validations USING btree (name, table_name);
CREATE UNIQUE INDEX unique_projects_on_name_namespace_id ON projects USING btree (name, namespace_id);
@ -35644,6 +35676,9 @@ ALTER TABLE ONLY user_achievements
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_6149611a04 FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL;
ALTER TABLE ONLY merge_request_review_llm_summaries
ADD CONSTRAINT fk_6154a9cb89 FOREIGN KEY (review_id) REFERENCES reviews(id) ON DELETE CASCADE;
ALTER TABLE ONLY work_item_widget_definitions
ADD CONSTRAINT fk_61bfa96db5 FOREIGN KEY (work_item_type_id) REFERENCES work_item_types(id) ON DELETE CASCADE;
@ -35827,6 +35862,9 @@ ALTER TABLE ONLY releases
ALTER TABLE ONLY protected_tags
ADD CONSTRAINT fk_8e4af87648 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY merge_request_review_llm_summaries
ADD CONSTRAINT fk_8ec009c6ab FOREIGN KEY (merge_request_diff_id) REFERENCES merge_request_diffs(id) ON DELETE CASCADE;
ALTER TABLE ONLY todos
ADD CONSTRAINT fk_91d1f47b13 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
@ -36118,6 +36156,9 @@ ALTER TABLE ONLY custom_emoji
ALTER TABLE ONLY bulk_import_entities
ADD CONSTRAINT fk_d06d023c30 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY merge_request_review_llm_summaries
ADD CONSTRAINT fk_d07eeb6392 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE ONLY project_mirror_data
ADD CONSTRAINT fk_d1aad367d7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

View File

@ -289,7 +289,7 @@ To update a streaming destination's event filters:
1. Select **Secure > Audit events**.
1. On the main area, select the **Streams** tab.
1. Select the stream URL to expand.
1. Select **Filter by stream event**.
1. Locate the **Filter by audit event type** dropdown.
1. Select the dropdown list and select or clear the required event types.
1. Select **Save** to update the event filters.

View File

@ -31,6 +31,10 @@ If you have configured SAML on the primary site correctly, then it should work o
### SAML with separate URL with proxying enabled
NOTE:
When proxying is enabled, SAML can only be used to sign in the secondary site if your SAML Identity Provider (IdP) allows an
application to have multiple callback URLs configured. Check with your IdP provider support team to confirm if this is the case.
If a secondary site uses a different `external_url` to the primary site, then configure your SAML Identity Provider (IdP) to allow the secondary site's SAML callback URL. For example, to configure Okta:
1. [Sign in to Okta](https://www.okta.com/login/).

View File

@ -622,7 +622,7 @@ This happens on wrongly-formatted addresses in `postgresql['md5_auth_cidr_addres
```
To fix this, update the IP addresses in `/etc/gitlab/gitlab.rb` under `postgresql['md5_auth_cidr_addresses']`
to respect the CIDR format (that is, `1.2.3.4/32`).
to respect the CIDR format (for example, `10.0.0.1/32`).
### Message: `LOG: invalid IP mask "md5": Name or service not known`
@ -634,7 +634,7 @@ This happens when you have added IP addresses without a subnet mask in `postgres
```
To fix this, add the subnet mask in `/etc/gitlab/gitlab.rb` under `postgresql['md5_auth_cidr_addresses']`
to respect the CIDR format (that is, `1.2.3.4/32`).
to respect the CIDR format (for example, `10.0.0.1/32`).
### Message: `Found data in the gitlabhq_production database!` when running `gitlab-ctl replicate-geo-database`
@ -1295,7 +1295,7 @@ When [Geo proxying for secondary sites](../secondary_proxy/index.md) is enabled,
Check the NGINX logs for errors similar to this example:
```plaintext
2022/01/26 00:02:13 [error] 26641#0: *829148 upstream sent too big header while reading response header from upstream, client: 1.2.3.4, server: geo.staging.gitlab.com, request: "POST /users/sign_in HTTP/2.0", upstream: "http://unix:/var/opt/gitlab/gitlab-workhorse/sockets/socket:/users/sign_in", host: "geo.staging.gitlab.com", referrer: "https://geo.staging.gitlab.com/users/sign_in"
2022/01/26 00:02:13 [error] 26641#0: *829148 upstream sent too big header while reading response header from upstream, client: 10.0.2.2, server: geo.staging.gitlab.com, request: "POST /users/sign_in HTTP/2.0", upstream: "http://unix:/var/opt/gitlab/gitlab-workhorse/sockets/socket:/users/sign_in", host: "geo.staging.gitlab.com", referrer: "https://geo.staging.gitlab.com/users/sign_in"
```
To resolve this issue:
@ -1345,15 +1345,8 @@ To fix this issue, set the primary site's internal URL to a URL that is:
- Unique to the primary site.
- Accessible from all secondary sites.
1. Enter the [Rails console](../../operations/rails_console.md) on the primary site.
1. Run the following, replacing `https://unique.url.for.primary.site` with your specific internal URL.
For example, depending on your network configuration, you could use an IP address, like
`http://1.2.3.4`.
```ruby
GeoNode.where(primary: true).first.update!(internal_url: "https://unique.url.for.primary.site")
```
1. Visit the primary site.
1. [Set up the internal URLs](../../../user/admin_area/geo_sites.md#set-up-the-internal-urls).
### Secondary site returns `Received HTTP code 403 from proxy after CONNECT`

View File

@ -131,6 +131,10 @@ and cannot be configured per Geo site. Therefore, all runners clone from the pri
which Geo site they register on. For information about GitLab CI using a specific Geo secondary to clone from, see issue
[3294](https://gitlab.com/gitlab-org/gitlab/-/issues/3294#note_1009488466).
- When secondary proxying is used together with separate URLs,
[signing in the secondary site using SAML](../replication/single_sign_on.md#saml-with-separate-url-with-proxying-enabled)
is only supported if the SAML Identity Provider (IdP) allows an application to be configured with multiple callback URLs.
## Behavior of secondary sites when the primary Geo site is down
Considering that web traffic is proxied to the primary, the behavior of the secondary sites differs when the primary

View File

@ -1107,8 +1107,8 @@ For more information on Gitaly server configuration, see our
```ruby
# Configure the gitlab-shell API callback URL. Without this, `git push` will
# fail. This can be your front door GitLab URL or an internal load balancer.
# Examples: 'https://gitlab.example.com', 'http://1.2.3.4'
gitlab_rails['internal_api_url'] = 'http://GITLAB_HOST'
# Examples: 'https://gitlab.example.com', 'http://10.0.2.2'
gitlab_rails['internal_api_url'] = 'https://gitlab.example.com'
```
1. Configure the storage location for Git data by setting `gitaly['configuration'][:storage]` in

View File

@ -295,6 +295,7 @@ the configuration below accordingly.
PlantUML has features that allow fetching network resources. If you self-host the
PlantUML server, put network controls in place to isolate it.
For example, make use of PlantUML's [security profiles](https://plantuml.com/security).
```plaintext
@startuml

View File

@ -12109,7 +12109,6 @@ Describes an alert from the project's Alert Management.
| <a id="alertmanagementalertiid"></a>`iid` | [`ID!`](#id) | Internal ID of the alert. |
| <a id="alertmanagementalertissue"></a>`issue` | [`Issue`](#issue) | Issue attached to the alert. |
| <a id="alertmanagementalertissueiid"></a>`issueIid` **{warning-solid}** | [`ID`](#id) | **Deprecated** in 13.10. Use issue field. |
| <a id="alertmanagementalertmetricsdashboardurl"></a>`metricsDashboardUrl` **{warning-solid}** | [`String`](#string) | **Deprecated** in 16.0. Returns no data. Underlying feature was removed in 16.0. |
| <a id="alertmanagementalertmonitoringtool"></a>`monitoringTool` | [`String`](#string) | Monitoring tool the alert came from. |
| <a id="alertmanagementalertnotes"></a>`notes` | [`NoteConnection!`](#noteconnection) | All notes on this noteable. (see [Connections](#connections)) |
| <a id="alertmanagementalertprometheusalert"></a>`prometheusAlert` | [`PrometheusAlert`](#prometheusalert) | Alert condition for Prometheus. |

View File

@ -156,7 +156,7 @@ trusted network (ideally, from the private server itself):
ssh-keyscan example.com
## Or use an IP
ssh-keyscan 1.2.3.4
ssh-keyscan 10.0.2.2
```
Create a new [file type CI/CD variable](../variables/index.md#use-file-type-cicd-variables)

View File

@ -442,7 +442,7 @@ above error message.
To fix this, ensure that the forward and reverse DNS for your GitLab server
match. So for instance, if you access GitLab as `gitlab.example.com`, resolving
to IP address `1.2.3.4`, then `4.3.2.1.in-addr.arpa` must be a `PTR` record for
to IP address `10.0.2.2`, then `2.2.0.10.in-addr.arpa` must be a `PTR` record for
`gitlab.example.com`.
#### Missing Kerberos libraries on browser or client machine

View File

@ -54,17 +54,17 @@ Auto DevOps requires a wildcard DNS `A` record matching the base domains. For
a base domain of `example.com`, you'd need a DNS entry like:
```plaintext
*.example.com 3600 A 1.2.3.4
*.example.com 3600 A 10.0.2.2
```
In this case, the deployed applications are served from `example.com`, and `1.2.3.4`
In this case, the deployed applications are served from `example.com`, and `10.0.2.2`
is the IP address of your load balancer, generally NGINX ([see requirements](requirements.md)).
Setting up the DNS record is beyond the scope of this document; check with your
DNS provider for information.
Alternatively, you can use free public services like [nip.io](https://nip.io)
which provide automatic wildcard DNS without any configuration. For [nip.io](https://nip.io),
set the Auto DevOps base domain to `1.2.3.4.nip.io`.
set the Auto DevOps base domain to `10.0.2.2.nip.io`.
After completing setup, all requests hit the load balancer, which routes requests
to the Kubernetes pods running your application.

View File

@ -71,17 +71,17 @@ Auto DevOps requires a wildcard DNS `A` record that matches the base domains. Fo
a base domain of `example.com`, you'd need a DNS entry like:
```plaintext
*.example.com 3600 A 1.2.3.4
*.example.com 3600 A 10.0.2.2
```
In this case, the deployed applications are served from `example.com`, and `1.2.3.4`
In this case, the deployed applications are served from `example.com`, and `10.0.2.2`
is the IP address of your load balancer, generally NGINX ([see requirements](requirements.md)).
Setting up the DNS record is beyond the scope of this document; check with your
DNS provider for information.
Alternatively, you can use free public services like [nip.io](https://nip.io)
which provide automatic wildcard DNS without any configuration. For [nip.io](https://nip.io),
set the Auto DevOps base domain to `1.2.3.4.nip.io`.
set the Auto DevOps base domain to `10.0.2.2.nip.io`.
After completing setup, all requests hit the load balancer, which routes requests
to the Kubernetes pods running your application.

View File

@ -26,7 +26,7 @@ To connect a remote machine to the Web IDE, you must:
To generate Let's Encrypt certificates:
1. Create an `A` record to point a domain to your remote machine (for example, from `example.remote.gitlab.dev` to `1.2.3.4`).
1. Create an `A` record to point a domain to your remote machine (for example, from `example.remote.gitlab.dev` to `10.0.2.2`).
1. Install [Certbot](https://certbot.eff.org/) to enable HTTPS:
```shell

View File

@ -33,7 +33,6 @@ module Gitlab
:has_required_attributes?,
:hosts,
:metric_id,
:metrics_dashboard_url,
:monitoring_tool,
:resolved?,
:runbook,

View File

@ -35,18 +35,6 @@ module Gitlab
gitlab_alert&.environment || super
end
def metrics_dashboard_url
return unless gitlab_alert
metrics_dashboard_project_prometheus_alert_url(
project,
gitlab_alert.prometheus_metric_id,
environment_id: environment.id,
embedded: true,
**alert_embed_window_params
)
end
private
def plain_gitlab_fingerprint

View File

@ -96,29 +96,6 @@ module Gitlab
def plain_gitlab_fingerprint
[starts_at_raw, title, full_query].join('/')
end
# Formatted for parsing by JS
def alert_embed_window_params
{
start: (starts_at - METRIC_TIME_WINDOW).utc.strftime('%FT%TZ'),
end: (starts_at + METRIC_TIME_WINDOW).utc.strftime('%FT%TZ')
}
end
def dashboard_json
{
panel_groups: [{
panels: [{
type: 'area-chart',
title: title,
y_label: gitlab_y_label,
metrics: [{
query_range: full_query
}]
}]
}]
}.to_json
end
end
end
end

View File

@ -6585,7 +6585,7 @@ msgstr ""
msgid "AuditStreams|Event filtering (optional)"
msgstr ""
msgid "AuditStreams|Filter by stream event"
msgid "AuditStreams|Filter by audit event type"
msgstr ""
msgid "AuditStreams|Header"
@ -46299,6 +46299,9 @@ msgstr ""
msgid "The snippet can be accessed without any authentication."
msgstr ""
msgid "The snippet can be accessed without any authentication. To embed snippets, a project must be public."
msgstr ""
msgid "The snippet is visible only to me."
msgstr ""

View File

@ -134,6 +134,17 @@ describe('Snippet Visibility Edit component', () => {
description: SNIPPET_VISIBILITY.private.description_project,
});
});
it('when project snippet, renders special public description', () => {
createComponent({ propsData: { isProjectSnippet: true }, deep: true });
expect(findRadiosData()[2]).toEqual({
value: VISIBILITY_LEVEL_PUBLIC_STRING,
icon: SNIPPET_VISIBILITY.public.icon,
text: SNIPPET_VISIBILITY.public.label,
description: SNIPPET_VISIBILITY.public.description_project,
});
});
});
});

View File

@ -31,7 +31,6 @@ RSpec.describe GitlabSchema.types['AlertManagementAlert'], feature_category: :in
assignees
notes
discussions
metrics_dashboard_url
runbook
todos
details_url

View File

@ -150,20 +150,4 @@ RSpec.describe Gitlab::AlertManagement::Payload::ManagedPrometheus do
it { is_expected.to eq(environment) }
end
end
describe '#metrics_dashboard_url' do
subject { parsed_payload.metrics_dashboard_url }
context 'without alert' do
it { is_expected.to be_nil }
end
context 'with gitlab alert' do
include_context 'gitlab-managed prometheus alert attributes' do
let(:raw_payload) { payload }
end
it { is_expected.to eq(dashboard_url_for_alert) }
end
end
end

View File

@ -178,32 +178,6 @@ RSpec.describe Gitlab::AlertManagement::Payload::Prometheus do
end
end
describe '#metrics_dashboard_url' do
include_context 'self-managed prometheus alert attributes' do
let(:raw_payload) { payload }
end
subject { parsed_payload.metrics_dashboard_url }
context 'without environment' do
let(:raw_payload) { payload.except('labels') }
it { is_expected.to be_nil }
end
context 'without full query' do
let(:raw_payload) { payload.except('generatorURL') }
it { is_expected.to be_nil }
end
context 'without title' do
let(:raw_payload) { payload.except('annotations') }
it { is_expected.to be_nil }
end
end
describe '#has_required_attributes?' do
let(:starts_at) { Time.current.change(usec: 0).utc }
let(:raw_payload) { { 'annotations' => { 'title' => 'title' }, 'startsAt' => starts_at.rfc3339 } }

View File

@ -91,24 +91,6 @@ RSpec.describe AlertManagement::AlertPresenter do
)
end
end
context 'with metrics_dashboard_url' do
before do
allow(alert.parsed_payload).to receive(:metrics_dashboard_url).and_return('https://gitlab.com/metrics')
end
it do
is_expected.to eq(
<<~MARKDOWN.chomp
**Start time:** #{presenter.start_time}#{markdown_line_break}
**Severity:** #{presenter.severity}#{markdown_line_break}
**GitLab alert:** #{alert_url}
[](https://gitlab.com/metrics)
MARKDOWN
)
end
end
end
describe '#start_time' do

View File

@ -1,79 +0,0 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'getting Alert Management Alert Assignees', feature_category: :incident_management do
include GraphqlHelpers
let_it_be(:project) { create(:project) }
let_it_be(:current_user) { create(:user) }
let(:fields) do
<<~QUERY
nodes {
iid
metricsDashboardUrl
}
QUERY
end
let(:graphql_query) do
graphql_query_for(
'project',
{ 'fullPath' => project.full_path },
query_graphql_field('alertManagementAlerts', {}, fields)
)
end
let(:alerts) { graphql_data.dig('project', 'alertManagementAlerts', 'nodes') }
let(:first_alert) { alerts.first }
before do
stub_feature_flags(remove_monitor_metrics: false)
project.add_developer(current_user)
end
context 'with self-managed prometheus payload' do
include_context 'self-managed prometheus alert attributes'
before do
create(:alert_management_alert, :prometheus, project: project, payload: payload)
end
context 'when metrics dashboard feature is unavailable' do
before do
stub_feature_flags(remove_monitor_metrics: true)
end
it 'returns nil' do
post_graphql(graphql_query, current_user: current_user)
expect(first_alert['metricsDashboardUrl']).to be_nil
end
end
end
context 'with gitlab-managed prometheus payload' do
include_context 'gitlab-managed prometheus alert attributes'
before do
create(:alert_management_alert, :prometheus, project: project, payload: payload, prometheus_alert: prometheus_alert)
end
it 'includes the correct metrics dashboard url' do
post_graphql(graphql_query, current_user: current_user)
expect(first_alert).to include('metricsDashboardUrl' => dashboard_url_for_alert)
end
context 'when metrics dashboard feature is unavailable' do
before do
stub_feature_flags(remove_monitor_metrics: true)
end
it 'returns nil' do
post_graphql(graphql_query, current_user: current_user)
expect(first_alert['metricsDashboardUrl']).to be_nil
end
end
end
end

View File

@ -74,7 +74,6 @@ RSpec.describe 'getting Alert Management Alerts', feature_category: :incident_ma
'details' => { 'custom.alert' => 'payload', 'runbook' => 'runbook' },
'createdAt' => triggered_alert.created_at.strftime('%Y-%m-%dT%H:%M:%SZ'),
'updatedAt' => triggered_alert.updated_at.strftime('%Y-%m-%dT%H:%M:%SZ'),
'metricsDashboardUrl' => nil,
'detailsUrl' => triggered_alert.details_url,
'prometheusAlert' => nil,
'runbook' => 'runbook'