Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-07-08 21:08:40 +00:00
parent b9664970c3
commit 79959cb5bc
42 changed files with 198 additions and 222 deletions

View File

@ -281,7 +281,6 @@ Layout/FirstArrayElementIndentation:
- 'spec/models/ci/pipeline_spec.rb'
- 'spec/models/ci/unit_test_spec.rb'
- 'spec/models/clusters/applications/cert_manager_spec.rb'
- 'spec/models/clusters/applications/elastic_stack_spec.rb'
- 'spec/models/clusters/platforms/kubernetes_spec.rb'
- 'spec/models/commit_collection_spec.rb'
- 'spec/models/compare_spec.rb'

View File

@ -264,7 +264,6 @@ Layout/SpaceInsideBlockBraces:
- 'lib/gitlab/contributions_calendar.rb'
- 'lib/gitlab/database/migrations/test_background_runner.rb'
- 'lib/gitlab/database/postgres_hll/buckets.rb'
- 'lib/gitlab/elasticsearch/logs/lines.rb'
- 'lib/gitlab/email/message/in_product_marketing/helper.rb'
- 'lib/gitlab/issues/rebalancing/state.rb'
- 'lib/gitlab/profiler.rb'
@ -552,7 +551,6 @@ Layout/SpaceInsideBlockBraces:
- 'spec/models/ci/pipeline_schedule_spec.rb'
- 'spec/models/ci/pipeline_spec.rb'
- 'spec/models/ci/runner_spec.rb'
- 'spec/models/clusters/applications/elastic_stack_spec.rb'
- 'spec/models/clusters/cluster_spec.rb'
- 'spec/models/commit_status_spec.rb'
- 'spec/models/concerns/chronic_duration_attribute_spec.rb'

View File

@ -8,7 +8,6 @@ Rails/FilePath:
- 'app/controllers/help_controller.rb'
- 'app/helpers/startupjs_helper.rb'
- 'app/models/clusters/applications/cert_manager.rb'
- 'app/models/clusters/applications/elastic_stack.rb'
- 'app/models/clusters/concerns/application_data.rb'
- 'app/models/concerns/cross_database_modification.rb'
- 'app/models/release_highlight.rb'

View File

@ -31,7 +31,6 @@ Rails/InverseOf:
- 'app/models/clusters/applications/runner.rb'
- 'app/models/clusters/cluster.rb'
- 'app/models/clusters/concerns/application_core.rb'
- 'app/models/clusters/integrations/elastic_stack.rb'
- 'app/models/clusters/integrations/prometheus.rb'
- 'app/models/clusters/project.rb'
- 'app/models/commit_signatures/x509_commit_signature.rb'

View File

@ -19,7 +19,6 @@ Rails/RedundantForeignKey:
- 'app/models/ci/unit_test_failure.rb'
- 'app/models/clusters/applications/runner.rb'
- 'app/models/clusters/concerns/application_core.rb'
- 'app/models/clusters/integrations/elastic_stack.rb'
- 'app/models/clusters/integrations/prometheus.rb'
- 'app/models/commit_signatures/x509_commit_signature.rb'
- 'app/models/concerns/analytics/cycle_analytics/stage.rb'

View File

@ -2640,7 +2640,6 @@ RSpec/ContextWording:
- 'spec/models/clusters/agent_spec.rb'
- 'spec/models/clusters/applications/cert_manager_spec.rb'
- 'spec/models/clusters/applications/crossplane_spec.rb'
- 'spec/models/clusters/applications/elastic_stack_spec.rb'
- 'spec/models/clusters/applications/helm_spec.rb'
- 'spec/models/clusters/applications/ingress_spec.rb'
- 'spec/models/clusters/applications/jupyter_spec.rb'

View File

@ -165,8 +165,6 @@ Style/PercentLiteralDelimiters:
- 'app/services/merge_requests/update_service.rb'
- 'app/services/metrics/dashboard/default_embed_service.rb'
- 'app/services/packages/debian/generate_distribution_service.rb'
- 'app/services/pod_logs/base_service.rb'
- 'app/services/pod_logs/elasticsearch_service.rb'
- 'app/services/preview_markdown_service.rb'
- 'app/services/projects/apple_target_platform_detector_service.rb'
- 'app/services/projects/container_repository/cleanup_tags_service.rb'
@ -673,7 +671,6 @@ Style/PercentLiteralDelimiters:
- 'spec/factories/ci/runners.rb'
- 'spec/factories/clusters/applications/helm.rb'
- 'spec/factories/clusters/clusters.rb'
- 'spec/factories/clusters/integrations/elastic_stack.rb'
- 'spec/factories/clusters/integrations/prometheus.rb'
- 'spec/factories/clusters/providers/aws.rb'
- 'spec/factories/deployments.rb'

View File

@ -128,10 +128,6 @@
> li {
display: inline-block;
&:not(:last-child) {
margin-right: $gl-padding;
}
&.right {
vertical-align: top;
margin-top: 0;
@ -179,7 +175,6 @@
}
.btn {
margin-bottom: $gl-padding-8;
padding: $gl-btn-vert-padding $gl-btn-padding;
line-height: $gl-btn-line-height;
@ -190,12 +185,6 @@
}
}
.project-buttons {
.nav > li:not(:last-child) {
margin-right: $gl-padding-8;
}
}
.git-empty {
margin-bottom: 7px;

View File

@ -9,7 +9,6 @@ module Users
FEATURE_FLAGS_NEW_VERSION = 'feature_flags_new_version'
REGISTRATION_ENABLED_CALLOUT = 'registration_enabled_callout'
UNFINISHED_TAG_CLEANUP_CALLOUT = 'unfinished_tag_cleanup_callout'
MINUTE_LIMIT_BANNER = 'minute_limit_banner'
SECURITY_NEWSLETTER_CALLOUT = 'security_newsletter_callout'
REGISTRATION_ENABLED_CALLOUT_ALLOWED_CONTROLLER_PATHS = [/^root/, /^dashboard\S*/, /^admin\S*/].freeze
@ -61,10 +60,6 @@ module Users
!user_dismissed?(SECURITY_NEWSLETTER_CALLOUT)
end
def minute_limit_banner_dismissed?
user_dismissed?(MINUTE_LIMIT_BANNER)
end
private
def user_dismissed?(feature_name, ignore_dismissal_earlier_than = nil)

View File

@ -49,7 +49,9 @@ module Users
storage_enforcement_banner_fourth_enforcement_threshold: 46,
attention_requests_top_nav: 47,
attention_requests_side_nav: 48,
minute_limit_banner: 49,
# 49 was removed with https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91533
# because the banner was no longer relevant.
# Records will be migrated with https://gitlab.com/gitlab-org/gitlab/-/issues/367293
preview_user_over_limit_free_plan_alert: 50, # EE-only
user_reached_limit_free_plan_alert: 51, # EE-only
submit_license_usage_data_banner: 52, # EE-only

View File

@ -316,6 +316,7 @@ class WikiPage
end
def update_front_matter(attrs)
return unless Gitlab::WikiPages::FrontMatterParser.enabled?(container)
return unless attrs.has_key?(:front_matter)
fm_yaml = serialize_front_matter(attrs[:front_matter])
@ -326,7 +327,7 @@ class WikiPage
def parsed_content
strong_memoize(:parsed_content) do
Gitlab::WikiPages::FrontMatterParser.new(raw_content).parse
Gitlab::WikiPages::FrontMatterParser.new(raw_content, container).parse
end
end

View File

@ -16,7 +16,7 @@
#js-code-owners
- if is_project_overview
.project-buttons.gl-mb-3.js-show-on-project-root
.project-buttons.gl-mb-5.js-show-on-project-root
= render 'stat_anchor_list', anchors: @project.statistics_buttons(show_auto_devops_callout: show_auto_devops_callout), project_buttons: true
#js-tree-list{ data: vue_file_list_data(project, ref) }

View File

@ -2,7 +2,7 @@
- project_buttons = local_assigns.fetch(:project_buttons, false)
- return unless anchors.any?
%ul.nav
%ul.nav.gl-gap-3
- anchors.each do |anchor|
%li.nav-item
= link_to_if(anchor.link, anchor.label, anchor.link, stat_anchor_attrs(anchor)) do

View File

@ -1,5 +1,4 @@
- page_title _("Activity")
= render_if_exists 'shared/minute_limit_banner', namespace: @project
= render 'projects/last_push'
= render 'projects/activity'

View File

@ -5,8 +5,6 @@
- expanded = expanded_by_default?
- reduce_visibility_form_id = 'reduce-visibility-form'
= render_if_exists 'shared/minute_limit_banner', namespace: @project
%section.settings.general-settings.no-animate.expanded#js-general-settings
.settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Naming, topics, avatar')

View File

@ -4,7 +4,6 @@
- subscribed = params[:subscribed]
- labels_or_filters = @labels.exists? || @prioritized_labels.exists? || search.present? || subscribed.present?
= render_if_exists 'shared/minute_limit_banner', namespace: @project
- if labels_or_filters
#js-promote-label-modal
= render 'shared/labels/nav', labels_or_filters: labels_or_filters, can_admin_label: can_admin_label

View File

@ -2,7 +2,6 @@
- page_title _("Members")
= render_if_exists 'projects/free_user_cap_alert', project: @project
= render_if_exists 'shared/minute_limit_banner', namespace: @project
.row.gl-mt-3
.col-lg-12

View File

@ -7,7 +7,6 @@
= auto_discovery_link_tag(:atom, project_path(@project, rss_url_options), title: "#{@project.name} activity")
= render_if_exists 'projects/free_user_cap_alert', project: @project
= render_if_exists 'shared/minute_limit_banner', namespace: @project
= render partial: 'flash_messages', locals: { project: @project }
= render 'clusters_deprecation_alert'

View File

@ -1,8 +0,0 @@
---
name: show_minute_limit_banner
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84644
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/358191
milestone: '14.10'
type: development
group: group::workspace
default_enabled: false

View File

@ -0,0 +1,8 @@
---
name: wiki_front_matter
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27706
rollout_issue_url:
milestone: '12.10'
type: development
group: group::editor
default_enabled: false

View File

@ -1,9 +0,0 @@
---
table_name: clusters_applications_elastic_stacks
classes:
- Clusters::Applications::ElasticStack
feature_categories:
- kubernetes_management
description: (Deprecated) A GitLab managed Elastic Stack installation in a Kubernetes cluster
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/18015
milestone: '12.5'

View File

@ -1,9 +0,0 @@
---
table_name: clusters_integration_elasticstack
classes:
- Clusters::Integrations::ElasticStack
feature_categories:
- configure
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61077
milestone: '13.12'

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class RemoveForeignKeyInClustersApplicationsElasticStacks < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
def up
with_lock_retries do
remove_foreign_key_if_exists(:clusters_applications_elastic_stacks, column: :cluster_id)
end
end
def down
add_concurrent_foreign_key :clusters_applications_elastic_stacks, :clusters,
column: :cluster_id, on_delete: :cascade, name: 'fk_rails_026f219f46'
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class RemoveForeignKeyInClustersIntegrationElasticstack < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
def up
with_lock_retries do
remove_foreign_key_if_exists(:clusters_integration_elasticstack, column: :cluster_id)
end
end
def down
add_concurrent_foreign_key :clusters_integration_elasticstack, :clusters,
column: :cluster_id, on_delete: :cascade, name: 'fk_rails_cc5ba8f658'
end
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class DropClustersApplicationsElasticStacksTable < Gitlab::Database::Migration[2.0]
def up
drop_table :clusters_applications_elastic_stacks
end
def down
create_table :clusters_applications_elastic_stacks do |t|
t.timestamps_with_timezone null: false
t.references :cluster, type: :bigint, null: false, index: { unique: true }
t.integer :status, null: false
t.string :version, null: false, limit: 255
t.text :status_reason
end
end
end

View File

@ -0,0 +1,22 @@
# frozen_string_literal: true
class DropClustersIntegrationElasticstackTable < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
INDEX_NAME = 'index_clusters_integration_elasticstack_enabled'
def up
drop_table :clusters_integration_elasticstack
end
def down
create_table :clusters_integration_elasticstack, id: false do |t|
t.timestamps_with_timezone null: false
t.references :cluster, primary_key: true, type: :bigint, default: nil, index: false
t.boolean :enabled, null: false, default: false
t.text :chart_version, limit: 10
end
add_concurrent_index(:clusters_integration_elasticstack, [:enabled, :created_at, :cluster_id], name: INDEX_NAME)
end
end

View File

@ -0,0 +1 @@
3583de8dc55a1e9835b64542bb11a94084d34c2409f63cd7e402bd3c5c0009ef

View File

@ -0,0 +1 @@
eab26142f1314caa9ff6a6f07b6c787d276653d9bf6702bce9355c0e9605a909

View File

@ -0,0 +1 @@
7bf55a7614afcb210b22df1ea38cf16fde9510bbe66d9b19f0fb63d668ac4e72

View File

@ -0,0 +1 @@
ed72bfafe1c04826ce57b9068c537df563bc193f231f4f223348b084c68a8bde

View File

@ -13619,25 +13619,6 @@ CREATE SEQUENCE clusters_applications_crossplane_id_seq
ALTER SEQUENCE clusters_applications_crossplane_id_seq OWNED BY clusters_applications_crossplane.id;
CREATE TABLE clusters_applications_elastic_stacks (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
cluster_id bigint NOT NULL,
status integer NOT NULL,
version character varying(255) NOT NULL,
status_reason text
);
CREATE SEQUENCE clusters_applications_elastic_stacks_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE clusters_applications_elastic_stacks_id_seq OWNED BY clusters_applications_elastic_stacks.id;
CREATE TABLE clusters_applications_helm (
id integer NOT NULL,
cluster_id integer NOT NULL,
@ -13779,15 +13760,6 @@ CREATE SEQUENCE clusters_id_seq
ALTER SEQUENCE clusters_id_seq OWNED BY clusters.id;
CREATE TABLE clusters_integration_elasticstack (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
cluster_id bigint NOT NULL,
enabled boolean DEFAULT false NOT NULL,
chart_version text,
CONSTRAINT check_f8d671ce04 CHECK ((char_length(chart_version) <= 10))
);
CREATE TABLE clusters_integration_prometheus (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
@ -22925,8 +22897,6 @@ ALTER TABLE ONLY clusters_applications_cilium ALTER COLUMN id SET DEFAULT nextva
ALTER TABLE ONLY clusters_applications_crossplane ALTER COLUMN id SET DEFAULT nextval('clusters_applications_crossplane_id_seq'::regclass);
ALTER TABLE ONLY clusters_applications_elastic_stacks ALTER COLUMN id SET DEFAULT nextval('clusters_applications_elastic_stacks_id_seq'::regclass);
ALTER TABLE ONLY clusters_applications_helm ALTER COLUMN id SET DEFAULT nextval('clusters_applications_helm_id_seq'::regclass);
ALTER TABLE ONLY clusters_applications_ingress ALTER COLUMN id SET DEFAULT nextval('clusters_applications_ingress_id_seq'::regclass);
@ -24687,9 +24657,6 @@ ALTER TABLE ONLY clusters_applications_cilium
ALTER TABLE ONLY clusters_applications_crossplane
ADD CONSTRAINT clusters_applications_crossplane_pkey PRIMARY KEY (id);
ALTER TABLE ONLY clusters_applications_elastic_stacks
ADD CONSTRAINT clusters_applications_elastic_stacks_pkey PRIMARY KEY (id);
ALTER TABLE ONLY clusters_applications_helm
ADD CONSTRAINT clusters_applications_helm_pkey PRIMARY KEY (id);
@ -24708,9 +24675,6 @@ ALTER TABLE ONLY clusters_applications_prometheus
ALTER TABLE ONLY clusters_applications_runners
ADD CONSTRAINT clusters_applications_runners_pkey PRIMARY KEY (id);
ALTER TABLE ONLY clusters_integration_elasticstack
ADD CONSTRAINT clusters_integration_elasticstack_pkey PRIMARY KEY (cluster_id);
ALTER TABLE ONLY clusters_integration_prometheus
ADD CONSTRAINT clusters_integration_prometheus_pkey PRIMARY KEY (cluster_id);
@ -27812,8 +27776,6 @@ CREATE UNIQUE INDEX index_clusters_applications_cilium_on_cluster_id ON clusters
CREATE UNIQUE INDEX index_clusters_applications_crossplane_on_cluster_id ON clusters_applications_crossplane USING btree (cluster_id);
CREATE UNIQUE INDEX index_clusters_applications_elastic_stacks_on_cluster_id ON clusters_applications_elastic_stacks USING btree (cluster_id);
CREATE UNIQUE INDEX index_clusters_applications_helm_on_cluster_id ON clusters_applications_helm USING btree (cluster_id);
CREATE UNIQUE INDEX index_clusters_applications_ingress_on_cluster_id ON clusters_applications_ingress USING btree (cluster_id);
@ -27830,8 +27792,6 @@ CREATE UNIQUE INDEX index_clusters_applications_runners_on_cluster_id ON cluster
CREATE INDEX index_clusters_applications_runners_on_runner_id ON clusters_applications_runners USING btree (runner_id);
CREATE INDEX index_clusters_integration_elasticstack_enabled ON clusters_integration_elasticstack USING btree (enabled, created_at, cluster_id);
CREATE INDEX index_clusters_integration_prometheus_enabled ON clusters_integration_prometheus USING btree (enabled, created_at, cluster_id);
CREATE INDEX index_clusters_kubernetes_namespaces_on_cluster_project_id ON clusters_kubernetes_namespaces USING btree (cluster_project_id);
@ -32514,9 +32474,6 @@ ALTER TABLE ONLY approval_merge_request_rules
ALTER TABLE ONLY namespace_statistics
ADD CONSTRAINT fk_rails_0062050394 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY clusters_applications_elastic_stacks
ADD CONSTRAINT fk_rails_026f219f46 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
ALTER TABLE ONLY incident_management_oncall_participants
ADD CONSTRAINT fk_rails_032b12996a FOREIGN KEY (oncall_rotation_id) REFERENCES incident_management_oncall_rotations(id) ON DELETE CASCADE;
@ -33777,9 +33734,6 @@ ALTER TABLE ONLY boards_epic_board_positions
ALTER TABLE ONLY vulnerability_finding_links
ADD CONSTRAINT fk_rails_cbdfde27ce FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
ALTER TABLE ONLY clusters_integration_elasticstack
ADD CONSTRAINT fk_rails_cc5ba8f658 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
ALTER TABLE ONLY issues_self_managed_prometheus_alert_events
ADD CONSTRAINT fk_rails_cc5d88bbb0 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

View File

@ -20159,7 +20159,6 @@ Name of the feature that the callout is for.
| <a id="usercalloutfeaturenameenumgeo_migrate_hashed_storage"></a>`GEO_MIGRATE_HASHED_STORAGE` | Callout feature name for geo_migrate_hashed_storage. |
| <a id="usercalloutfeaturenameenumgke_cluster_integration"></a>`GKE_CLUSTER_INTEGRATION` | Callout feature name for gke_cluster_integration. |
| <a id="usercalloutfeaturenameenumgold_trial_billings"></a>`GOLD_TRIAL_BILLINGS` | Callout feature name for gold_trial_billings. |
| <a id="usercalloutfeaturenameenumminute_limit_banner"></a>`MINUTE_LIMIT_BANNER` | Callout feature name for minute_limit_banner. |
| <a id="usercalloutfeaturenameenummr_experience_survey"></a>`MR_EXPERIENCE_SURVEY` | Callout feature name for mr_experience_survey. |
| <a id="usercalloutfeaturenameenumnew_user_signups_cap_reached"></a>`NEW_USER_SIGNUPS_CAP_REACHED` | Callout feature name for new_user_signups_cap_reached. |
| <a id="usercalloutfeaturenameenumpersonal_access_token_expiry"></a>`PERSONAL_ACCESS_TOKEN_EXPIRY` | Callout feature name for personal_access_token_expiry. |

View File

@ -133,9 +133,7 @@ On GitLab.com, this feature is available.
{"name"=>"counts.clusters_platforms_user",
"time_elapsed"=>0.06410990096628666},
{"name"=>"counts.clusters_management_project",
"time_elapsed"=>0.24020783510059118},
{"name"=>"counts.clusters_integrations_elastic_stack",
"time_elapsed"=>0.03484998410567641}
"time_elapsed"=>0.24020783510059118}
]
}
}

View File

@ -26,6 +26,16 @@ You can use [this query](https://gitlab.com/gitlab-org/gitlab/-/issues/347298#no
For results about an investigation conducted into an unexpected drop in Service ping Payload events volume, see [this issue](https://gitlab.com/gitlab-data/analytics/-/issues/11071).
### Troubleshoot VersionApp layer
Check if the [export jobs](https://gitlab.com/gitlab-services/version-gitlab-com#data-export-using-pipeline-schedules) are successful.
Check [Service Ping errors](https://app.periscopedata.com/app/gitlab/968489/Product-Intelligence---Service-Ping-Health?widget=14609989&udv=0) in the [Service Ping Health Dahsboard](https://app.periscopedata.com/app/gitlab/968489/Product-Intelligence---Service-Ping-Health).
### Troubleshoot Google Storage layer
Check if the files are present in [Google Storage](https://console.cloud.google.com/storage/browser/cloudsql-gs-production-efd5e8-cloudsql-exports;tab=objects?project=gs-production-efd5e8&prefix=&forceOnObjectsSortingFiltering=false).
### Troubleshoot the data warehouse layer
Reach out to the [Data team](https://about.gitlab.com/handbook/business-technology/data-team/) to ask about current state of data warehouse. On their handbook page there is a [section with contact details](https://about.gitlab.com/handbook/business-technology/data-team/#how-to-connect-with-us).

View File

@ -252,15 +252,6 @@ security issues:
- A software license compliance violation. For more details, read
[Enabling license approvals within a project](../compliance/license_compliance/index.md#enabling-license-approvals-within-a-project).
### Migration of existing Vulnerability-Check rules
If your projects have rules that have a security orchestration project, a new MR with
the existing rule's content is created automatically against the default branch belonging
to the security orchestration project. To maintain the same security approval rules you
had before GitLab 15.0, we recommend merging this new MR.
If your projects have rules without a security orchestration project, a new security orchestration project is created automatically with the content of the existing rule. No additional action is required.
## Using private Maven repositories
If you have a private Apache Maven repository that requires login credentials,

View File

@ -133,7 +133,6 @@ cluster_providers_gcp: :gitlab_main
clusters_applications_cert_managers: :gitlab_main
clusters_applications_cilium: :gitlab_main
clusters_applications_crossplane: :gitlab_main
clusters_applications_elastic_stacks: :gitlab_main
clusters_applications_helm: :gitlab_main
clusters_applications_ingress: :gitlab_main
clusters_applications_jupyter: :gitlab_main
@ -141,7 +140,6 @@ clusters_applications_knative: :gitlab_main
clusters_applications_prometheus: :gitlab_main
clusters_applications_runners: :gitlab_main
clusters: :gitlab_main
clusters_integration_elasticstack: :gitlab_main
clusters_integration_prometheus: :gitlab_main
clusters_kubernetes_namespaces: :gitlab_main
commit_user_mentions: :gitlab_main

View File

@ -3,6 +3,8 @@
module Gitlab
module WikiPages
class FrontMatterParser
FEATURE_FLAG = :wiki_front_matter
# We limit the maximum length of text we are prepared to parse as YAML, to
# avoid exploitations and attempts to consume memory and CPU. We allow for:
# - a title line
@ -28,12 +30,18 @@ module Gitlab
end
# @param [String] wiki_content
def initialize(wiki_content)
# @param [FeatureGate] feature_gate The scope for feature availability
def initialize(wiki_content, feature_gate)
@wiki_content = wiki_content
@feature_gate = feature_gate
end
def self.enabled?(gate = nil)
Feature.enabled?(FEATURE_FLAG, gate)
end
def parse
return empty_result unless wiki_content.present?
return empty_result unless enabled? && wiki_content.present?
return empty_result(block.error) unless block.valid?
Result.new(front_matter: block.data, content: strip_front_matter_block)
@ -86,12 +94,16 @@ module Gitlab
private
attr_reader :wiki_content
attr_reader :wiki_content, :feature_gate
def empty_result(reason = nil, error = nil)
Result.new(content: wiki_content, reason: reason, error: error)
end
def enabled?
self.class.enabled?(feature_gate)
end
def block
@block ||= parse_front_matter_block
end

View File

@ -5856,9 +5856,6 @@ msgstr ""
msgid "Be careful. Renaming a project's repository can have unintended side effects."
msgstr ""
msgid "Before July 1, 2022, all free tier public open source projects must %{enrollment_link} to continue to receive GitLab Ultimate benefits."
msgstr ""
msgid "Before enabling this integration, create a webhook for the room in Google Chat where you want to receive notifications from this project. %{docs_link}"
msgstr ""
@ -7532,9 +7529,6 @@ msgstr ""
msgid "Changes the title to \"%{title_param}\"."
msgstr ""
msgid "Changes to free tier open source projects"
msgstr ""
msgid "Changes to the title have not been saved"
msgstr ""
@ -16521,9 +16515,6 @@ msgstr ""
msgid "For more information, go to the "
msgstr ""
msgid "For more information, see the %{faq_link}."
msgstr ""
msgid "For more information, see the File Hooks documentation."
msgstr ""

View File

@ -3,10 +3,11 @@
require 'spec_helper'
RSpec.describe Gitlab::WikiPages::FrontMatterParser do
subject(:parser) { described_class.new(raw_content) }
subject(:parser) { described_class.new(raw_content, gate) }
let(:content) { 'This is the content' }
let(:end_divider) { '---' }
let(:gate) { stub_feature_flag_gate('Gate') }
let(:with_front_matter) do
<<~MD
@ -61,6 +62,32 @@ RSpec.describe Gitlab::WikiPages::FrontMatterParser do
it { is_expected.to have_attributes(reason: :no_match) }
end
context 'the feature flag is disabled' do
let(:raw_content) { with_front_matter }
before do
stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => false)
end
it { is_expected.to have_attributes(front_matter: be_empty, content: raw_content) }
end
context 'the feature flag is enabled for the gated object' do
let(:raw_content) { with_front_matter }
before do
stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => gate)
end
it do
is_expected.to have_attributes(
front_matter: have_correct_front_matter,
content: content + "\n",
reason: be_nil
)
end
end
context 'the end divider is ...' do
let(:end_divider) { '...' }
let(:raw_content) { with_front_matter }

View File

@ -24,6 +24,14 @@ RSpec.describe WikiPage do
container.wiki
end
def disable_front_matter
stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => false)
end
def enable_front_matter_for(thing)
stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => thing)
end
# Use for groups of tests that do not modify their `subject`.
#
# include_context 'subject is persisted page', title: 'my title'
@ -40,6 +48,12 @@ RSpec.describe WikiPage do
it { expect(wiki_page).to have_attributes(front_matter: {}, content: content) }
end
shared_examples 'a page with front-matter' do
let(:front_matter) { { title: 'Foo', slugs: %w[slug_a slug_b] } }
it { expect(wiki_page.front_matter).to eq(front_matter) }
end
context 'the wiki page has front matter' do
let(:content) do
<<~MD
@ -54,13 +68,27 @@ RSpec.describe WikiPage do
MD
end
it 'has front-matter' do
expect(wiki_page.front_matter).to eq({ title: 'Foo', slugs: %w[slug_a slug_b] })
end
it_behaves_like 'a page with front-matter'
it 'strips the front matter from the content' do
expect(wiki_page.content.strip).to eq('My actual content')
end
context 'the feature flag is off' do
before do
disable_front_matter
end
it_behaves_like 'a page without front-matter'
context 'but enabled for the container' do
before do
enable_front_matter_for(container)
end
it_behaves_like 'a page with front-matter'
end
end
end
context 'the wiki page does not have front matter' do
@ -443,6 +471,29 @@ RSpec.describe WikiPage do
end
end
context 'the front-matter feature flag is not enabled' do
before do
disable_front_matter
end
it 'does not update the front-matter' do
content = subject.content
subject.update(front_matter: { slugs: ['x'] })
page = wiki.find_page(subject.title)
expect([subject, page]).to all(have_attributes(front_matter: be_empty, content: content))
end
context 'but it is enabled for the container' do
before do
enable_front_matter_for(container)
end
it_behaves_like 'able to update front-matter'
end
end
it 'updates the wiki-page front-matter and content together' do
content = 'totally new content'
subject.update(content: content, front_matter: { slugs: ['x'] })

View File

@ -1,82 +0,0 @@
# frozen_string_literal: true
# Input
# - factory: [:clusters_applications_elastic_stack, :clusters_integrations_elastic_stack]
RSpec.shared_examples 'cluster-based #elasticsearch_client' do |factory|
describe '#elasticsearch_client' do
context 'cluster is nil' do
subject { build(factory, cluster: nil) }
it 'returns nil' do
expect(subject.cluster).to be_nil
expect(subject.elasticsearch_client).to be_nil
end
end
context "cluster doesn't have kubeclient" do
let(:cluster) { create(:cluster) }
subject { create(factory, cluster: cluster) }
it 'returns nil' do
expect(subject.elasticsearch_client).to be_nil
end
end
context 'cluster has kubeclient' do
let(:cluster) { create(:cluster, :project, :provided_by_gcp) }
let(:kubernetes_url) { subject.cluster.platform_kubernetes.api_url }
let(:kube_client) { subject.cluster.kubeclient.core_client }
subject { create(factory, cluster: cluster) }
before do
subject.cluster.platform_kubernetes.namespace = 'a-namespace'
stub_kubeclient_discover(cluster.platform_kubernetes.api_url)
create(:cluster_kubernetes_namespace,
cluster: cluster,
cluster_project: cluster.cluster_project,
project: cluster.cluster_project.project)
end
it 'creates proxy elasticsearch_client' do
expect(subject.elasticsearch_client).to be_instance_of(Elasticsearch::Transport::Client)
end
it 'copies proxy_url, options and headers from kube client to elasticsearch_client' do
expect(Elasticsearch::Client)
.to(receive(:new))
.with(url: a_valid_url, adapter: :net_http)
.and_call_original
client = subject.elasticsearch_client
faraday_connection = client.transport.connections.first.connection
expect(faraday_connection.headers["Authorization"]).to eq(kube_client.headers[:Authorization])
expect(faraday_connection.ssl.cert_store).to be_instance_of(OpenSSL::X509::Store)
expect(faraday_connection.ssl.verify).to eq(1)
expect(faraday_connection.options.timeout).to be_nil
end
context 'when cluster is not reachable' do
before do
allow(kube_client).to receive(:proxy_url).and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil))
end
it 'returns nil' do
expect(subject.elasticsearch_client).to be_nil
end
end
context 'when timeout is provided' do
it 'sets timeout in elasticsearch_client' do
client = subject.elasticsearch_client(timeout: 123)
faraday_connection = client.transport.connections.first.connection
expect(faraday_connection.options.timeout).to eq(123)
end
end
end
end
end

View File

@ -229,7 +229,6 @@ RSpec.describe Tooling::Danger::ProjectHelper do
'app/serializers/jira_connect/app_data_serializer.rb' | [:integrations_be, :backend]
'lib/api/github/entities.rb' | [:integrations_be, :backend]
'lib/api/v3/github.rb' | [:integrations_be, :backend]
'app/models/clusters/integrations/elastic_stack.rb' | [:backend]
'app/controllers/clusters/integrations_controller.rb' | [:backend]
'app/services/clusters/integrations/prometheus_health_check_service.rb' | [:backend]
'app/graphql/types/alert_management/integration_type.rb' | [:backend]