diff options
90 files changed, 1024 insertions, 547 deletions
diff --git a/app/assets/javascripts/content_editor/components/top_toolbar.vue b/app/assets/javascripts/content_editor/components/top_toolbar.vue index d3363ce092b..398a9610fb5 100644 --- a/app/assets/javascripts/content_editor/components/top_toolbar.vue +++ b/app/assets/javascripts/content_editor/components/top_toolbar.vue @@ -123,5 +123,14 @@ export default { :tiptap-editor="contentEditor.tiptapEditor" @execute="trackToolbarControlExecution" /> + <toolbar-button + data-testid="horizontal-rule" + content-type="horizontalRule" + icon-name="dash" + editor-command="setHorizontalRule" + :label="__('Add a horizontal rule')" + :tiptap-editor="contentEditor.tiptapEditor" + @execute="trackToolbarControlExecution" + /> </div> </template> diff --git a/app/assets/javascripts/content_editor/extensions/horizontal_rule.js b/app/assets/javascripts/content_editor/extensions/horizontal_rule.js index dcc59476518..c287938af5c 100644 --- a/app/assets/javascripts/content_editor/extensions/horizontal_rule.js +++ b/app/assets/javascripts/content_editor/extensions/horizontal_rule.js @@ -1,5 +1,12 @@ +import { nodeInputRule } from '@tiptap/core'; import { HorizontalRule } from '@tiptap/extension-horizontal-rule'; import { defaultMarkdownSerializer } from 'prosemirror-markdown/src/to_markdown'; -export const tiptapExtension = HorizontalRule; +export const hrInputRuleRegExp = /^---$/; + +export const tiptapExtension = HorizontalRule.extend({ + addInputRules() { + return [nodeInputRule(hrInputRuleRegExp, this.type)]; + }, +}); export const serializer = defaultMarkdownSerializer.nodes.horizontal_rule; diff --git a/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue b/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue index 498d4af59b4..42d6444e690 100644 --- a/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue +++ b/app/assets/javascripts/search/topbar/components/searchable_dropdown_item.vue @@ -1,5 +1,5 @@ <script> -import { GlDropdownItem, GlAvatar } from '@gitlab/ui'; +import { GlDropdownItem, GlAvatar, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import highlight from '~/lib/utils/highlight'; import { truncateNamespace } from '~/lib/utils/text_utility'; @@ -9,6 +9,9 @@ export default { GlDropdownItem, GlAvatar, }, + directives: { + SafeHtml, + }, props: { item: { type: Object, @@ -62,8 +65,7 @@ export default { :size="32" /> <div class="gl-display-flex gl-flex-direction-column"> - <!-- eslint-disable-next-line vue/no-v-html --> - <span data-testid="item-title" v-html="highlightedItemName">{{ item[name] }}</span> + <span v-safe-html="highlightedItemName" data-testid="item-title"></span> <span class="gl-font-sm gl-text-gray-700" data-testid="item-namespace">{{ truncatedNamespace }}</span> diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index aff7eef4622..78823b9604e 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -88,7 +88,12 @@ class AuditEvent < ApplicationRecord end def parallel_persist - PARALLEL_PERSISTENCE_COLUMNS.each { |col| self[col] = details[col] } + PARALLEL_PERSISTENCE_COLUMNS.each do |name| + original = self[name] || self.details[name] + next unless original + + self[name] = self.details[name] = original + end end end diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 7fc01f373c8..0152a714fb8 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -7,6 +7,8 @@ class Wiki include Gitlab::Utils::StrongMemoize include GlobalID::Identification + extend ActiveModel::Naming + MARKUPS = { # rubocop:disable Style/MultilineIfModifier 'Markdown' => :markdown, 'RDoc' => :rdoc, diff --git a/app/services/ci/queue/pending_builds_strategy.rb b/app/services/ci/queue/pending_builds_strategy.rb index 1c6007f0be8..b49c6871d00 100644 --- a/app/services/ci/queue/pending_builds_strategy.rb +++ b/app/services/ci/queue/pending_builds_strategy.rb @@ -26,7 +26,8 @@ module Ci # this returns builds that are ordered by number of running builds # we prefer projects that don't use shared runners at all relation - .joins("LEFT JOIN (#{running_builds_for_shared_runners.to_sql}) AS project_builds ON ci_pending_builds.project_id=project_builds.project_id") + .with(running_builds_for_shared_runners_cte.to_arel) + .joins("LEFT JOIN project_builds ON ci_pending_builds.project_id = project_builds.project_id") .order(Arel.sql('COALESCE(project_builds.running_builds, 0) ASC'), 'ci_pending_builds.build_id ASC') end end @@ -53,11 +54,14 @@ module Ci private - def running_builds_for_shared_runners - ::Ci::RunningBuild + def running_builds_for_shared_runners_cte + running_builds = ::Ci::RunningBuild .instance_type .group(:project_id) .select(:project_id, 'COUNT(*) AS running_builds') + + ::Gitlab::SQL::CTE + .new(:project_builds, running_builds, materialized: true) end # rubocop:enable CodeReuse/ActiveRecord end diff --git a/app/services/post_receive_service.rb b/app/services/post_receive_service.rb index faacabbb16c..a6d49f03c0b 100644 --- a/app/services/post_receive_service.rb +++ b/app/services/post_receive_service.rb @@ -32,11 +32,11 @@ class PostReceiveService response.add_alert_message(broadcast_message) response.add_merge_request_urls(merge_request_urls) - # Neither User nor Project are guaranteed to be returned; an orphaned write deploy + # Neither User nor Repository are guaranteed to be returned; an orphaned write deploy # key could be used - if user && project - redirect_message = Gitlab::Checks::ProjectMoved.fetch_message(user.id, project.id) - project_created_message = Gitlab::Checks::ProjectCreated.fetch_message(user.id, project.id) + if user && repository + redirect_message = Gitlab::Checks::ContainerMoved.fetch_message(user, repository) + project_created_message = Gitlab::Checks::ProjectCreated.fetch_message(user, repository) response.add_basic_message(redirect_message) response.add_basic_message(project_created_message) @@ -94,6 +94,8 @@ class PostReceiveService end def record_onboarding_progress + return unless project + OnboardingProgressService.new(project.namespace).execute(action: :git_write) end end diff --git a/config/metrics/counts_28d/20210216180509_incident_management_alerts_total_unique_counts.yml b/config/metrics/counts_28d/20210216180509_incident_management_alerts_total_unique_counts.yml index 23c3f0fcb3f..9240abbe3e4 100644 --- a/config/metrics/counts_28d/20210216180509_incident_management_alerts_total_unique_counts.yml +++ b/config/metrics/counts_28d/20210216180509_incident_management_alerts_total_unique_counts.yml @@ -3,14 +3,16 @@ key_path: counts_monthly.aggregated_metrics.incident_management_alerts_total_uni description: Count of unique users per month to take an action on an alert product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available time_frame: 28d -data_source: database +data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180511_incident_management_incidents_total_unique_counts.yml b/config/metrics/counts_28d/20210216180511_incident_management_incidents_total_unique_counts.yml index 9d935a654e3..acfa19a35d1 100644 --- a/config/metrics/counts_28d/20210216180511_incident_management_incidents_total_unique_counts.yml +++ b/config/metrics/counts_28d/20210216180511_incident_management_incidents_total_unique_counts.yml @@ -3,14 +3,16 @@ key_path: counts_monthly.aggregated_metrics.incident_management_incidents_total_ description: Count of unique users per month to take an action on an incident product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available time_frame: 28d -data_source: database +data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180524_projects_with_incidents.yml b/config/metrics/counts_28d/20210216180524_projects_with_incidents.yml index 15ebaa81855..ca45b34f12d 100644 --- a/config/metrics/counts_28d/20210216180524_projects_with_incidents.yml +++ b/config/metrics/counts_28d/20210216180524_projects_with_incidents.yml @@ -3,14 +3,16 @@ key_path: usage_activity_by_stage_monthly.monitor.projects_with_incidents description: 'Count of unique projects with an incident created in the last month' product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available time_frame: 28d -data_source: +data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180526_projects_with_alert_incidents.yml b/config/metrics/counts_28d/20210216180526_projects_with_alert_incidents.yml index 3559638afb6..63de97f39c1 100644 --- a/config/metrics/counts_28d/20210216180526_projects_with_alert_incidents.yml +++ b/config/metrics/counts_28d/20210216180526_projects_with_alert_incidents.yml @@ -4,14 +4,16 @@ description: 'Count of unique projects with an incident from an alert created in last month' product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available time_frame: 28d -data_source: +data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180530_incident_management_alert_status_changed_monthly.yml b/config/metrics/counts_28d/20210216180530_incident_management_alert_status_changed_monthly.yml index 8100c8f6d86..594a0dada1f 100644 --- a/config/metrics/counts_28d/20210216180530_incident_management_alert_status_changed_monthly.yml +++ b/config/metrics/counts_28d/20210216180530_incident_management_alert_status_changed_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_alert_status_changed_monthly -description: +description: Count of unique users changing alert's status changes per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180533_incident_management_alert_assigned_monthly.yml b/config/metrics/counts_28d/20210216180533_incident_management_alert_assigned_monthly.yml index abd26612688..7fe625a5b82 100644 --- a/config/metrics/counts_28d/20210216180533_incident_management_alert_assigned_monthly.yml +++ b/config/metrics/counts_28d/20210216180533_incident_management_alert_assigned_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_alert_assigned_monthly -description: +description: Count of unique users assigning an alert per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180537_incident_management_alert_todo_monthly.yml b/config/metrics/counts_28d/20210216180537_incident_management_alert_todo_monthly.yml index a7f176028fa..81a08bccdf3 100644 --- a/config/metrics/counts_28d/20210216180537_incident_management_alert_todo_monthly.yml +++ b/config/metrics/counts_28d/20210216180537_incident_management_alert_todo_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_alert_todo_monthly -description: +description: Count of unique users adding alerts to the TODO list per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180541_incident_management_incident_created_monthly.yml b/config/metrics/counts_28d/20210216180541_incident_management_incident_created_monthly.yml index 4a130cab39c..9ebed79c3fb 100644 --- a/config/metrics/counts_28d/20210216180541_incident_management_incident_created_monthly.yml +++ b/config/metrics/counts_28d/20210216180541_incident_management_incident_created_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_created_monthly -description: +description: Count of unique users creating incidents per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180545_incident_management_incident_reopened_monthly.yml b/config/metrics/counts_28d/20210216180545_incident_management_incident_reopened_monthly.yml index 5509c6b492f..cc7d3d679e3 100644 --- a/config/metrics/counts_28d/20210216180545_incident_management_incident_reopened_monthly.yml +++ b/config/metrics/counts_28d/20210216180545_incident_management_incident_reopened_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_reopened_monthly -description: +description: Count of unique users reopening incidents per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180548_incident_management_incident_closed_monthly.yml b/config/metrics/counts_28d/20210216180548_incident_management_incident_closed_monthly.yml index 5475fc5c2b6..522deaaedf5 100644 --- a/config/metrics/counts_28d/20210216180548_incident_management_incident_closed_monthly.yml +++ b/config/metrics/counts_28d/20210216180548_incident_management_incident_closed_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_closed_monthly -description: +description: Count of users closing incidents per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180552_incident_management_incident_assigned_monthly.yml b/config/metrics/counts_28d/20210216180552_incident_management_incident_assigned_monthly.yml index 74566b19180..7979dfb860f 100644 --- a/config/metrics/counts_28d/20210216180552_incident_management_incident_assigned_monthly.yml +++ b/config/metrics/counts_28d/20210216180552_incident_management_incident_assigned_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_assigned_monthly -description: +description: Count of users assigning incidents per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180556_incident_management_incident_todo_monthly.yml b/config/metrics/counts_28d/20210216180556_incident_management_incident_todo_monthly.yml index 62614850622..b1285f4173b 100644 --- a/config/metrics/counts_28d/20210216180556_incident_management_incident_todo_monthly.yml +++ b/config/metrics/counts_28d/20210216180556_incident_management_incident_todo_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_todo_monthly -description: +description: Count of unique users adding incidents to the TODO list per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180559_incident_management_incident_comment_monthly.yml b/config/metrics/counts_28d/20210216180559_incident_management_incident_comment_monthly.yml index fe3e71ddea2..dcb0aeee772 100644 --- a/config/metrics/counts_28d/20210216180559_incident_management_incident_comment_monthly.yml +++ b/config/metrics/counts_28d/20210216180559_incident_management_incident_comment_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_comment_monthly -description: +description: Count of unique users adding comments per month on incidents product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180603_incident_management_incident_zoom_meeting_monthly.yml b/config/metrics/counts_28d/20210216180603_incident_management_incident_zoom_meeting_monthly.yml new file mode 100644 index 00000000000..af3bfcdb2e1 --- /dev/null +++ b/config/metrics/counts_28d/20210216180603_incident_management_incident_zoom_meeting_monthly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_zoom_meeting_monthly +description: Count of users creating Zoom meetings about incidents per month +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 28d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180611_incident_management_incident_relate_monthly.yml b/config/metrics/counts_28d/20210216180611_incident_management_incident_relate_monthly.yml index b8b765b5790..0d38c8e1014 100644 --- a/config/metrics/counts_28d/20210216180611_incident_management_incident_relate_monthly.yml +++ b/config/metrics/counts_28d/20210216180611_incident_management_incident_relate_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_relate_monthly -description: +description: Count of unique users adding issues per month that are related to an incident product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180614_incident_management_incident_unrelate_monthly.yml b/config/metrics/counts_28d/20210216180614_incident_management_incident_unrelate_monthly.yml index e1a52b294fc..581d9790e24 100644 --- a/config/metrics/counts_28d/20210216180614_incident_management_incident_unrelate_monthly.yml +++ b/config/metrics/counts_28d/20210216180614_incident_management_incident_unrelate_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_unrelate_monthly -description: +description: Count of users removing issues that are related to an incident per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180618_incident_management_incident_change_confidential_monthly.yml b/config/metrics/counts_28d/20210216180618_incident_management_incident_change_confidential_monthly.yml index 04fe154338d..8cc945c1ff1 100644 --- a/config/metrics/counts_28d/20210216180618_incident_management_incident_change_confidential_monthly.yml +++ b/config/metrics/counts_28d/20210216180618_incident_management_incident_change_confidential_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_incident_change_confidential_monthly -description: +description: Count of users changing incidents to confidential per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180622_incident_management_total_unique_counts_monthly.yml b/config/metrics/counts_28d/20210216180622_incident_management_total_unique_counts_monthly.yml index 7cdeaa76e49..d438e0efa2c 100644 --- a/config/metrics/counts_28d/20210216180622_incident_management_total_unique_counts_monthly.yml +++ b/config/metrics/counts_28d/20210216180622_incident_management_total_unique_counts_monthly.yml @@ -1,9 +1,9 @@ --- key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly -description: +description: Count of unique users performing events related with incidents per month product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180625_incident_management_alert_create_incident_monthly.yml b/config/metrics/counts_28d/20210216180625_incident_management_alert_create_incident_monthly.yml index 9dd091b74ea..6496e9048e8 100644 --- a/config/metrics/counts_28d/20210216180625_incident_management_alert_create_incident_monthly.yml +++ b/config/metrics/counts_28d/20210216180625_incident_management_alert_create_incident_monthly.yml @@ -4,7 +4,7 @@ description: Count of unique users per month to create an incident corresponding an alert product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -12,6 +12,8 @@ time_frame: 28d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180513_incident_management_alerts_total_unique_counts.yml b/config/metrics/counts_7d/20210216180513_incident_management_alerts_total_unique_counts.yml new file mode 100644 index 00000000000..1c37c704aff --- /dev/null +++ b/config/metrics/counts_7d/20210216180513_incident_management_alerts_total_unique_counts.yml @@ -0,0 +1,18 @@ +--- +key_path: counts_weekly.aggregated_metrics.incident_management_alerts_total_unique_counts +description: Count of unique users per week to take an action on an alert +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: incident_management +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180515_incident_management_incidents_total_unique_counts.yml b/config/metrics/counts_7d/20210216180515_incident_management_incidents_total_unique_counts.yml new file mode 100644 index 00000000000..71ad56b44ee --- /dev/null +++ b/config/metrics/counts_7d/20210216180515_incident_management_incidents_total_unique_counts.yml @@ -0,0 +1,18 @@ +--- +key_path: counts_weekly.aggregated_metrics.incident_management_incidents_total_unique_counts +description: Count of unique users per week to take an action on an incident +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: incident_management +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180528_incident_management_alert_status_changed_weekly.yml b/config/metrics/counts_7d/20210216180528_incident_management_alert_status_changed_weekly.yml new file mode 100644 index 00000000000..5bbbc62c897 --- /dev/null +++ b/config/metrics/counts_7d/20210216180528_incident_management_alert_status_changed_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_alert_status_changed_weekly +description: Count of unique users changing alert's status per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180532_incident_management_alert_assigned_weekly.yml b/config/metrics/counts_7d/20210216180532_incident_management_alert_assigned_weekly.yml new file mode 100644 index 00000000000..f099dfc8fde --- /dev/null +++ b/config/metrics/counts_7d/20210216180532_incident_management_alert_assigned_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_alert_assigned_weekly +description: Count of unique users assigning an alert per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180535_incident_management_alert_todo_weekly.yml b/config/metrics/counts_7d/20210216180535_incident_management_alert_todo_weekly.yml new file mode 100644 index 00000000000..09a1c7622f3 --- /dev/null +++ b/config/metrics/counts_7d/20210216180535_incident_management_alert_todo_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_alert_todo_weekly +description: Count of unique users adding alerts to the TODO list per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180539_incident_management_incident_created_weekly.yml b/config/metrics/counts_7d/20210216180539_incident_management_incident_created_weekly.yml new file mode 100644 index 00000000000..1f5631f6a1e --- /dev/null +++ b/config/metrics/counts_7d/20210216180539_incident_management_incident_created_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_created_weekly +description: Count of unique users creating incidents per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180543_incident_management_incident_reopened_weekly.yml b/config/metrics/counts_7d/20210216180543_incident_management_incident_reopened_weekly.yml new file mode 100644 index 00000000000..c2733d2e176 --- /dev/null +++ b/config/metrics/counts_7d/20210216180543_incident_management_incident_reopened_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_reopened_weekly +description: Count of unique users reopening incidents per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_28d/20210216180607_incident_management_incident_published_monthly.yml b/config/metrics/counts_7d/20210216180546_incident_management_incident_closed_weekly.yml index 3cd2c435074..ab4f0481916 100644 --- a/config/metrics/counts_28d/20210216180607_incident_management_incident_published_monthly.yml +++ b/config/metrics/counts_7d/20210216180546_incident_management_incident_closed_weekly.yml @@ -1,16 +1,18 @@ --- -key_path: redis_hll_counters.incident_management.incident_management_incident_published_monthly -description: +key_path: redis_hll_counters.incident_management.incident_management_incident_closed_weekly +description: Count of users closing incidents per week product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: value_type: number status: data_available -time_frame: 28d +time_frame: 7d data_source: redis_hll distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180550_incident_management_incident_assigned_weekly.yml b/config/metrics/counts_7d/20210216180550_incident_management_incident_assigned_weekly.yml new file mode 100644 index 00000000000..cac8cbdefe6 --- /dev/null +++ b/config/metrics/counts_7d/20210216180550_incident_management_incident_assigned_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_assigned_weekly +description: Count of unique users assiging incidents per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180554_incident_management_incident_todo_weekly.yml b/config/metrics/counts_7d/20210216180554_incident_management_incident_todo_weekly.yml new file mode 100644 index 00000000000..904b57212f6 --- /dev/null +++ b/config/metrics/counts_7d/20210216180554_incident_management_incident_todo_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_todo_weekly +description: Count of unique users adding incidents to the TODO list per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180558_incident_management_incident_comment_weekly.yml b/config/metrics/counts_7d/20210216180558_incident_management_incident_comment_weekly.yml new file mode 100644 index 00000000000..66c749f678c --- /dev/null +++ b/config/metrics/counts_7d/20210216180558_incident_management_incident_comment_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_comment_weekly +description: Count of unique users adding comments on incidents per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180601_incident_management_incident_zoom_meeting_weekly.yml b/config/metrics/counts_7d/20210216180601_incident_management_incident_zoom_meeting_weekly.yml new file mode 100644 index 00000000000..cb8eac4a20c --- /dev/null +++ b/config/metrics/counts_7d/20210216180601_incident_management_incident_zoom_meeting_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_zoom_meeting_weekly +description: Count of unique users creating Zoom meetings about incidents per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180609_incident_management_incident_relate_weekly.yml b/config/metrics/counts_7d/20210216180609_incident_management_incident_relate_weekly.yml new file mode 100644 index 00000000000..1106d2a5f48 --- /dev/null +++ b/config/metrics/counts_7d/20210216180609_incident_management_incident_relate_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_relate_weekly +description: Count of unique users adding issues per that are related to an incident week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180612_incident_management_incident_unrelate_weekly.yml b/config/metrics/counts_7d/20210216180612_incident_management_incident_unrelate_weekly.yml new file mode 100644 index 00000000000..a597ee6d093 --- /dev/null +++ b/config/metrics/counts_7d/20210216180612_incident_management_incident_unrelate_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_unrelate_weekly +description: Count of unique users removing issue that are related to an incident per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180616_incident_management_incident_change_confidential_weekly.yml b/config/metrics/counts_7d/20210216180616_incident_management_incident_change_confidential_weekly.yml new file mode 100644 index 00000000000..b747ede0a8e --- /dev/null +++ b/config/metrics/counts_7d/20210216180616_incident_management_incident_change_confidential_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_incident_change_confidential_weekly +description: Count of unique users changing incidents to confidential per week +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180620_incident_management_total_unique_counts_weekly.yml b/config/metrics/counts_7d/20210216180620_incident_management_total_unique_counts_weekly.yml new file mode 100644 index 00000000000..dd3be4eddb1 --- /dev/null +++ b/config/metrics/counts_7d/20210216180620_incident_management_total_unique_counts_weekly.yml @@ -0,0 +1,18 @@ +--- +key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_weekly +description: Count of unique users performing events related to the incident management +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20210216180623_incident_management_alert_create_incident_weekly.yml b/config/metrics/counts_7d/20210216180623_incident_management_alert_create_incident_weekly.yml new file mode 100644 index 00000000000..ff7a3c1e040 --- /dev/null +++ b/config/metrics/counts_7d/20210216180623_incident_management_alert_create_incident_weekly.yml @@ -0,0 +1,19 @@ +--- +key_path: redis_hll_counters.incident_management_alerts.incident_management_alert_create_incident_weekly +description: Count of unique users per week to create an incident corresponding to + an alert +product_section: ops +product_stage: monitor +product_group: group::monitor +product_category: incident_management +value_type: number +status: data_available +time_frame: 7d +data_source: redis_hll +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180434_issues_created_from_gitlab_error_tracking_ui.yml b/config/metrics/counts_all/20210216180434_issues_created_from_gitlab_error_tracking_ui.yml index a8e4acaae15..f077d6a5f51 100644 --- a/config/metrics/counts_all/20210216180434_issues_created_from_gitlab_error_tracking_ui.yml +++ b/config/metrics/counts_all/20210216180434_issues_created_from_gitlab_error_tracking_ui.yml @@ -3,7 +3,7 @@ key_path: counts.issues_created_from_gitlab_error_tracking_ui description: Count of issues manually created from the GitLab UI on Sentry errors product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: error_tracking value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: all data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180436_issues_with_associated_zoom_link.yml b/config/metrics/counts_all/20210216180436_issues_with_associated_zoom_link.yml index f1ab4c0cec1..41a13b47157 100644 --- a/config/metrics/counts_all/20210216180436_issues_with_associated_zoom_link.yml +++ b/config/metrics/counts_all/20210216180436_issues_with_associated_zoom_link.yml @@ -3,7 +3,7 @@ key_path: counts.issues_with_associated_zoom_link description: Count of issues where a user has linked a Zoom meeting product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180438_issues_using_zoom_quick_actions.yml b/config/metrics/counts_all/20210216180438_issues_using_zoom_quick_actions.yml index 403cd2ecbcb..fa3b1167c2b 100644 --- a/config/metrics/counts_all/20210216180438_issues_using_zoom_quick_actions.yml +++ b/config/metrics/counts_all/20210216180438_issues_using_zoom_quick_actions.yml @@ -4,7 +4,7 @@ description: Count of issues where a user have added AND removed a zoom meeting slash commands product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -17,4 +17,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180440_issues_with_embedded_grafana_charts_approx.yml b/config/metrics/counts_all/20210216180440_issues_with_embedded_grafana_charts_approx.yml index 3dcf3754cd8..c8a2e2c8244 100644 --- a/config/metrics/counts_all/20210216180440_issues_with_embedded_grafana_charts_approx.yml +++ b/config/metrics/counts_all/20210216180440_issues_with_embedded_grafana_charts_approx.yml @@ -3,7 +3,7 @@ key_path: counts.issues_with_embedded_grafana_charts_approx description: Count of issues where a user has embedded a Grafana chart product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180441_issues_created_from_alerts.yml b/config/metrics/counts_all/20210216180441_issues_created_from_alerts.yml index a032f8a2a33..4c782a4da17 100644 --- a/config/metrics/counts_all/20210216180441_issues_created_from_alerts.yml +++ b/config/metrics/counts_all/20210216180441_issues_created_from_alerts.yml @@ -3,7 +3,7 @@ key_path: counts.issues_created_from_alerts description: Count of issues created automatically on alerts from GitLab-Managed Prometheus product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180443_issues_created_gitlab_alerts.yml b/config/metrics/counts_all/20210216180443_issues_created_gitlab_alerts.yml index ca9cfc92d0e..ac6d1f6be31 100644 --- a/config/metrics/counts_all/20210216180443_issues_created_gitlab_alerts.yml +++ b/config/metrics/counts_all/20210216180443_issues_created_gitlab_alerts.yml @@ -3,7 +3,7 @@ key_path: counts.issues_created_gitlab_alerts description: Count of all issues created from GitLab alerts (bot and non-bot) product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180445_issues_created_manually_from_alerts.yml b/config/metrics/counts_all/20210216180445_issues_created_manually_from_alerts.yml index 02ca2d6499e..638f9634d04 100644 --- a/config/metrics/counts_all/20210216180445_issues_created_manually_from_alerts.yml +++ b/config/metrics/counts_all/20210216180445_issues_created_manually_from_alerts.yml @@ -3,7 +3,7 @@ key_path: counts.issues_created_manually_from_alerts description: Count of issues created manually by non-bot users from GitLab alerts product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180447_incident_issues.yml b/config/metrics/counts_all/20210216180447_incident_issues.yml index 9d348fc5a3d..3d17db99772 100644 --- a/config/metrics/counts_all/20210216180447_incident_issues.yml +++ b/config/metrics/counts_all/20210216180447_incident_issues.yml @@ -3,7 +3,7 @@ key_path: counts.incident_issues description: Count of incidents (issues where issue_type=incident) product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180449_alert_bot_incident_issues.yml b/config/metrics/counts_all/20210216180449_alert_bot_incident_issues.yml index e7b7e2c801b..24f4ab2077f 100644 --- a/config/metrics/counts_all/20210216180449_alert_bot_incident_issues.yml +++ b/config/metrics/counts_all/20210216180449_alert_bot_incident_issues.yml @@ -3,7 +3,7 @@ key_path: counts.alert_bot_incident_issues description: Count of issues created by the alert bot automatically product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180451_incident_labeled_issues.yml b/config/metrics/counts_all/20210216180451_incident_labeled_issues.yml index 4db557d00c4..b59278bcc45 100644 --- a/config/metrics/counts_all/20210216180451_incident_labeled_issues.yml +++ b/config/metrics/counts_all/20210216180451_incident_labeled_issues.yml @@ -3,7 +3,7 @@ key_path: counts.incident_labeled_issues description: Count of all issues with the label=incident product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180453_projects_creating_incidents.yml b/config/metrics/counts_all/20210216180453_projects_creating_incidents.yml index 44221482c4f..cbd63ff1c8b 100644 --- a/config/metrics/counts_all/20210216180453_projects_creating_incidents.yml +++ b/config/metrics/counts_all/20210216180453_projects_creating_incidents.yml @@ -3,7 +3,7 @@ key_path: counts.projects_creating_incidents description: Counts of Projects that have incident issues, regardless of status. product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: all data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180454_projects_with_error_tracking_enabled.yml b/config/metrics/counts_all/20210216180454_projects_with_error_tracking_enabled.yml index 4bdec4be171..620b829ac44 100644 --- a/config/metrics/counts_all/20210216180454_projects_with_error_tracking_enabled.yml +++ b/config/metrics/counts_all/20210216180454_projects_with_error_tracking_enabled.yml @@ -3,7 +3,7 @@ key_path: counts.projects_with_error_tracking_enabled description: Count of projects that have enabled Error tracking via Sentry product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: error_tracking value_type: number status: data_available @@ -16,4 +16,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180456_projects_with_alerts_service_enabled.yml b/config/metrics/counts_all/20210216180456_projects_with_alerts_service_enabled.yml index bd4a4ed3e61..fe877fedb12 100644 --- a/config/metrics/counts_all/20210216180456_projects_with_alerts_service_enabled.yml +++ b/config/metrics/counts_all/20210216180456_projects_with_alerts_service_enabled.yml @@ -3,7 +3,7 @@ key_path: counts.projects_with_alerts_service_enabled description: Count of projects that have enabled the Alerts service product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: removed @@ -17,4 +17,3 @@ tier: - free - premium - ultimate -skip_validation: true diff --git a/config/metrics/counts_all/20210216180458_projects_with_alerts_created.yml b/config/metrics/counts_all/20210216180458_projects_with_alerts_created.yml index 4fe6799d027..6364f526a92 100644 --- a/config/metrics/counts_all/20210216180458_projects_with_alerts_created.yml +++ b/config/metrics/counts_all/20210216180458_projects_with_alerts_created.yml @@ -3,7 +3,7 @@ key_path: counts.projects_with_alerts_created description: Count of projects with alerts created in given time period product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: alert_management value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: all data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180500_projects_with_enabled_alert_integrations.yml b/config/metrics/counts_all/20210216180500_projects_with_enabled_alert_integrations.yml index e850bb6c2a8..8616db19bb7 100644 --- a/config/metrics/counts_all/20210216180500_projects_with_enabled_alert_integrations.yml +++ b/config/metrics/counts_all/20210216180500_projects_with_enabled_alert_integrations.yml @@ -3,7 +3,7 @@ key_path: counts.projects_with_enabled_alert_integrations description: Count of projects with at least 1 enabled integration product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available @@ -11,6 +11,8 @@ time_frame: all data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180502_status_page_incident_publishes.yml b/config/metrics/counts_all/20210216180502_status_page_incident_publishes.yml deleted file mode 100644 index e1c1bfafe31..00000000000 --- a/config/metrics/counts_all/20210216180502_status_page_incident_publishes.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -key_path: counts.status_page_incident_publishes -description: Cumulative count of usages of publish operation -product_section: ops -product_stage: monitor -product_group: group::health -product_category: incident_management -value_type: number -status: data_available -time_frame: all -data_source: database -distribution: -- ce -tier: -- free -skip_validation: true diff --git a/config/metrics/counts_all/20210216180504_status_page_incident_unpublishes.yml b/config/metrics/counts_all/20210216180504_status_page_incident_unpublishes.yml deleted file mode 100644 index db3e1c12b7b..00000000000 --- a/config/metrics/counts_all/20210216180504_status_page_incident_unpublishes.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -key_path: counts.status_page_incident_unpublishes -description: Cumulative count of usages of unpublish operation -product_section: ops -product_stage: monitor -product_group: group::health -product_category: incident_management -value_type: number -status: data_available -time_frame: all -data_source: database -distribution: -- ce -tier: -- free -skip_validation: true diff --git a/config/metrics/counts_all/20210216180506_status_page_projects.yml b/config/metrics/counts_all/20210216180506_status_page_projects.yml deleted file mode 100644 index 5ff16f3dd47..00000000000 --- a/config/metrics/counts_all/20210216180506_status_page_projects.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -key_path: counts.status_page_projects -description: Projects with status page enabled -product_section: ops -product_stage: monitor -product_group: group::health -product_category: incident_management -value_type: number -status: data_available -time_frame: all -data_source: database -distribution: -- ce -tier: -- free -skip_validation: true diff --git a/config/metrics/counts_all/20210216180507_status_page_issues.yml b/config/metrics/counts_all/20210216180507_status_page_issues.yml deleted file mode 100644 index 5db63243d35..00000000000 --- a/config/metrics/counts_all/20210216180507_status_page_issues.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -key_path: counts.status_page_issues -description: Issues published to a Status Page -product_section: ops -product_stage: monitor -product_group: group::health -product_category: incident_management -value_type: number -status: data_available -time_frame: all -data_source: database -distribution: -- ce -tier: -- free -skip_validation: true diff --git a/config/metrics/counts_all/20210216180517_projects_with_error_tracking_enabled.yml b/config/metrics/counts_all/20210216180517_projects_with_error_tracking_enabled.yml index c064e33f30a..3cb079a0bef 100644 --- a/config/metrics/counts_all/20210216180517_projects_with_error_tracking_enabled.yml +++ b/config/metrics/counts_all/20210216180517_projects_with_error_tracking_enabled.yml @@ -3,14 +3,16 @@ key_path: usage_activity_by_stage.monitor.projects_with_error_tracking_enabled description: Projects where error tracking is enabled product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: error_tracking value_type: number status: data_available time_frame: all -data_source: +data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180518_projects_with_incidents.yml b/config/metrics/counts_all/20210216180518_projects_with_incidents.yml index bbedec31c43..ce194b6916b 100644 --- a/config/metrics/counts_all/20210216180518_projects_with_incidents.yml +++ b/config/metrics/counts_all/20210216180518_projects_with_incidents.yml @@ -3,14 +3,16 @@ key_path: usage_activity_by_stage.monitor.projects_with_incidents description: Count of unique projects with an incident product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available time_frame: all -data_source: +data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180520_projects_with_alert_incidents.yml b/config/metrics/counts_all/20210216180520_projects_with_alert_incidents.yml index 87e013bdcb5..69b9592e58f 100644 --- a/config/metrics/counts_all/20210216180520_projects_with_alert_incidents.yml +++ b/config/metrics/counts_all/20210216180520_projects_with_alert_incidents.yml @@ -3,14 +3,16 @@ key_path: usage_activity_by_stage.monitor.projects_with_alert_incidents description: Count of unique projects with an incident from an alert product_section: ops product_stage: monitor -product_group: group::health +product_group: group::monitor product_category: incident_management value_type: number status: data_available time_frame: all -data_source: +data_source: database distribution: - ce +- ee tier: - free -skip_validation: true +- premium +- ultimate diff --git a/config/metrics/counts_all/20210216180522_projects_incident_sla_enabled.yml b/config/metrics/counts_all/20210216180522_projects_incident_sla_enabled.yml deleted file mode 100644 index 84a828a467b..00000000000 --- a/config/metrics/counts_all/20210216180522_projects_incident_sla_enabled.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -key_path: usage_activity_by_stage.monitor.projects_incident_sla_enabled -description: Projects where Incident SLA is enabled -product_section: ops -product_stage: monitor -product_group: group::health -product_category: error_tracking -value_type: number -status: data_available -time_frame: all -data_source: -distribution: -- ce -tier: -- free -skip_validation: true diff --git a/doc/administration/reply_by_email.md b/doc/administration/reply_by_email.md index ebb9e086cb7..c249f48b768 100644 --- a/doc/administration/reply_by_email.md +++ b/doc/administration/reply_by_email.md @@ -4,9 +4,7 @@ group: Certify info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- -# Reply by email - -> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/1173) in GitLab 8.0. +# Reply by email **(FREE SELF)** GitLab can be set up to allow users to comment on issues and merge requests by replying to notification emails. @@ -34,10 +32,10 @@ addition, this "reply key" is also added to the `References` header. When you reply to the notification email, your email client: -- sends the email to the `Reply-To` address it got from the notification email -- sets the `In-Reply-To` header to the value of the `Message-ID` header from the +- Sends the email to the `Reply-To` address it got from the notification email +- Sets the `In-Reply-To` header to the value of the `Message-ID` header from the notification email -- sets the `References` header to the value of the `Message-ID` plus the value of +- Sets the `References` header to the value of the `Message-ID` plus the value of the notification email's `References` header. ### GitLab receives your reply to the notification email @@ -45,8 +43,8 @@ When you reply to the notification email, your email client: When GitLab receives your reply, it looks for the "reply key" in the following headers, in this order: -1. the `To` header -1. the `References` header +1. `To` header +1. `References` header If it finds a reply key, it leaves your reply as a comment on the entity the notification was about (issue, merge request, commit...). diff --git a/doc/api/events.md b/doc/api/events.md index 49d99cc43fe..ef4cd7624fd 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -10,20 +10,52 @@ info: To determine the technical writer assigned to the Stage/Group associated w ### Action Types -Available action types for the `action` parameter are: +Available types for the `action` parameter, and the resources that might be affected: - `approved` -- `created` -- `updated` + - Merge request - `closed` -- `reopened` -- `pushed` -- `commented` -- `merged` -- `joined` -- `left` + - Epic + - Issue + - Merge request + - Milestone +- `commented` on any `Noteable` record. + - Alert + - Commit + - Design + - Issue + - Merge request + - Snippet +- `created` + - Design + - Epic + - Issue + - Merge request + - Milestone + - Project + - Wiki page - `destroyed` + - Design + - Milestone + - Wiki page - `expired` + - Project membership +- `joined` + - Project membership +- `left` + - Project membership +- `merged` + - Merge request +- `pushed` commits to (or deleted commits from) a repository, individually or in bulk. + - Project +- `reopened` + - Epic + - Issue + - Merge request + - Milestone +- `updated` + - Design + - Wiki page Note that these options are in lower case. diff --git a/doc/api/projects.md b/doc/api/projects.md index e5cb2c8e1eb..e2edd43df12 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -1213,7 +1213,6 @@ POST /projects | `show_default_award_emojis` | boolean | **{dotted-circle}** No | Show default award emojis. | | `snippets_access_level` | string | **{dotted-circle}** No | One of `disabled`, `private`, or `enabled`. | | `snippets_enabled` | boolean | **{dotted-circle}** No | _(Deprecated)_ Enable snippets for this project. Use `snippets_access_level` instead. | -| `squash_option` | string | **{dotted-circle}** No | One of `never`, `always`, `default_on`, or `default_off`. | | `tag_list` | array | **{dotted-circle}** No | _([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/328226) in GitLab 14.0)_ The list of tags for a project; put array of tags, that should be finally assigned to a project. Use `topics` instead. | | `template_name` | string | **{dotted-circle}** No | When used without `use_custom_template`, name of a [built-in project template](../user/project/working_with_projects.md#built-in-templates). When used with `use_custom_template`, name of a custom project template. | | `template_project_id` **(PREMIUM)** | integer | **{dotted-circle}** No | When used with `use_custom_template`, project ID of a custom project template. This is preferable to using `template_name` since `template_name` may be ambiguous. | @@ -1289,7 +1288,6 @@ POST /projects/user/:user_id | `show_default_award_emojis` | boolean | **{dotted-circle}** No | Show default award emojis. | | `snippets_access_level` | string | **{dotted-circle}** No | One of `disabled`, `private`, or `enabled`. | | `snippets_enabled` | boolean | **{dotted-circle}** No | _(Deprecated)_ Enable snippets for this project. Use `snippets_access_level` instead. | -| `squash_option` | string | **{dotted-circle}** No | One of `never`, `always`, `default_on`, or `default_off`. | | `suggestion_commit_message` | string | **{dotted-circle}** No | The commit message used to apply merge request [suggestions](../user/project/merge_requests/reviews/suggestions.md). | | `tag_list` | array | **{dotted-circle}** No | _([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/328226) in GitLab 14.0)_ The list of tags for a project; put array of tags, that should be finally assigned to a project. Use `topics` instead. | | `template_name` | string | **{dotted-circle}** No | When used without `use_custom_template`, name of a [built-in project template](../user/project/working_with_projects.md#built-in-templates). When used with `use_custom_template`, name of a custom project template. | @@ -1369,7 +1367,6 @@ PUT /projects/:id | `show_default_award_emojis` | boolean | **{dotted-circle}** No | Show default award emojis. | | `snippets_access_level` | string | **{dotted-circle}** No | One of `disabled`, `private`, or `enabled`. | | `snippets_enabled` | boolean | **{dotted-circle}** No | _(Deprecated)_ Enable snippets for this project. Use `snippets_access_level` instead. | -| `squash_option` | string | **{dotted-circle}** No | One of `never`, `always`, `default_on`, or `default_off`. | | `suggestion_commit_message` | string | **{dotted-circle}** No | The commit message used to apply merge request suggestions. | | `tag_list` | array | **{dotted-circle}** No | _([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/328226) in GitLab 14.0)_ The list of tags for a project; put array of tags, that should be finally assigned to a project. Use `topics` instead. | | `topics` | array | **{dotted-circle}** No | The list of topics for the project. This replaces any existing topics that are already added to the project. _([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/328226) in GitLab 14.0.)_ | diff --git a/doc/development/usage_ping/dictionary.md b/doc/development/usage_ping/dictionary.md index e76fb302b9c..cdc9688c602 100644 --- a/doc/development/usage_ping/dictionary.md +++ b/doc/development/usage_ping/dictionary.md @@ -412,7 +412,7 @@ Count of issues created by the alert bot automatically [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180449_alert_bot_incident_issues.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -2428,7 +2428,7 @@ Count of incidents (issues where issue_type=incident) [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180447_incident_issues.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -2440,7 +2440,7 @@ Count of all issues with the label=incident [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180451_incident_labeled_issues.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -3028,7 +3028,7 @@ Count of issues created automatically on alerts from GitLab-Managed Prometheus [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180441_issues_created_from_alerts.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -3040,11 +3040,11 @@ Count of issues manually created from the GitLab UI on Sentry errors [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180434_issues_created_from_gitlab_error_tracking_ui.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `counts.issues_created_gitlab_alerts` @@ -3052,7 +3052,7 @@ Count of all issues created from GitLab alerts (bot and non-bot) [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180443_issues_created_gitlab_alerts.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -3064,7 +3064,7 @@ Count of issues created manually by non-bot users from GitLab alerts [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180445_issues_created_manually_from_alerts.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -3076,7 +3076,7 @@ Count of issues where a user have added AND removed a zoom meeting using slash c [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180438_issues_using_zoom_quick_actions.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -3088,7 +3088,7 @@ Count of issues where a user has linked a Zoom meeting [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180436_issues_with_associated_zoom_link.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -3100,7 +3100,7 @@ Count of issues where a user has embedded a Grafana chart [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180440_issues_with_embedded_grafana_charts_approx.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -4288,11 +4288,11 @@ Counts of Projects that have incident issues, regardless of status. [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180453_projects_creating_incidents.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `counts.projects_custom_issue_tracker_active` @@ -5212,11 +5212,11 @@ Count of projects with alerts created in given time period [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180458_projects_with_alerts_created.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `counts.projects_with_alerts_service_enabled` @@ -5224,7 +5224,7 @@ Count of projects that have enabled the Alerts service [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180456_projects_with_alerts_service_enabled.yml) -Group: `group::health` +Group: `group::monitor` Status: `removed` @@ -5236,11 +5236,11 @@ Count of projects with at least 1 enabled integration [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180500_projects_with_enabled_alert_integrations.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `counts.projects_with_error_tracking_enabled` @@ -5248,7 +5248,7 @@ Count of projects that have enabled Error tracking via Sentry [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180454_projects_with_error_tracking_enabled.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` @@ -5810,49 +5810,49 @@ Tiers: `free`, `premium`, `ultimate` Cumulative count of usages of publish operation -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180502_status_page_incident_publishes.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_all/20210216180502_status_page_incident_publishes.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `ultimate` ### `counts.status_page_incident_unpublishes` Cumulative count of usages of unpublish operation -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180504_status_page_incident_unpublishes.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_all/20210216180504_status_page_incident_unpublishes.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `ultimate` ### `counts.status_page_issues` Issues published to a Status Page -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180507_status_page_issues.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_all/20210216180507_status_page_issues.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `ultimate` ### `counts.status_page_projects` Projects with status page enabled -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180506_status_page_projects.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_all/20210216180506_status_page_projects.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `ultimate` ### `counts.successful_deployments` @@ -6628,11 +6628,11 @@ Count of unique users per month to take an action on an alert [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180509_incident_management_alerts_total_unique_counts.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `counts_monthly.aggregated_metrics.incident_management_incidents_total_unique_counts` @@ -6640,11 +6640,11 @@ Count of unique users per month to take an action on an incident [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180511_incident_management_incidents_total_unique_counts.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `counts_monthly.aggregated_metrics.product_analytics_test_metrics_intersection` @@ -6842,25 +6842,25 @@ Tiers: `premium`, `ultimate` Count of unique users per week to take an action on an alert -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180513_incident_management_alerts_total_unique_counts.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180513_incident_management_alerts_total_unique_counts.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `counts_weekly.aggregated_metrics.incident_management_incidents_total_unique_counts` Count of unique users per week to take an action on an incident -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180515_incident_management_incidents_total_unique_counts.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180515_incident_management_incidents_total_unique_counts.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `counts_weekly.aggregated_metrics.product_analytics_test_metrics_intersection` @@ -11712,363 +11712,363 @@ Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_alert_assigned_monthly` -Missing description +Count of an alert's assignments per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180533_incident_management_alert_assigned_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_alert_assigned_weekly` -Missing description +Count of an alert's assignments per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180532_incident_management_alert_assigned_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180532_incident_management_alert_assigned_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_alert_status_changed_monthly` -Missing description +Count of an alert's status changes per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180530_incident_management_alert_status_changed_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_alert_status_changed_weekly` -Missing description +Count of an alert's status changes per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180528_incident_management_alert_status_changed_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180528_incident_management_alert_status_changed_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_alert_todo_monthly` -Missing description +Count of alerts added to the TODO list per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180537_incident_management_alert_todo_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_alert_todo_weekly` -Missing description +Count of alerts added to the TODO list per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180535_incident_management_alert_todo_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180535_incident_management_alert_todo_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_assigned_monthly` -Missing description +Count of an incidents's assignments per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180552_incident_management_incident_assigned_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_assigned_weekly` -Missing description +Count of an incidents's assignments per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180550_incident_management_incident_assigned_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180550_incident_management_incident_assigned_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_change_confidential_monthly` -Missing description +Count of incidents changed to confidential per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180618_incident_management_incident_change_confidential_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_change_confidential_weekly` -Missing description +Count of incidents changed to confidential per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180616_incident_management_incident_change_confidential_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180616_incident_management_incident_change_confidential_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_closed_monthly` -Missing description +Count of incidents closed per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180548_incident_management_incident_closed_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_closed_weekly` -Missing description +Count of incidents closed per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180546_incident_management_incident_closed_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180546_incident_management_incident_closed_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_comment_monthly` -Missing description +Count of comments per month on incidents [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180559_incident_management_incident_comment_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_comment_weekly` -Missing description +Count of comments per week on incidents -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180558_incident_management_incident_comment_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180558_incident_management_incident_comment_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_created_monthly` -Missing description +Count of incidents created per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180541_incident_management_incident_created_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_created_weekly` -Missing description +Count of incidents created per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180539_incident_management_incident_created_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180539_incident_management_incident_created_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_published_monthly` -Missing description +Count of published incidents per month -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180607_incident_management_incident_published_monthly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210216180607_incident_management_incident_published_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_published_weekly` -Missing description +Count of published incidents per week [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180605_incident_management_incident_published_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_relate_monthly` -Missing description +Count of issues added per month that are related to an incident [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180611_incident_management_incident_relate_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_relate_weekly` -Missing description +Count of issues added per week that are related to an incident -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180609_incident_management_incident_relate_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180609_incident_management_incident_relate_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_reopened_monthly` -Missing description +Count of incidents reopened per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180545_incident_management_incident_reopened_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_reopened_weekly` -Missing description +Count of incidents reopened per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180543_incident_management_incident_reopened_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180543_incident_management_incident_reopened_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_todo_monthly` -Missing description +Count of incidents added to the TODO list per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180556_incident_management_incident_todo_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_todo_weekly` -Missing description +Count of incidents added to the TODO list per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180554_incident_management_incident_todo_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180554_incident_management_incident_todo_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_unrelate_monthly` -Missing description +Count of issues removed per month that are related to an incident [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180614_incident_management_incident_unrelate_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_unrelate_weekly` -Missing description +Count of issues removed per week that are related to an incident -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180612_incident_management_incident_unrelate_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180612_incident_management_incident_unrelate_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_zoom_meeting_monthly` -Missing description +Count of Zoom meetings about incidents per month -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210216180603_incident_management_incident_zoom_meeting_monthly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180603_incident_management_incident_zoom_meeting_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_incident_zoom_meeting_weekly` -Missing description +Count of Zoom meetings about incidents per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180601_incident_management_incident_zoom_meeting_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180601_incident_management_incident_zoom_meeting_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly` -Missing description +Count of total unique incidents per month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180622_incident_management_total_unique_counts_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management.incident_management_total_unique_counts_weekly` -Missing description +Count of total unique incidents per week -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180620_incident_management_total_unique_counts_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180620_incident_management_total_unique_counts_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management_alerts.incident_management_alert_create_incident_monthly` @@ -12076,23 +12076,23 @@ Count of unique users per month to create an incident corresponding to an alert [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180625_incident_management_alert_create_incident_monthly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management_alerts.incident_management_alert_create_incident_weekly` Count of unique users per week to create an incident corresponding to an alert -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216180623_incident_management_alert_create_incident_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216180623_incident_management_alert_create_incident_weekly.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: +Tiers: `free`, `premium`, `ultimate` ### `redis_hll_counters.incident_management_oncall.i_incident_management_oncall_notification_sent_monthly` @@ -16972,13 +16972,13 @@ Tiers: `free`, `premium`, `ultimate` Projects where Incident SLA is enabled -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180522_projects_incident_sla_enabled.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_all/20210216180522_projects_incident_sla_enabled.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `premium`, `ultimate` ### `usage_activity_by_stage.monitor.projects_with_alert_incidents` @@ -16986,11 +16986,11 @@ Count of unique projects with an incident from an alert [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180520_projects_with_alert_incidents.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `usage_activity_by_stage.monitor.projects_with_enabled_alert_integrations_histogram` @@ -17012,11 +17012,11 @@ Projects where error tracking is enabled [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180517_projects_with_error_tracking_enabled.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `usage_activity_by_stage.monitor.projects_with_incidents` @@ -17024,11 +17024,11 @@ Count of unique projects with an incident [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216180518_projects_with_incidents.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `usage_activity_by_stage.monitor.projects_with_tracing_enabled` @@ -18956,11 +18956,11 @@ Count of unique projects with an incident from an alert created in the last mont [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180526_projects_with_alert_incidents.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `usage_activity_by_stage_monthly.monitor.projects_with_error_tracking_enabled` @@ -18980,11 +18980,11 @@ Count of unique projects with an incident created in the last month [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210216180524_projects_with_incidents.yml) -Group: `group::health` +Group: `group::monitor` Status: `data_available` -Tiers: `free` +Tiers: `free`, `premium`, `ultimate` ### `usage_activity_by_stage_monthly.monitor.projects_with_tracing_enabled` diff --git a/doc/development/usage_ping/index.md b/doc/development/usage_ping/index.md index 0e9ff83fd09..c479fc37896 100644 --- a/doc/development/usage_ping/index.md +++ b/doc/development/usage_ping/index.md @@ -1071,7 +1071,7 @@ Ensure you comply with the [Changelog entries guide](../changelog.md). ### 9. Ask for a Product Intelligence Review -On GitLab.com, we have DangerBot set up to monitor Product Intelligence related files and DangerBot recommends a [Product Intelligence review](review_guidelines.md). Mention `@gitlab-org/growth/product_intelligence/engineers` in your MR for a review. +On GitLab.com, we have DangerBot set up to monitor Product Intelligence related files and DangerBot recommends a [Product Intelligence review](review_guidelines.md). ### 10. Verify your metric diff --git a/lib/gitlab/checks/container_moved.rb b/lib/gitlab/checks/container_moved.rb new file mode 100644 index 00000000000..41180bbf246 --- /dev/null +++ b/lib/gitlab/checks/container_moved.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module Gitlab + module Checks + class ContainerMoved < PostPushMessage + REDIRECT_NAMESPACE = "redirect_namespace" + + def initialize(repository, user, protocol, redirected_path) + @redirected_path = redirected_path + + super(repository, user, protocol) + end + + def message + <<~MESSAGE + #{container.class.model_name.human} '#{redirected_path}' was moved to '#{container.full_path}'. + + Please update your Git remote: + + git remote set-url origin #{url_to_repo} + MESSAGE + end + + private + + attr_reader :redirected_path + + def self.message_key(user, repository) + "#{REDIRECT_NAMESPACE}:#{user.id}:#{repository.gl_repository}" + end + + # TODO: Remove in the next release + # https://gitlab.com/gitlab-org/gitlab/-/issues/292030 + def self.legacy_message_key(user, repository) + return unless repository.project + + "#{REDIRECT_NAMESPACE}:#{user.id}:#{repository.project.id}" + end + end + end +end diff --git a/lib/gitlab/checks/post_push_message.rb b/lib/gitlab/checks/post_push_message.rb index 0d93e7ac8a1..09407f45e54 100644 --- a/lib/gitlab/checks/post_push_message.rb +++ b/lib/gitlab/checks/post_push_message.rb @@ -9,21 +9,32 @@ module Gitlab @protocol = protocol end - def self.fetch_message(user_id, project_id) - key = message_key(user_id, project_id) + def self.fetch_message(user, repository) + key = message_key(user, repository) + + # Also check for messages in the legacy key + # TODO: Remove in the next release + # https://gitlab.com/gitlab-org/gitlab/-/issues/292030 + legacy_key = legacy_message_key(user, repository) if respond_to?(:legacy_message_key) Gitlab::Redis::SharedState.with do |redis| message = redis.get(key) redis.del(key) - message + + if legacy_key + legacy_message = redis.get(legacy_key) + redis.del(legacy_key) + end + + legacy_message || message end end def add_message - return unless user.present? && project.present? + return unless user && repository Gitlab::Redis::SharedState.with do |redis| - key = self.class.message_key(user.id, project.id) + key = self.class.message_key(user, repository) redis.setex(key, 5.minutes, message) end end @@ -39,7 +50,7 @@ module Gitlab delegate :project, to: :repository, allow_nil: true delegate :container, to: :repository, allow_nil: false - def self.message_key(user_id, project_id) + def self.message_key(user, repository) raise NotImplementedError end diff --git a/lib/gitlab/checks/project_created.rb b/lib/gitlab/checks/project_created.rb index 362562068e9..ea3be883be6 100644 --- a/lib/gitlab/checks/project_created.rb +++ b/lib/gitlab/checks/project_created.rb @@ -21,8 +21,16 @@ module Gitlab private - def self.message_key(user_id, project_id) - "#{PROJECT_CREATED}:#{user_id}:#{project_id}" + def self.message_key(user, repository) + "#{PROJECT_CREATED}:#{user.id}:#{repository.gl_repository}" + end + + # TODO: Remove in the next release + # https://gitlab.com/gitlab-org/gitlab/-/issues/292030 + def self.legacy_message_key(user, repository) + return unless repository.project + + "#{PROJECT_CREATED}:#{user.id}:#{repository.project.id}" end def project_url diff --git a/lib/gitlab/checks/project_moved.rb b/lib/gitlab/checks/project_moved.rb deleted file mode 100644 index 4cc35de9c2d..00000000000 --- a/lib/gitlab/checks/project_moved.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Checks - class ProjectMoved < PostPushMessage - REDIRECT_NAMESPACE = "redirect_namespace" - - def initialize(repository, user, protocol, redirected_path) - @redirected_path = redirected_path - - super(repository, user, protocol) - end - - def message - <<~MESSAGE - Project '#{redirected_path}' was moved to '#{project.full_path}'. - - Please update your Git remote: - - git remote set-url origin #{url_to_repo} - MESSAGE - end - - private - - attr_reader :redirected_path - - def self.message_key(user_id, project_id) - "#{REDIRECT_NAMESPACE}:#{user_id}:#{project_id}" - end - end - end -end diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index b2a65d9f2d8..553a10eb054 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -9,7 +9,6 @@ module Gitlab ForbiddenError = Class.new(StandardError) NotFoundError = Class.new(StandardError) TimeoutError = Class.new(StandardError) - ProjectMovedError = Class.new(NotFoundError) # Use the magic string '_any' to indicate we do not know what the # changes are. This is also what gitlab-shell does. @@ -148,11 +147,11 @@ module Gitlab raise NotFoundError, not_found_message if container.nil? check_project! if project? + add_container_moved_message! end def check_project! check_project_accessibility! - add_project_moved_message! end def check_custom_action @@ -221,12 +220,12 @@ module Gitlab error_message(:project_not_found) end - def add_project_moved_message! + def add_container_moved_message! return if redirected_path.nil? - project_moved = Checks::ProjectMoved.new(repository, user, protocol, redirected_path) + container_moved = Checks::ContainerMoved.new(repository, user, protocol, redirected_path) - project_moved.add_message + container_moved.add_message end def check_command_disabled! diff --git a/lib/gitlab/repo_path.rb b/lib/gitlab/repo_path.rb index 42b94d5cf3b..a4d1adf7671 100644 --- a/lib/gitlab/repo_path.rb +++ b/lib/gitlab/repo_path.rb @@ -13,7 +13,6 @@ module Gitlab # @returns [HasRepository, Project, String, String] def self.parse(path) repo_path = path.delete_prefix('/').delete_suffix('.git') - redirected_path = nil # Detect the repo type based on the path, the first one tried is the project # type, which does not have a suffix. @@ -26,9 +25,11 @@ module Gitlab # Removing the suffix (.wiki, .design, ...) from the project path full_path = repo_path.chomp(type.path_suffix) - container, project, redirected_path = find_container(type, full_path) + container, project = find_container(type, full_path) + next unless container - return [container, project, type, redirected_path] if container + redirected_path = repo_path if redirected?(container, repo_path) + return [container, project, type, redirected_path] end # When a project did not exist, the parsed repo_type would be empty. @@ -40,32 +41,28 @@ module Gitlab # Returns an array containing: # - The repository container # - The related project (if available) - # - The original container path (if redirected) # # @returns [HasRepository, Project, String] def self.find_container(type, full_path) - return [nil, nil, nil] if full_path.blank? + return [nil, nil] if full_path.blank? if type.snippet? - snippet, redirected_path = find_snippet(full_path) + snippet = find_snippet(full_path) - [snippet, snippet&.project, redirected_path] + [snippet, snippet&.project] elsif type.wiki? - wiki, redirected_path = find_wiki(full_path) + wiki = find_wiki(full_path) - [wiki, wiki.try(:project), redirected_path] + [wiki, wiki.try(:project)] else - project, redirected_path = find_project(full_path) + project = find_project(full_path) - [project, project, redirected_path] + [project, project] end end def self.find_project(project_path) - project = Project.find_by_full_path(project_path, follow_redirects: true) - redirected_path = project_path if redirected?(project, project_path) - - [project, redirected_path] + Project.find_by_full_path(project_path, follow_redirects: true) end def self.redirected?(container, container_path) @@ -77,11 +74,11 @@ module Gitlab # - h5bp/html5-boilerplate/snippets/53 def self.find_snippet(snippet_path) snippet_id, project_path = extract_snippet_info(snippet_path) - return [nil, nil] unless snippet_id + return unless snippet_id - project, redirected_path = find_project(project_path) if project_path + project = find_project(project_path) if project_path - [Snippet.find_by_id_and_project(id: snippet_id, project: project), redirected_path] + Snippet.find_by_id_and_project(id: snippet_id, project: project) end # Wiki path can be either: @@ -93,10 +90,9 @@ module Gitlab # - group/subgroup def self.find_wiki(container_path) container = Routable.find_by_full_path(container_path, follow_redirects: true) - redirected_path = container_path if redirected?(container, container_path) # In CE, Group#wiki is not available so this will return nil for a group path. - [container&.try(:wiki), redirected_path] + container&.try(:wiki) end def self.extract_snippet_info(snippet_path) diff --git a/lib/tasks/gitlab/assets.rake b/lib/tasks/gitlab/assets.rake index 54e74fd9c8b..db10428e0dc 100644 --- a/lib/tasks/gitlab/assets.rake +++ b/lib/tasks/gitlab/assets.rake @@ -5,8 +5,8 @@ require 'fileutils' module Tasks module Gitlab module Assets - FOSS_ASSET_FOLDERS = %w[app/assets app/views fixtures/emojis vendor/assets/javascripts].freeze - EE_ASSET_FOLDERS = %w[ee/app/assets ee/app/views].freeze + FOSS_ASSET_FOLDERS = %w[app/assets fixtures/emojis vendor/assets/javascripts].freeze + EE_ASSET_FOLDERS = %w[ee/app/assets].freeze JS_ASSET_PATTERNS = %w[*.js config/**/*.js].freeze JS_ASSET_FILES = %w[package.json yarn.lock].freeze MASTER_MD5_HASH_FILE = 'master-assets-hash.txt' diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 5aceeabc255..74a12aee1b7 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1927,6 +1927,9 @@ msgstr "" msgid "Add a homepage to your wiki that contains information about your project and GitLab will display it here instead of this message." msgstr "" +msgid "Add a horizontal rule" +msgstr "" + msgid "Add a line" msgstr "" diff --git a/spec/factories/audit_events.rb b/spec/factories/audit_events.rb index 05b86d2f13b..10f60591922 100644 --- a/spec/factories/audit_events.rb +++ b/spec/factories/audit_events.rb @@ -51,6 +51,7 @@ FactoryBot.define do trait :unauthenticated do author_id { -1 } + author_name { 'An unauthenticated user' } details do { custom_message: 'Custom action', diff --git a/spec/frontend/content_editor/components/top_toolbar_spec.js b/spec/frontend/content_editor/components/top_toolbar_spec.js index 0d55fa730ae..a5d9a626a04 100644 --- a/spec/frontend/content_editor/components/top_toolbar_spec.js +++ b/spec/frontend/content_editor/components/top_toolbar_spec.js @@ -39,17 +39,18 @@ describe('content_editor/components/top_toolbar', () => { }); describe.each` - testId | controlProps - ${'bold'} | ${{ contentType: 'bold', iconName: 'bold', label: 'Bold text', editorCommand: 'toggleBold' }} - ${'italic'} | ${{ contentType: 'italic', iconName: 'italic', label: 'Italic text', editorCommand: 'toggleItalic' }} - ${'strike'} | ${{ contentType: 'strike', iconName: 'strikethrough', label: 'Strikethrough', editorCommand: 'toggleStrike' }} - ${'code'} | ${{ contentType: 'code', iconName: 'code', label: 'Code', editorCommand: 'toggleCode' }} - ${'blockquote'} | ${{ contentType: 'blockquote', iconName: 'quote', label: 'Insert a quote', editorCommand: 'toggleBlockquote' }} - ${'bullet-list'} | ${{ contentType: 'bulletList', iconName: 'list-bulleted', label: 'Add a bullet list', editorCommand: 'toggleBulletList' }} - ${'ordered-list'} | ${{ contentType: 'orderedList', iconName: 'list-numbered', label: 'Add a numbered list', editorCommand: 'toggleOrderedList' }} - ${'code-block'} | ${{ contentType: 'codeBlock', iconName: 'doc-code', label: 'Insert a code block', editorCommand: 'toggleCodeBlock' }} - ${'text-styles'} | ${{}} - ${'link'} | ${{}} + testId | controlProps + ${'bold'} | ${{ contentType: 'bold', iconName: 'bold', label: 'Bold text', editorCommand: 'toggleBold' }} + ${'italic'} | ${{ contentType: 'italic', iconName: 'italic', label: 'Italic text', editorCommand: 'toggleItalic' }} + ${'strike'} | ${{ contentType: 'strike', iconName: 'strikethrough', label: 'Strikethrough', editorCommand: 'toggleStrike' }} + ${'code'} | ${{ contentType: 'code', iconName: 'code', label: 'Code', editorCommand: 'toggleCode' }} + ${'blockquote'} | ${{ contentType: 'blockquote', iconName: 'quote', label: 'Insert a quote', editorCommand: 'toggleBlockquote' }} + ${'bullet-list'} | ${{ contentType: 'bulletList', iconName: 'list-bulleted', label: 'Add a bullet list', editorCommand: 'toggleBulletList' }} + ${'ordered-list'} | ${{ contentType: 'orderedList', iconName: 'list-numbered', label: 'Add a numbered list', editorCommand: 'toggleOrderedList' }} + ${'horizontal-rule'} | ${{ contentType: 'horizontalRule', iconName: 'dash', label: 'Add a horizontal rule', editorCommand: 'setHorizontalRule' }} + ${'code-block'} | ${{ contentType: 'codeBlock', iconName: 'doc-code', label: 'Insert a code block', editorCommand: 'toggleCodeBlock' }} + ${'text-styles'} | ${{}} + ${'link'} | ${{}} `('given a $testId toolbar control', ({ testId, controlProps }) => { beforeEach(() => { buildWrapper(); diff --git a/spec/frontend/content_editor/extensions/horizontal_rule_spec.js b/spec/frontend/content_editor/extensions/horizontal_rule_spec.js new file mode 100644 index 00000000000..a1bc7f0e8ed --- /dev/null +++ b/spec/frontend/content_editor/extensions/horizontal_rule_spec.js @@ -0,0 +1,20 @@ +import { hrInputRuleRegExp } from '~/content_editor/extensions/horizontal_rule'; + +describe('content_editor/extensions/horizontal_rule', () => { + describe.each` + input | matches + ${'---'} | ${true} + ${'--'} | ${false} + ${'---x'} | ${false} + ${' ---x'} | ${false} + ${' --- '} | ${false} + ${'x---x'} | ${false} + ${'x---'} | ${false} + `('hrInputRuleRegExp', ({ input, matches }) => { + it(`${matches ? 'matches' : 'does not match'}: "${input}"`, () => { + const match = new RegExp(hrInputRuleRegExp).test(input); + + expect(match).toBe(matches); + }); + }); +}); diff --git a/spec/frontend/fixtures/api_markdown.yml b/spec/frontend/fixtures/api_markdown.yml index 3274e914f03..07dbd026a39 100644 --- a/spec/frontend/fixtures/api_markdown.yml +++ b/spec/frontend/fixtures/api_markdown.yml @@ -10,6 +10,8 @@ markdown: '`code`' - name: strike markdown: '~~del~~' +- name: horizontal_rule + markdown: '---' - name: link markdown: '[GitLab](https://gitlab.com)' - name: code_block diff --git a/spec/lib/gitlab/checks/project_moved_spec.rb b/spec/lib/gitlab/checks/container_moved_spec.rb index 469aea8d093..00ef5604e1d 100644 --- a/spec/lib/gitlab/checks/project_moved_spec.rb +++ b/spec/lib/gitlab/checks/container_moved_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Checks::ProjectMoved, :clean_gitlab_redis_shared_state do +RSpec.describe Gitlab::Checks::ContainerMoved, :clean_gitlab_redis_shared_state do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository, :wiki_repo, namespace: user.namespace) } @@ -14,27 +14,48 @@ RSpec.describe Gitlab::Checks::ProjectMoved, :clean_gitlab_redis_shared_state do subject { described_class.new(repository, git_user, protocol, redirect_path) } describe '.fetch_message' do + let(:key) { "redirect_namespace:#{user.id}:#{project.repository.gl_repository}" } + let(:legacy_key) { "redirect_namespace:#{user.id}:#{project.id}" } + context 'with a redirect message queue' do before do subject.add_message end it 'returns the redirect message' do - expect(described_class.fetch_message(user.id, project.id)).to eq(subject.message) + expect(described_class.fetch_message(user, project.repository)).to eq(subject.message) end it 'deletes the redirect message from redis' do - expect(Gitlab::Redis::SharedState.with { |redis| redis.get("redirect_namespace:#{user.id}:#{project.id}") }).not_to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).not_to be_nil - described_class.fetch_message(user.id, project.id) + described_class.fetch_message(user, project.repository) - expect(Gitlab::Redis::SharedState.with { |redis| redis.get("redirect_namespace:#{user.id}:#{project.id}") }).to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).to be_nil + end + + context 'with a message in the legacy key' do + before do + Gitlab::Redis::SharedState.with do |redis| + redis.set(legacy_key, 'legacy message') + end + end + + it 'returns and deletes the legacy message' do + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).not_to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(legacy_key) }).not_to be_nil + + expect(described_class.fetch_message(user, project.repository)).to eq('legacy message') + + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(legacy_key) }).to be_nil + end end end context 'with no redirect message queue' do it 'returns nil' do - expect(described_class.fetch_message(1, 2)).to be_nil + expect(described_class.fetch_message(user, project.repository)).to be_nil end end end @@ -58,7 +79,7 @@ RSpec.describe Gitlab::Checks::ProjectMoved, :clean_gitlab_redis_shared_state do shared_examples 'returns redirect message' do it do message = <<~MSG - Project '#{redirect_path}' was moved to '#{project.full_path}'. + #{container_label} '#{redirect_path}' was moved to '#{repository.container.full_path}'. Please update your Git remote: @@ -86,6 +107,7 @@ RSpec.describe Gitlab::Checks::ProjectMoved, :clean_gitlab_redis_shared_state do context 'with project' do it_behaves_like 'errors per protocol' do + let(:container_label) { 'Project' } let(:http_url_to_repo) { project.http_url_to_repo } let(:ssh_url_to_repo) { project.ssh_url_to_repo } end @@ -95,6 +117,7 @@ RSpec.describe Gitlab::Checks::ProjectMoved, :clean_gitlab_redis_shared_state do let(:repository) { project.wiki.repository } it_behaves_like 'errors per protocol' do + let(:container_label) { 'Project wiki' } let(:http_url_to_repo) { project.wiki.http_url_to_repo } let(:ssh_url_to_repo) { project.wiki.ssh_url_to_repo } end @@ -106,6 +129,7 @@ RSpec.describe Gitlab::Checks::ProjectMoved, :clean_gitlab_redis_shared_state do let(:repository) { snippet.repository } it_behaves_like 'errors per protocol' do + let(:container_label) { 'Project snippet' } let(:http_url_to_repo) { snippet.http_url_to_repo } let(:ssh_url_to_repo) { snippet.ssh_url_to_repo } end @@ -116,8 +140,10 @@ RSpec.describe Gitlab::Checks::ProjectMoved, :clean_gitlab_redis_shared_state do let(:repository) { snippet.repository } - it 'returns nil' do - expect(subject.add_message).to be_nil + it_behaves_like 'errors per protocol' do + let(:container_label) { 'Personal snippet' } + let(:http_url_to_repo) { snippet.http_url_to_repo } + let(:ssh_url_to_repo) { snippet.ssh_url_to_repo } end end end diff --git a/spec/lib/gitlab/checks/project_created_spec.rb b/spec/lib/gitlab/checks/project_created_spec.rb index 74e43b04b6b..6a2e4201030 100644 --- a/spec/lib/gitlab/checks/project_created_spec.rb +++ b/spec/lib/gitlab/checks/project_created_spec.rb @@ -13,27 +13,48 @@ RSpec.describe Gitlab::Checks::ProjectCreated, :clean_gitlab_redis_shared_state subject { described_class.new(repository, git_user, 'http') } describe '.fetch_message' do + let(:key) { "project_created:#{user.id}:#{project.repository.gl_repository}" } + let(:legacy_key) { "project_created:#{user.id}:#{project.id}" } + context 'with a project created message queue' do before do subject.add_message end it 'returns project created message' do - expect(described_class.fetch_message(user.id, project.id)).to eq(subject.message) + expect(described_class.fetch_message(user, project.repository)).to eq(subject.message) end it 'deletes the project created message from redis' do - expect(Gitlab::Redis::SharedState.with { |redis| redis.get("project_created:#{user.id}:#{project.id}") }).not_to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).not_to be_nil + + described_class.fetch_message(user, project.repository) + + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).to be_nil + end + + context 'with a message in the legacy key' do + before do + Gitlab::Redis::SharedState.with do |redis| + redis.set(legacy_key, 'legacy message') + end + end + + it 'returns and deletes the legacy message' do + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).not_to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(legacy_key) }).not_to be_nil - described_class.fetch_message(user.id, project.id) + expect(described_class.fetch_message(user, project.repository)).to eq('legacy message') - expect(Gitlab::Redis::SharedState.with { |redis| redis.get("project_created:#{user.id}:#{project.id}") }).to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(key) }).to be_nil + expect(Gitlab::Redis::SharedState.with { |redis| redis.get(legacy_key) }).to be_nil + end end end context 'with no project created message queue' do it 'returns nil' do - expect(described_class.fetch_message(1, 2)).to be_nil + expect(described_class.fetch_message(user, project.repository)).to be_nil end end end diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index 3ee0310a9a2..3a10ce1a30e 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -265,7 +265,7 @@ RSpec.describe Gitlab::GitAccess do it 'enqueues a redirected message for pushing' do push_access_check - expect(Gitlab::Checks::ProjectMoved.fetch_message(user.id, project.id)).not_to be_nil + expect(Gitlab::Checks::ContainerMoved.fetch_message(user, project.repository)).not_to be_nil end it 'allows push and pull access' do diff --git a/spec/lib/gitlab/repo_path_spec.rb b/spec/lib/gitlab/repo_path_spec.rb index 912efa6a5db..6cff0eff7e8 100644 --- a/spec/lib/gitlab/repo_path_spec.rb +++ b/spec/lib/gitlab/repo_path_spec.rb @@ -13,11 +13,11 @@ RSpec.describe ::Gitlab::RepoPath do describe '.parse' do context 'a repository storage path' do - it 'parses a full repository project path' do + it 'parses a full project repository path' do expect(described_class.parse(project.repository.full_path)).to eq([project, project, Gitlab::GlRepository::PROJECT, nil]) end - it 'parses a full wiki project path' do + it 'parses a full project wiki repository path' do expect(described_class.parse(project.wiki.repository.full_path)).to eq([project.wiki, project, Gitlab::GlRepository::WIKI, nil]) end @@ -49,7 +49,7 @@ RSpec.describe ::Gitlab::RepoPath do end it 'parses a relative wiki path' do - expect(described_class.parse(redirect.path + '.wiki.git')).to eq([project.wiki, project, Gitlab::GlRepository::WIKI, redirect_route]) + expect(described_class.parse(redirect.path + '.wiki.git')).to eq([project.wiki, project, Gitlab::GlRepository::WIKI, "#{redirect_route}.wiki"]) end it 'parses a relative path starting with /' do @@ -57,7 +57,7 @@ RSpec.describe ::Gitlab::RepoPath do end it 'parses a redirected project snippet repository path' do - expect(described_class.parse(redirect.path + "/snippets/#{project_snippet.id}.git")).to eq([project_snippet, project, Gitlab::GlRepository::SNIPPET, redirect_route]) + expect(described_class.parse(redirect.path + "/snippets/#{project_snippet.id}.git")).to eq([project_snippet, project, Gitlab::GlRepository::SNIPPET, "#{redirect_route}/snippets/#{project_snippet.id}"]) end end end @@ -70,8 +70,8 @@ RSpec.describe ::Gitlab::RepoPath do describe '.find_project' do context 'when finding a project by its canonical path' do context 'when the cases match' do - it 'returns the project and nil' do - expect(described_class.find_project(project.full_path)).to eq([project, nil]) + it 'returns the project' do + expect(described_class.find_project(project.full_path)).to eq(project) end end @@ -80,45 +80,45 @@ RSpec.describe ::Gitlab::RepoPath do # easy and safe to redirect someone to the correctly-cased URL. For git # requests, we should accept wrongly-cased URLs because it is a pain to # block people's git operations and force them to update remote URLs. - it 'returns the project and nil' do - expect(described_class.find_project(project.full_path.upcase)).to eq([project, nil]) + it 'returns the project' do + expect(described_class.find_project(project.full_path.upcase)).to eq(project) end end end context 'when finding a project via a redirect' do - it 'returns the project and nil' do - expect(described_class.find_project(redirect.path)).to eq([project, redirect.path]) + it 'returns the project' do + expect(described_class.find_project(redirect.path)).to eq(project) end end end describe '.find_snippet' do it 'extracts path and id from personal snippet route' do - expect(described_class.find_snippet("snippets/#{personal_snippet.id}")).to eq([personal_snippet, nil]) + expect(described_class.find_snippet("snippets/#{personal_snippet.id}")).to eq(personal_snippet) end it 'extracts path and id from project snippet route' do - expect(described_class.find_snippet("#{project.full_path}/snippets/#{project_snippet.id}")).to eq([project_snippet, nil]) + expect(described_class.find_snippet("#{project.full_path}/snippets/#{project_snippet.id}")).to eq(project_snippet) end it 'returns nil for invalid snippet paths' do aggregate_failures do - expect(described_class.find_snippet("snippets/#{project_snippet.id}")).to eq([nil, nil]) - expect(described_class.find_snippet("#{project.full_path}/snippets/#{personal_snippet.id}")).to eq([nil, nil]) - expect(described_class.find_snippet('')).to eq([nil, nil]) + expect(described_class.find_snippet("snippets/#{project_snippet.id}")).to be_nil + expect(described_class.find_snippet("#{project.full_path}/snippets/#{personal_snippet.id}")).to be_nil + expect(described_class.find_snippet('')).to be_nil end end it 'returns nil for snippets not associated with the project' do snippet = create(:project_snippet) - expect(described_class.find_snippet("#{project.full_path}/snippets/#{snippet.id}")).to eq([nil, nil]) + expect(described_class.find_snippet("#{project.full_path}/snippets/#{snippet.id}")).to be_nil end context 'when finding a project snippet via a redirect' do - it 'returns the project and true' do - expect(described_class.find_snippet("#{redirect.path}/snippets/#{project_snippet.id}")).to eq([project_snippet, redirect.path]) + it 'returns the project snippet' do + expect(described_class.find_snippet("#{redirect.path}/snippets/#{project_snippet.id}")).to eq(project_snippet) end end end diff --git a/spec/models/audit_event_spec.rb b/spec/models/audit_event_spec.rb index 5c87c2e68db..4af84ba1ee6 100644 --- a/spec/models/audit_event_spec.rb +++ b/spec/models/audit_event_spec.rb @@ -3,9 +3,6 @@ require 'spec_helper' RSpec.describe AuditEvent do - let_it_be(:audit_event) { create(:project_audit_event) } - subject { audit_event } - describe 'validations' do include_examples 'validates IP address' do let(:attribute) { :ip_address } @@ -13,6 +10,71 @@ RSpec.describe AuditEvent do end end + describe 'callbacks' do + describe '#parallel_persist' do + shared_examples 'a parallel persisted field' do + using RSpec::Parameterized::TableSyntax + + where(:column, :details, :expected_value) do + :value | nil | :value + nil | :value | :value + :value | :another_value | :value + nil | nil | nil + end + + with_them do + let(:values) { { value: value, another_value: "#{value}88" } } + + let(:audit_event) do + build(:audit_event, name => values[column], details: { name => values[details] }) + end + + it 'sets both values to be the same', :aggregate_failures do + audit_event.validate + + expect(audit_event[name]).to eq(values[expected_value]) + expect(audit_event.details[name]).to eq(values[expected_value]) + end + end + end + + context 'wih author_name' do + let(:name) { :author_name } + let(:value) { 'Mary Poppins' } + + it_behaves_like 'a parallel persisted field' + end + + context 'with entity_path' do + let(:name) { :entity_path } + let(:value) { 'gitlab-org' } + + it_behaves_like 'a parallel persisted field' + end + + context 'with target_details' do + let(:name) { :target_details } + let(:value) { 'gitlab-org/gitlab' } + + it_behaves_like 'a parallel persisted field' + end + + context 'with target_type' do + let(:name) { :target_type } + let(:value) { 'Project' } + + it_behaves_like 'a parallel persisted field' + end + + context 'with target_id' do + let(:name) { :target_id } + let(:value) { 8 } + + it_behaves_like 'a parallel persisted field' + end + end + end + describe '#as_json' do context 'ip_address' do subject { build(:group_audit_event, ip_address: '192.168.1.1').as_json } diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb index 3405d66f216..5f1454f6c5d 100644 --- a/spec/requests/api/internal/base_spec.rb +++ b/spec/requests/api/internal/base_spec.rb @@ -1176,59 +1176,68 @@ RSpec.describe API::Internal::Base do allow_any_instance_of(Gitlab::Identifier).to receive(:identify).and_return(user) end - context 'with Project' do - it 'executes PostReceiveService' do - message = <<~MESSAGE.strip - To create a merge request for #{branch_name}, visit: - http://#{Gitlab.config.gitlab.host}/#{project.full_path}/-/merge_requests/new?merge_request%5Bsource_branch%5D=#{branch_name} - MESSAGE + shared_examples 'runs post-receive hooks' do + let(:gl_repository) { container.repository.gl_repository } + let(:messages) { [] } + it 'executes PostReceiveService' do subject + expect(response).to have_gitlab_http_status(:ok) expect(json_response).to eq({ - 'messages' => [{ 'message' => message, 'type' => 'basic' }], + 'messages' => messages, 'reference_counter_decreased' => true }) end + it 'tries to notify that the container has moved' do + expect(Gitlab::Checks::ContainerMoved).to receive(:fetch_message).with(user, container.repository) + + subject + end + it_behaves_like 'storing arguments in the application context' do - let(:expected_params) { { user: user.username, project: project.full_path } } + let(:expected_params) { expected_context } end end - context 'with PersonalSnippet' do - let(:gl_repository) { "snippet-#{personal_snippet.id}" } - - it 'executes PostReceiveService' do - subject + context 'with Project' do + it_behaves_like 'runs post-receive hooks' do + let(:container) { project } + let(:expected_context) { { user: user.username, project: project.full_path } } - expect(json_response).to eq({ - 'messages' => [], - 'reference_counter_decreased' => true - }) + let(:messages) do + [ + { + 'message' => <<~MESSAGE.strip, + To create a merge request for #{branch_name}, visit: + http://#{Gitlab.config.gitlab.host}/#{project.full_path}/-/merge_requests/new?merge_request%5Bsource_branch%5D=#{branch_name} + MESSAGE + 'type' => 'basic' + } + ] + end end + end - it_behaves_like 'storing arguments in the application context' do - let(:expected_params) { { user: key.user.username } } - let(:gl_repository) { "snippet-#{personal_snippet.id}" } + context 'with PersonalSnippet' do + it_behaves_like 'runs post-receive hooks' do + let(:container) { personal_snippet } + let(:expected_context) { { user: key.user.username } } end end context 'with ProjectSnippet' do - let(:gl_repository) { "snippet-#{project_snippet.id}" } - - it 'executes PostReceiveService' do - subject - - expect(json_response).to eq({ - 'messages' => [], - 'reference_counter_decreased' => true - }) + it_behaves_like 'runs post-receive hooks' do + let(:container) { project_snippet } + let(:expected_context) { { user: key.user.username, project: project_snippet.project.full_path } } end + end - it_behaves_like 'storing arguments in the application context' do - let(:expected_params) { { user: key.user.username, project: project_snippet.project.full_path } } - let(:gl_repository) { "snippet-#{project_snippet.id}" } + context 'with ProjectWiki' do + it_behaves_like 'runs post-receive hooks' do + let(:container) { project.wiki } + let(:expected_context) { { user: key.user.username, project: project.full_path } } end end @@ -1236,7 +1245,7 @@ RSpec.describe API::Internal::Base do it 'does not try to notify that project moved' do allow_any_instance_of(Gitlab::Identifier).to receive(:identify).and_return(nil) - expect(Gitlab::Checks::ProjectMoved).not_to receive(:fetch_message) + expect(Gitlab::Checks::ContainerMoved).not_to receive(:fetch_message) subject @@ -1244,33 +1253,17 @@ RSpec.describe API::Internal::Base do end end - context 'when project is nil' do - context 'with Project' do - let(:gl_repository) { 'project-foo' } - - it 'does not try to notify that project moved' do - allow(Gitlab::GlRepository).to receive(:parse).and_return([nil, nil, Gitlab::GlRepository::PROJECT]) - - expect(Gitlab::Checks::ProjectMoved).not_to receive(:fetch_message) - - subject - - expect(response).to have_gitlab_http_status(:ok) - end - end - - context 'with PersonalSnippet' do - let(:gl_repository) { "snippet-#{personal_snippet.id}" } + context 'when container is nil' do + let(:gl_repository) { 'project-foo' } - it 'does not try to notify that project moved' do - allow(Gitlab::GlRepository).to receive(:parse).and_return([personal_snippet, nil, Gitlab::GlRepository::SNIPPET]) + it 'does not try to notify that project moved' do + allow(Gitlab::GlRepository).to receive(:parse).and_return([nil, nil, Gitlab::GlRepository::PROJECT]) - expect(Gitlab::Checks::ProjectMoved).not_to receive(:fetch_message) + expect(Gitlab::Checks::ContainerMoved).not_to receive(:fetch_message) - subject + subject - expect(response).to have_gitlab_http_status(:ok) - end + expect(response).to have_gitlab_http_status(:ok) end end end diff --git a/spec/services/post_receive_service_spec.rb b/spec/services/post_receive_service_spec.rb index 2a78dc454c7..871ed95bf28 100644 --- a/spec/services/post_receive_service_spec.rb +++ b/spec/services/post_receive_service_spec.rb @@ -283,7 +283,7 @@ RSpec.describe PostReceiveService do context 'with a redirected data' do it 'returns redirected message on the response' do - project_moved = Gitlab::Checks::ProjectMoved.new(project.repository, user, 'http', 'foo/baz') + project_moved = Gitlab::Checks::ContainerMoved.new(project.repository, user, 'http', 'foo/baz') project_moved.add_message expect(subject).to include(build_basic_message(project_moved.message)) |