Commit fedf978f authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent db24ab2b
...@@ -98,7 +98,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -98,7 +98,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
} }
end end
if Gitlab::CurrentSettings.instance_administration_project_id.present? if Gitlab::CurrentSettings.self_monitoring_project_id.present?
return render status: :ok, json: self_monitoring_data return render status: :ok, json: self_monitoring_data
elsif SelfMonitoringProjectCreateWorker.in_progress?(job_id) elsif SelfMonitoringProjectCreateWorker.in_progress?(job_id)
...@@ -134,7 +134,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -134,7 +134,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
} }
end end
if Gitlab::CurrentSettings.instance_administration_project_id.nil? if Gitlab::CurrentSettings.self_monitoring_project_id.nil?
return render status: :ok, json: { return render status: :ok, json: {
message: _('Self-monitoring project has been successfully deleted') message: _('Self-monitoring project has been successfully deleted')
} }
...@@ -161,8 +161,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -161,8 +161,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
def self_monitoring_data def self_monitoring_data
{ {
project_id: Gitlab::CurrentSettings.instance_administration_project_id, project_id: Gitlab::CurrentSettings.self_monitoring_project_id,
project_full_path: Gitlab::CurrentSettings.instance_administration_project&.full_path project_full_path: Gitlab::CurrentSettings.self_monitoring_project&.full_path
} }
end end
...@@ -171,7 +171,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -171,7 +171,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
status: :not_implemented, status: :not_implemented,
json: { json: {
message: _('Self-monitoring is not enabled on this GitLab server, contact your administrator.'), message: _('Self-monitoring is not enabled on this GitLab server, contact your administrator.'),
documentation_url: help_page_path('administration/monitoring/gitlab_instance_administration_project/index') documentation_url: help_page_path('administration/monitoring/gitlab_self_monitoring_project/index')
} }
) )
end end
......
...@@ -314,18 +314,21 @@ class IssuableFinder ...@@ -314,18 +314,21 @@ class IssuableFinder
params[:assignee_username].present? params[:assignee_username].present?
end end
# rubocop: disable CodeReuse/ActiveRecord
def assignee def assignee
return @assignee if defined?(@assignee) assignees.first
end
@assignee = # rubocop: disable CodeReuse/ActiveRecord
def assignees
strong_memoize(:assignees) do
if assignee_id? if assignee_id?
User.find_by(id: params[:assignee_id]) User.where(id: params[:assignee_id])
elsif assignee_username? elsif assignee_username?
User.find_by_username(params[:assignee_username]) User.where(username: params[:assignee_username])
else else
nil User.none
end end
end
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
...@@ -415,7 +418,7 @@ class IssuableFinder ...@@ -415,7 +418,7 @@ class IssuableFinder
# These are "helper" params that are required inside the NOT to get the right results. They usually come in # These are "helper" params that are required inside the NOT to get the right results. They usually come in
# at the top-level params, but if they do come in inside the `:not` params, they should take precedence. # at the top-level params, but if they do come in inside the `:not` params, they should take precedence.
not_helpers = params.slice(*NEGATABLE_PARAMS_HELPER_KEYS).merge(params[:not].slice(*NEGATABLE_PARAMS_HELPER_KEYS)) not_helpers = params.slice(*NEGATABLE_PARAMS_HELPER_KEYS).merge(params[:not].slice(*NEGATABLE_PARAMS_HELPER_KEYS))
not_param = { key => value }.with_indifferent_access.merge(not_helpers) not_param = { key => value }.with_indifferent_access.merge(not_helpers).merge(not_query: true)
items_to_negate = self.class.new(current_user, not_param).execute items_to_negate = self.class.new(current_user, not_param).execute
...@@ -543,6 +546,8 @@ class IssuableFinder ...@@ -543,6 +546,8 @@ class IssuableFinder
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
def by_assignee(items) def by_assignee(items)
return items.assigned_to(assignees) if not_query? && assignees.any?
if filter_by_no_assignee? if filter_by_no_assignee?
items.unassigned items.unassigned
elsif filter_by_any_assignee? elsif filter_by_any_assignee?
...@@ -624,7 +629,7 @@ class IssuableFinder ...@@ -624,7 +629,7 @@ class IssuableFinder
elsif filter_by_any_label? elsif filter_by_any_label?
items.any_label items.any_label
else else
items.with_label(label_names, params[:sort]) items.with_label(label_names, params[:sort], not_query: not_query?)
end end
items items
...@@ -673,4 +678,8 @@ class IssuableFinder ...@@ -673,4 +678,8 @@ class IssuableFinder
def min_access_level def min_access_level
ProjectFeature.required_minimum_access_level(klass) ProjectFeature.required_minimum_access_level(klass)
end end
def not_query?
!!params[:not_query]
end
end end
...@@ -351,10 +351,10 @@ module ApplicationSettingsHelper ...@@ -351,10 +351,10 @@ module ApplicationSettingsHelper
status_delete_self_monitoring_project_admin_application_settings_path, status_delete_self_monitoring_project_admin_application_settings_path,
'self_monitoring_project_exists' => 'self_monitoring_project_exists' =>
Gitlab::CurrentSettings.instance_administration_project.present?.to_s, Gitlab::CurrentSettings.self_monitoring_project.present?.to_s,
'self_monitoring_project_full_path' => 'self_monitoring_project_full_path' =>
Gitlab::CurrentSettings.instance_administration_project&.full_path Gitlab::CurrentSettings.self_monitoring_project&.full_path
} }
end end
end end
......
...@@ -10,7 +10,9 @@ class ApplicationSetting < ApplicationRecord ...@@ -10,7 +10,9 @@ class ApplicationSetting < ApplicationRecord
add_authentication_token_field :health_check_access_token add_authentication_token_field :health_check_access_token
add_authentication_token_field :static_objects_external_storage_auth_token add_authentication_token_field :static_objects_external_storage_auth_token
belongs_to :instance_administration_project, class_name: "Project" belongs_to :self_monitoring_project, class_name: "Project", foreign_key: 'instance_administration_project_id'
alias_attribute :self_monitoring_project_id, :instance_administration_project_id
belongs_to :instance_administrators_group, class_name: "Group" belongs_to :instance_administrators_group, class_name: "Group"
# Include here so it can override methods from # Include here so it can override methods from
......
...@@ -11,7 +11,7 @@ module Clusters ...@@ -11,7 +11,7 @@ module Clusters
self.table_name = 'clusters_applications_knative' self.table_name = 'clusters_applications_knative'
has_one :serverless_domain_cluster, class_name: 'Serverless::DomainCluster', foreign_key: 'clusters_applications_knative_id', inverse_of: :knative has_one :serverless_domain_cluster, class_name: '::Serverless::DomainCluster', foreign_key: 'clusters_applications_knative_id', inverse_of: :knative
include ::Clusters::Concerns::ApplicationCore include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus include ::Clusters::Concerns::ApplicationStatus
......
...@@ -108,7 +108,9 @@ module Issuable ...@@ -108,7 +108,9 @@ module Issuable
where("NOT EXISTS (SELECT TRUE FROM #{to_ability_name}_assignees WHERE #{to_ability_name}_id = #{to_ability_name}s.id)") where("NOT EXISTS (SELECT TRUE FROM #{to_ability_name}_assignees WHERE #{to_ability_name}_id = #{to_ability_name}s.id)")
end end
scope :assigned_to, ->(u) do scope :assigned_to, ->(u) do
where("EXISTS (SELECT TRUE FROM #{to_ability_name}_assignees WHERE user_id = ? AND #{to_ability_name}_id = #{to_ability_name}s.id)", u.id) assignees_table = Arel::Table.new("#{to_ability_name}_assignees")
sql = assignees_table.project('true').where(assignees_table[:user_id].in(u)).where(Arel::Nodes::SqlLiteral.new("#{to_ability_name}_id = #{to_ability_name}s.id"))
where("EXISTS (#{sql.to_sql})")
end end
# rubocop:enable GitlabSecurity/SqlInjection # rubocop:enable GitlabSecurity/SqlInjection
...@@ -263,8 +265,9 @@ module Issuable ...@@ -263,8 +265,9 @@ module Issuable
.reorder(Gitlab::Database.nulls_last_order('highest_priority', direction)) .reorder(Gitlab::Database.nulls_last_order('highest_priority', direction))
end end
def with_label(title, sort = nil) def with_label(title, sort = nil, not_query: false)
if title.is_a?(Array) && title.size > 1 multiple_labels = title.is_a?(Array) && title.size > 1
if multiple_labels && !not_query
joins(:labels).where(labels: { title: title }).group(*grouping_columns(sort)).having("COUNT(DISTINCT labels.title) = #{title.size}") joins(:labels).where(labels: { title: title }).group(*grouping_columns(sort)).having("COUNT(DISTINCT labels.title) = #{title.size}")
else else
joins(:labels).where(labels: { title: title }) joins(:labels).where(labels: { title: title })
......
...@@ -102,7 +102,7 @@ class PrometheusService < MonitoringService ...@@ -102,7 +102,7 @@ class PrometheusService < MonitoringService
private private
def self_monitoring_project? def self_monitoring_project?
project && project.id == current_settings.instance_administration_project_id project && project.id == current_settings.self_monitoring_project_id
end end
def internal_prometheus_url? def internal_prometheus_url?
......
...@@ -15,5 +15,7 @@ module Serverless ...@@ -15,5 +15,7 @@ module Serverless
format: { with: HEX_REGEXP, message: 'only allows hex characters' } format: { with: HEX_REGEXP, message: 'only allows hex characters' }
default_value_for(:uuid, allows_nil: false) { Gitlab::Serverless::Domain.generate_uuid } default_value_for(:uuid, allows_nil: false) { Gitlab::Serverless::Domain.generate_uuid }
delegate :domain, to: :pages_domain
end end
end end
...@@ -3,177 +3,1047 @@ ...@@ -3,177 +3,1047 @@
# #
# Do not edit it manually! # Do not edit it manually!
--- ---
- auto_devops:auto_devops_disable - :name: auto_devops:auto_devops_disable
- auto_merge:auto_merge_process :feature_category: :auto_devops
- chaos:chaos_cpu_spin :has_external_dependencies:
- chaos:chaos_db_spin :latency_sensitive:
- chaos:chaos_kill :resource_boundary: :unknown
- chaos:chaos_leak_mem :weight: 2
- chaos:chaos_sleep - :name: auto_merge:auto_merge_process
- container_repository:cleanup_container_repository :feature_category: :continuous_delivery
- container_repository:delete_container_repository :has_external_dependencies:
- cronjob:admin_email :latency_sensitive:
- cronjob:ci_archive_traces_cron :resource_boundary: :unknown
- cronjob:container_expiration_policy :weight: 3
- cronjob:expire_build_artifacts - :name: chaos:chaos_cpu_spin
- cronjob:gitlab_usage_ping :feature_category: :chaos_engineering
- cronjob:import_export_project_cleanup :has_external_dependencies:
- cronjob:issue_due_scheduler :latency_sensitive:
- cronjob:namespaces_prune_aggregation_schedules :resource_boundary: :unknown
- cronjob:pages_domain_removal_cron :weight: 2
- cronjob:pages_domain_ssl_renewal_cron - :name: chaos:chaos_db_spin
- cronjob:pages_domain_verification_cron :feature_category: :chaos_engineering
- cronjob:personal_access_tokens_expiring :has_external_dependencies:
- cronjob:pipeline_schedule :latency_sensitive:
- cronjob:prune_old_events :resource_boundary: :unknown
- cronjob:prune_web_hook_logs :weight: 2
- cronjob:remove_expired_group_links - :name: chaos:chaos_kill
- cronjob:remove_expired_members :feature_category: :chaos_engineering
- cronjob:remove_unreferenced_lfs_objects :has_external_dependencies:
- cronjob:repository_archive_cache :latency_sensitive:
- cronjob:repository_check_dispatch :resource_boundary: :unknown
- cronjob:requests_profiles :weight: 2
- cronjob:schedule_migrate_external_diffs - :name: chaos:chaos_leak_mem
- cronjob:stuck_ci_jobs :feature_category: :chaos_engineering
- cronjob:stuck_import_jobs :has_external_dependencies:
- cronjob:stuck_merge_jobs :latency_sensitive:
- cronjob:trending_projects :resource_boundary: :unknown
- deployment:deployments_finished :weight: 2
- deployment:deployments_success - :name: chaos:chaos_sleep
- gcp_cluster:cluster_configure :feature_category: :chaos_engineering
- gcp_cluster:cluster_install_app :has_external_dependencies:
- gcp_cluster:cluster_patch_app :latency_sensitive:
- gcp_cluster:cluster_project_configure :resource_boundary: :unknown
- gcp_cluster:cluster_provision :weight: 2
- gcp_cluster:cluster_upgrade_app - :name: container_repository:cleanup_container_repository
- gcp_cluster:cluster_wait_for_app_installation :feature_category: :container_registry
- gcp_cluster:cluster_wait_for_ingress_ip_address :has_external_dependencies:
- gcp_cluster:clusters_applications_activate_service :latency_sensitive:
- gcp_cluster:clusters_applications_deactivate_service :resource_boundary: :unknown
- gcp_cluster:clusters_applications_uninstall :weight: 1
- gcp_cluster:clusters_applications_wait_for_uninstall_app - :name: container_repository:delete_container_repository
- gcp_cluster:clusters_cleanup_app :feature_category: :container_registry
- gcp_cluster:clusters_cleanup_project_namespace :has_external_dependencies:
- gcp_cluster:clusters_cleanup_service_account :latency_sensitive:
- gcp_cluster:wait_for_cluster_creation :resource_boundary: :unknown
- github_importer:github_import_import_diff_note :weight: 1
- github_importer:github_import_import_issue - :name: cronjob:admin_email
- github_importer:github_import_import_lfs_object :feature_category: :not_owned
- github_importer:github_import_import_note :has_external_dependencies:
- github_importer:github_import_import_pull_request :latency_sensitive:
- github_importer:github_import_refresh_import_jid :resource_boundary: :unknown
- github_importer:github_import_stage_finish_import :weight: 1
- github_importer:github_import_stage_import_base_data - :name: cronjob:ci_archive_traces_cron
- github_importer:github_import_stage_import_issues_and_diff_notes :feature_category: :continuous_integration
- github_importer:github_import_stage_import_lfs_objects :has_external_dependencies:
- github_importer:github_import_stage_import_notes :latency_sensitive:
- github_importer:github_import_stage_import_pull_requests :resource_boundary: :unknown
- github_importer:github_import_stage_import_repository :weight: 1
- hashed_storage:hashed_storage_migrator - :name: cronjob:container_expiration_policy
- hashed_storage:hashed_storage_project_migrate :feature_category: :container_registry
- hashed_storage:hashed_storage_project_rollback :has_external_dependencies:
- hashed_storage:hashed_storage_rollbacker :latency_sensitive:
- mail_scheduler:mail_scheduler_issue_due :resource_boundary: :unknown
- mail_scheduler:mail_scheduler_notification_service :weight: 1
- notifications:new_release - :name: cronjob:expire_build_artifacts
- object_pool:object_pool_create :feature_category: :continuous_integration
- object_pool:object_pool_destroy :has_external_dependencies:
- object_pool:object_pool_join :latency_sensitive:
- object_pool:object_pool_schedule_join :resource_boundary: :unknown
- object_storage:object_storage_background_move :weight: 1
- object_storage:object_storage_migrate_uploads - :name: cronjob:gitlab_usage_ping
- pipeline_background:archive_trace :feature_category: :not_owned
- pipeline_background:ci_build_trace_chunk_flush :has_external_dependencies:
- pipeline_cache:expire_job_cache :latency_sensitive:
- pipeline_cache:expire_pipeline_cache :resource_boundary: :unknown
- pipeline_creation:create_pipeline :weight: 1
- pipeline_creation:run_pipeline_schedule - :name: cronjob:import_export_project_cleanup
- pipeline_default:build_coverage :feature_category: :importers
- pipeline_default:build_trace_sections :has_external_dependencies:
- pipeline_default:pipeline_metrics :latency_sensitive:
- pipeline_default:pipeline_notification :resource_boundary: :unknown
- pipeline_hooks:build_hooks :weight: 1
- pipeline_hooks:pipeline_hooks - :name: cronjob:issue_due_scheduler
- pipeline_processing:build_finished :feature_category: :issue_tracking
- pipeline_processing:build_queue :has_external_dependencies:
- pipeline_processing:build_success :latency_sensitive:
- pipeline_processing:ci_build_prepare :resource_boundary: :unknown
- pipeline_processing:ci_build_schedule :weight: 1
- pipeline_processing:ci_resource_groups_assign_resource_from_resource_group - :name: cronjob:namespaces_prune_aggregation_schedules
- pipeline_processing:pipeline_process :feature_category: :source_code_management
- pipeline_processing:pipeline_success :has_external_dependencies:
- pipeline_processing:pipeline_update :latency_sensitive:
- pipeline_processing:stage_update :resource_boundary: :cpu
- pipeline_processing:update_head_pipeline_for_merge_request :weight: 1
- repository_check:repository_check_batch - :name: cronjob:pages_domain_removal_cron
- repository_check:repository_check_clear :feature_category: :pages
- repository_check:repository_check_single_repository :has_external_dependencies:
- todos_destroyer:todos_destroyer_confidential_issue :latency_sensitive:
- todos_destroyer:todos_destroyer_entity_leave :resource_boundary: :cpu
- todos_destroyer:todos_destroyer_group_private :weight: 1
- todos_destroyer:todos_destroyer_private_features - :name: cronjob:pages_domain_ssl_renewal_cron
- todos_destroyer:todos_destroyer_project_private :feature_category: :pages
- update_namespace_statistics:namespaces_root_statistics :has_external_dependencies:
- update_namespace_statistics:namespaces_schedule_aggregation :latency_sensitive:
- authorized_projects :resource_boundary: :unknown
- background_migration :weight: 1
- chat_notification - :name: cronjob:pages_domain_verification_cron
- create_evidence :feature_category: :pages
- create_gpg_signature :has_external_dependencies:
- create_note_diff_file :latency_sensitive:
- default :resource_boundary: :unknown
- delete_diff_files :weight: 1
- delete_merged_branches - :name: cronjob:personal_access_tokens_expiring
- delete_stored_files :feature_category: :authentication_and_authorization
- delete_user :has_external_dependencies:
- detect_repository_languages :latency_sensitive:
- email_receiver :resource_boundary: :unknown
- emails_on_push :weight: 1
- error_tracking_issue_link - :name: cronjob:pipeline_schedule
- expire_build_instance_artifacts :feature_category: :continuous_integration
- file_hook :has_external_dependencies:
- git_garbage_collect :latency_sensitive:
- github_import_advance_stage :resource_boundary: :cpu
- gitlab_shell :weight: 1
- group_destroy - :name: cronjob:prune_old_events
- group_export :feature_category: :not_owned
- group_import :has_external_dependencies:
- import_issues_csv :latency_sensitive:
- invalid_gpg_signature_update :resource_boundary: :unknown
- irker :weight: 1
- mailers - :name: cronjob:prune_web_hook_logs
- merge :feature_category: :integrations
- merge_request_mergeability_check :has_external_dependencies:
- migrate_external_diffs :latency_sensitive:
- namespaceless_project_destroy :resource_boundary: :unknown
- new_issue :weight: 1
- new_merge_request - :name: cronjob:remove_expired_group_links
- new_note :feature_category: :authentication_and_authorization
- pages :has_external_dependencies:
- pages_domain_ssl_renewal :latency_sensitive:
- pages_domain_verification :resource_boundary: :unknown
- phabricator_import_import_tasks :weight: 1
- post_receive - :name: cronjob:remove_expired_members
- process_commit :feature_category: :authentication_and_authorization
- project_cache :has_external_dependencies:
- project_daily_statistics :latency_sensitive:
- project_destroy :resource_boundary: :cpu
- project_export :weight: 1
- project_service - :name: cronjob:remove_unreferenced_lfs_objects
- propagate_service_template :feature_category: :source_code_management
- reactive_caching :has_external_dependencies:
- rebase :latency_sensitive:
- remote_mirror_notification :resource_boundary: :unknown
- repository_cleanup :weight: 1
- repository_fork - :name: cronjob:repository_archive_cache
- repository_import :feature_category: :source_code_management
- repository_remove_remote :has_external_dependencies:
- repository_update_remote_mirror :latency_sensitive:
- self_monitoring_project_create :resource_boundary: :unknown
- self_monitoring_project_delete :weight: 1
- system_hook_push - :name: cronjob:repository_check_dispatch
- update_external_pull_requests :feature_category: :source_code_management
- update_merge_requests :has_external_dependencies:
- update_project_statistics :latency_sensitive:
- upload_checksum :resource_boundary: :unknown
- web_hook :weight: 1
- :name: cronjob:requests_profiles
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: cronjob:schedule_migrate_external_diffs
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: cronjob:stuck_ci_jobs
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
- :name: cronjob:stuck_import_jobs
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
- :name: cronjob:stuck_merge_jobs
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: cronjob:trending_projects
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: deployment:deployments_finished
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 3
- :name: deployment:deployments_success
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 3
- :name: gcp_cluster:cluster_configure
:feature_category: :kubernetes_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:cluster_install_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:cluster_patch_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:cluster_project_configure
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:cluster_provision
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:cluster_upgrade_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:cluster_wait_for_app_installation
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
- :name: gcp_cluster:cluster_wait_for_ingress_ip_address
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:clusters_applications_activate_service
:feature_category: :kubernetes_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:clusters_applications_deactivate_service
:feature_category: :kubernetes_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:clusters_applications_uninstall
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:clusters_applications_wait_for_uninstall_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
- :name: gcp_cluster:clusters_cleanup_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:clusters_cleanup_project_namespace
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:clusters_cleanup_service_account
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gcp_cluster:wait_for_cluster_creation
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_import_diff_note
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_import_issue
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_import_lfs_object
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_import_note
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_import_pull_request
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_refresh_import_jid
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_stage_finish_import
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_stage_import_base_data
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_stage_import_issues_and_diff_notes
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_stage_import_lfs_objects
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_stage_import_notes
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_stage_import_pull_requests
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_importer:github_import_stage_import_repository
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: hashed_storage:hashed_storage_migrator
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: hashed_storage:hashed_storage_project_migrate
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: hashed_storage:hashed_storage_project_rollback
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: hashed_storage:hashed_storage_rollbacker
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: mail_scheduler:mail_scheduler_issue_due
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: mail_scheduler:mail_scheduler_notification_service
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 2
- :name: notifications:new_release
:feature_category: :release_orchestration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: object_pool:object_pool_create
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: object_pool:object_pool_destroy
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: object_pool:object_pool_join
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
- :name: object_pool:object_pool_schedule_join
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: object_storage:object_storage_background_move
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: object_storage:object_storage_migrate_uploads
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: pipeline_background:archive_trace
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: pipeline_background:ci_build_trace_chunk_flush
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: pipeline_cache:expire_job_cache
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 3
- :name: pipeline_cache:expire_pipeline_cache
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 3
- :name: pipeline_creation:create_pipeline
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 4
- :name: pipeline_creation:run_pipeline_schedule
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 4
- :name: pipeline_default:build_coverage
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 3
- :name: pipeline_default:build_trace_sections
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 3
- :name: pipeline_default:pipeline_metrics
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 3
- :name: pipeline_default:pipeline_notification
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 3
- :name: pipeline_hooks:build_hooks
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
- :name: pipeline_hooks:pipeline_hooks
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
- :name: pipeline_processing:build_finished
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
- :name: pipeline_processing:build_queue
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
- :name: pipeline_processing:build_success
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
- :name: pipeline_processing:ci_build_prepare
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 5
- :name: pipeline_processing:ci_build_schedule
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 5
- :name: pipeline_processing:ci_resource_groups_assign_resource_from_resource_group
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 5
- :name: pipeline_processing:pipeline_process
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
- :name: pipeline_processing:pipeline_success
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
- :name: pipeline_processing:pipeline_update
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
- :name: pipeline_processing:stage_update
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
- :name: pipeline_processing:update_head_pipeline_for_merge_request
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
- :name: repository_check:repository_check_batch
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: repository_check:repository_check_clear
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: repository_check:repository_check_single_repository
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: todos_destroyer:todos_destroyer_confidential_issue
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: todos_destroyer:todos_destroyer_entity_leave
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: todos_destroyer:todos_destroyer_group_private
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: todos_destroyer:todos_destroyer_private_features
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: todos_destroyer:todos_destroyer_project_private
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: update_namespace_statistics:namespaces_root_statistics
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: update_namespace_statistics:namespaces_schedule_aggregation
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: authorized_projects
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
- :name: background_migration
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: chat_notification
:feature_category: :chatops
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
- :name: create_evidence
:feature_category: :release_governance
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: create_gpg_signature
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: create_note_diff_file
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: default
:feature_category:
:has_external_dependencies:
:latency_sensitive:
:resource_boundary:
:weight: 1
- :name: delete_diff_files
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: delete_merged_branches
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: delete_stored_files
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: delete_user
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: detect_repository_languages
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: email_receiver
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
- :name: emails_on_push
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
- :name: error_tracking_issue_link
:feature_category: :error_tracking
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: expire_build_instance_artifacts
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: file_hook
:feature_category: :integrations
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: git_garbage_collect
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: github_import_advance_stage
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: gitlab_shell
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
- :name: group_destroy
:feature_category: :subgroups
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: group_export
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: group_import
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: import_issues_csv
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 2
- :name: invalid_gpg_signature_update
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: irker
:feature_category: :integrations
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: mailers
:feature_category:
:has_external_dependencies:
:latency_sensitive:
:resource_boundary:
:weight: 2
- :name: merge
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
- :name: merge_request_mergeability_check
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: migrate_external_diffs
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: namespaceless_project_destroy
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: new_issue
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
- :name: new_merge_request
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
- :name: new_note
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
- :name: pages
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: pages_domain_ssl_renewal
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: pages_domain_verification
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: phabricator_import_import_tasks
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: post_receive
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
- :name: process_commit
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 3
- :name: project_cache
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 1
- :name: project_daily_statistics
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: project_destroy
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: project_export
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :memory
:weight: 1
- :name: project_service
:feature_category: :integrations
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: propagate_service_template
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: reactive_caching
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 1
- :name: rebase
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: remote_mirror_notification
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: repository_cleanup
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: repository_fork
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: repository_import
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: repository_remove_remote
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: repository_update_remote_mirror
:feature_category: :source_code_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: self_monitoring_project_create
:feature_category: :metrics
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: self_monitoring_project_delete
:feature_category: :metrics
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
- :name: system_hook_push
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: update_external_pull_requests
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 3
- :name: update_merge_requests
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 3
- :name: update_project_statistics
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: upload_checksum
:feature_category: :geo_replication
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
- :name: web_hook
:feature_category: :integrations
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
---
title: Rename 'GitLab Instance Administration' project to 'GitLab self monitoring' project
merge_request: 23182
author:
type: changed
# rubocop:disable Rails/Output # rubocop:disable Rails/Output
if defined?(Rails::Console) || Rails.env.development? if defined?(Rails::Console)
# when using `spring` this will only print out the first time # note that this will not print out when using `spring`
justify = 15 justify = 15
puts '-' * 80 puts '-' * 80
puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision}) #{Gitlab.ee? ? 'EE' : 'FOSS'}" puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision})"
puts " GitLab Shell:".ljust(justify) + "#{Gitlab::VersionInfo.parse(Gitlab::Shell.new.version)}" puts " GitLab Shell:".ljust(justify) + "#{Gitlab::VersionInfo.parse(Gitlab::Shell.new.version)}"
puts " #{Gitlab::Database.human_adapter_name}:".ljust(justify) + Gitlab::Database.version puts " #{Gitlab::Database.human_adapter_name}:".ljust(justify) + Gitlab::Database.version
......
# GitLab instance administration project ---
redirect_to: '../gitlab_self_monitoring_project/index.md'
---
NOTE: **Note:** This document was moved to [another location](../gitlab_self_monitoring_project/index.md).
This feature is available behind a feature flag called `self_monitoring_project`
since [12.7](https://gitlab.com/gitlab-org/gitlab/issues/32351). The feature flag
will be removed once we [add dashboards to display metrics](https://gitlab.com/groups/gitlab-org/-/epics/2367).
GitLab has been adding the ability for administrators to see insights into the health of
their GitLab instance. In order to surface this experience in a native way, similar to how
you would interact with an application deployed via GitLab, a base project called
"GitLab Instance Administration" with
[internal visibility](../../../public_access/public_access.md#internal-projects) will be
added under a group called "GitLab Instance Administrators" specifically created for
visualizing and configuring the monitoring of your GitLab instance.
All administrators at the time of creation of the project and group will be added
as maintainers of the group and project, and as an admin, you'll be able to add new
members to the group in order to give them maintainer access to the project.
This project will be used for self-monitoring your GitLab instance.
## Connection to Prometheus
The project will be automatically configured to connect to the
[internal Prometheus](../prometheus/index.md) instance if the Prometheus
instance is present (should be the case if GitLab was installed via Omnibus
and you haven't disabled it).
If that's not the case or if you have an external Prometheus instance or an HA setup,
you should
[configure it manually](../../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus).
## Taking action on Prometheus alerts **(ULTIMATE)**
You can [add a webhook](../../../user/project/integrations/prometheus.md#external-prometheus-instances)
to the Prometheus config in order for GitLab to receive notifications of any alerts.
Once the webhook is setup, you can
[take action on incoming alerts](../../../user/project/integrations/prometheus.md#taking-action-on-incidents-ultimate).
# GitLab self monitoring project
NOTE: **Note:**
This feature is available behind a feature flag called `self_monitoring_project`
since [12.7](https://gitlab.com/gitlab-org/gitlab/issues/32351). The feature flag
will be removed once we [add dashboards to display metrics](https://gitlab.com/groups/gitlab-org/-/epics/2367).
GitLab has been adding the ability for administrators to see insights into the health of
their GitLab instance. In order to surface this experience in a native way, similar to how
you would interact with an application deployed via GitLab, a base project called
"GitLab self monitoring" with
[internal visibility](../../../public_access/public_access.md#internal-projects) will be
added under a group called "GitLab Instance Administrators" specifically created for
visualizing and configuring the monitoring of your GitLab instance.
All administrators at the time of creation of the project and group will be added
as maintainers of the group and project, and as an admin, you'll be able to add new
members to the group in order to give them maintainer access to the project.
This project will be used for self-monitoring your GitLab instance.
## Connection to Prometheus
The project will be automatically configured to connect to the
[internal Prometheus](../prometheus/index.md) instance if the Prometheus
instance is present (should be the case if GitLab was installed via Omnibus
and you haven't disabled it).
If that's not the case or if you have an external Prometheus instance or an HA setup,
you should
[configure it manually](../../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus).
## Taking action on Prometheus alerts **(ULTIMATE)**
You can [add a webhook](../../../user/project/integrations/prometheus.md#external-prometheus-instances)
to the Prometheus config in order for GitLab to receive notifications of any alerts.
Once the webhook is setup, you can
[take action on incoming alerts](../../../user/project/integrations/prometheus.md#taking-action-on-incidents-ultimate).
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Explore our features to monitor your GitLab instance: Explore our features to monitor your GitLab instance:
- [GitLab self-monitoring](gitlab_instance_administration_project/index.md): The - [GitLab self-monitoring](gitlab_self_monitoring_project/index.md): The
GitLab instance administration project helps to monitor the GitLab instance and GitLab instance administration project helps to monitor the GitLab instance and
take action on alerts. take action on alerts.
- [Performance monitoring](performance/index.md): GitLab Performance Monitoring makes it possible to measure a wide variety of statistics of your instance. - [Performance monitoring](performance/index.md): GitLab Performance Monitoring makes it possible to measure a wide variety of statistics of your instance.
......
...@@ -32,6 +32,7 @@ The following metrics are available: ...@@ -32,6 +32,7 @@ The following metrics are available:
| `gitlab_cache_operations_total` | Counter | 12.2 | Cache operations by controller/action | controller, action, operation | | `gitlab_cache_operations_total` | Counter | 12.2 | Cache operations by controller/action | controller, action, operation |
| `gitlab_database_transaction_seconds` | Histogram | 12.1 | Time spent in database transactions, in seconds | | | `gitlab_database_transaction_seconds` | Histogram | 12.1 | Time spent in database transactions, in seconds | |
| `gitlab_method_call_duration_seconds` | Histogram | 10.2 | Method calls real duration | controller, action, module, method | | `gitlab_method_call_duration_seconds` | Histogram | 10.2 | Method calls real duration | controller, action, module, method |
| `gitlab_page_out_of_bounds` | Counter | 12.8 | Counter for the PageLimiter pagination limit being hit | controller, action, bot |
| `gitlab_rails_queue_duration_seconds` | Histogram | 9.4 | Measures latency between GitLab Workhorse forwarding a request to Rails | | | `gitlab_rails_queue_duration_seconds` | Histogram | 9.4 | Measures latency between GitLab Workhorse forwarding a request to Rails | |
| `gitlab_sql_duration_seconds` | Histogram | 10.2 | SQL execution time, excluding SCHEMA operations and BEGIN / COMMIT | | | `gitlab_sql_duration_seconds` | Histogram | 10.2 | SQL execution time, excluding SCHEMA operations and BEGIN / COMMIT | |
| `gitlab_transaction_allocated_memory_bytes` | Histogram | 10.2 | Allocated memory for all transactions (gitlab_transaction_* metrics) | | | `gitlab_transaction_allocated_memory_bytes` | Histogram | 10.2 | Allocated memory for all transactions (gitlab_transaction_* metrics) | |
......
...@@ -2681,6 +2681,27 @@ trigger_job: ...@@ -2681,6 +2681,27 @@ trigger_job:
strategy: depend strategy: depend
``` ```
#### Linking pipelines with `trigger:strategy`
By default, the `trigger` job completes with the `success` status
as soon as the downstream pipeline is created.
To force the `trigger` job to wait for the downstream (multi-project or child) pipeline to complete, use
`strategy: depend`. This will make the trigger job wait with a "running" status until the triggered
pipeline completes. At that point, the `trigger` job will complete and display the same status as
the downstream job.
```yaml
trigger_job:
trigger:
include: path/to/child-pipeline.yml
strategy: depend
```
This can help keep your pipeline execution linear. In the example above, jobs from
subsequent stages will wait for the triggered pipeline to successfully complete before
starting, at the cost of reduced parallelization.
### `interruptible` ### `interruptible`
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/23464) in GitLab 12.3. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/23464) in GitLab 12.3.
......
...@@ -54,17 +54,6 @@ By default, this seeds an average of 10 issues per week for the last 52 weeks ...@@ -54,17 +54,6 @@ By default, this seeds an average of 10 issues per week for the last 52 weeks
per project. All issues will also be randomly labeled with team, type, severity, per project. All issues will also be randomly labeled with team, type, severity,
and priority. and priority.
#### Seeding groups with sub-groups
You can seed groups with sub-groups that contain milestones/projects/issues
with the `gitlab:seed:group_seed` task:
```shell
bin/rake "gitlab:seed:group_seed[subgroup_depth, username]"
```
Group are additionally seeded with epics if GitLab instance has epics feature available.
### Automation ### Automation
If you're very sure that you want to **wipe the current database** and refill If you're very sure that you want to **wipe the current database** and refill
......
...@@ -13,11 +13,11 @@ module Gitlab ...@@ -13,11 +13,11 @@ module Gitlab
end end
def self_monitoring_project def self_monitoring_project
application_settings.instance_administration_project application_settings.self_monitoring_project
end end
def self_monitoring_project_id def self_monitoring_project_id
application_settings.instance_administration_project_id application_settings.self_monitoring_project_id
end end
end end
end end
......
...@@ -9,7 +9,7 @@ module Gitlab ...@@ -9,7 +9,7 @@ module Gitlab
include SelfMonitoring::Helpers include SelfMonitoring::Helpers
VISIBILITY_LEVEL = Gitlab::VisibilityLevel::INTERNAL VISIBILITY_LEVEL = Gitlab::VisibilityLevel::INTERNAL
PROJECT_NAME = 'GitLab Instance Administration' PROJECT_NAME = 'GitLab self monitoring'
steps :validate_application_settings, steps :validate_application_settings,
:create_group, :create_group,
...@@ -69,7 +69,7 @@ module Gitlab ...@@ -69,7 +69,7 @@ module Gitlab
return success(result) if project_created? return success(result) if project_created?
response = application_settings.update( response = application_settings.update(
instance_administration_project_id: result[:project].id self_monitoring_project_id: result[:project].id
) )
if response if response
...@@ -115,7 +115,7 @@ module Gitlab ...@@ -115,7 +115,7 @@ module Gitlab
def docs_path def docs_path
Rails.application.routes.url_helpers.help_page_path( Rails.application.routes.url_helpers.help_page_path(
'administration/monitoring/gitlab_instance_administration_project/index' 'administration/monitoring/gitlab_self_monitoring_project/index'
) )
end end
......
# frozen_string_literal: true
module Gitlab
module Serverless
class FunctionURI < URI::HTTPS
SERVERLESS_DOMAIN_REGEXP = %r{^(?<scheme>https?://)?(?<function>[^.]+)-(?<cluster_left>\h{2})a1(?<cluster_middle>\h{10})f2(?<cluster_right>\h{2})(?<environment_id>\h+)-(?<environment_slug>[^.]+)\.(?<domain>.+)}.freeze
attr_reader :function, :cluster, :environment
def initialize(function: nil, cluster: nil, environment: nil)
initialize_required_argument(:function, function)
initialize_required_argument(:cluster, cluster)
initialize_required_argument(:environment, environment)
@host = "#{function}-#{cluster.uuid[0..1]}a1#{cluster.uuid[2..-3]}f2#{cluster.uuid[-2..-1]}#{"%x" % environment.id}-#{environment.slug}.#{cluster.domain}"
super('https', nil, host, nil, nil, nil, nil, nil, nil)
end
def self.parse(uri)
match = SERVERLESS_DOMAIN_REGEXP.match(uri)
return unless match
cluster = ::Serverless::DomainCluster.find(match[:cluster_left] + match[:cluster_middle] + match[:cluster_right])
return unless cluster
environment = ::Environment.find(match[:environment_id].to_i(16))
return unless environment&.slug == match[:environment_slug]
new(
function: match[:function],
cluster: cluster,
environment: environment
)
end
private
def initialize_required_argument(name, value)
raise ArgumentError.new("missing argument: #{name}") unless value
instance_variable_set("@#{name}".to_sym, value)
end
end
end
end
...@@ -13,21 +13,10 @@ module Gitlab ...@@ -13,21 +13,10 @@ module Gitlab
(EE_QUEUE_CONFIG_PATH if Gitlab.ee?) (EE_QUEUE_CONFIG_PATH if Gitlab.ee?)
].compact.freeze ].compact.freeze
# For queues that don't have explicit workers - default and mailers
DummyWorker = Struct.new(:queue, :weight) do
def queue_namespace
nil
end
def get_weight
weight
end
end
DEFAULT_WORKERS = [ DEFAULT_WORKERS = [
Gitlab::SidekiqConfig::Worker.new(DummyWorker.new('default', 1), ee: false), DummyWorker.new('default', weight: 1),
Gitlab::SidekiqConfig::Worker.new(DummyWorker.new('mailers', 2), ee: false) DummyWorker.new('mailers', weight: 2)
].freeze ].map { |worker| Gitlab::SidekiqConfig::Worker.new(worker, ee: false) }.freeze
class << self class << self
include Gitlab::SidekiqConfig::CliMethods include Gitlab::SidekiqConfig::CliMethods
...@@ -66,12 +55,13 @@ module Gitlab ...@@ -66,12 +55,13 @@ module Gitlab
workers.partition(&:ee?).reverse.map(&:sort) workers.partition(&:ee?).reverse.map(&:sort)
end end
# YAML.load_file is OK here as we control the file contents
def all_queues_yml_outdated? def all_queues_yml_outdated?
foss_workers, ee_workers = workers_for_all_queues_yml foss_workers, ee_workers = workers_for_all_queues_yml
return true if foss_workers != YAML.safe_load(File.read(FOSS_QUEUE_CONFIG_PATH)) return true if foss_workers != YAML.load_file(FOSS_QUEUE_CONFIG_PATH)
Gitlab.ee? && ee_workers != YAML.safe_load(File.read(EE_QUEUE_CONFIG_PATH)) Gitlab.ee? && ee_workers != YAML.load_file(EE_QUEUE_CONFIG_PATH)
end end
def queues_for_sidekiq_queues_yml def queues_for_sidekiq_queues_yml
...@@ -89,9 +79,9 @@ module Gitlab ...@@ -89,9 +79,9 @@ module Gitlab
remaining_queues.map(&:queue_and_weight)).sort remaining_queues.map(&:queue_and_weight)).sort
end end
# YAML.load_file is OK here as we control the file contents
def sidekiq_queues_yml_outdated? def sidekiq_queues_yml_outdated?
# YAML.load is OK here as we control the file contents config_queues = YAML.load_file(SIDEKIQ_QUEUES_PATH)[:queues]
config_queues = YAML.load(File.read(SIDEKIQ_QUEUES_PATH))[:queues] # rubocop:disable Security/YAMLLoad
queues_for_sidekiq_queues_yml != config_queues queues_for_sidekiq_queues_yml != config_queues
end end
......
...@@ -23,8 +23,10 @@ module Gitlab ...@@ -23,8 +23,10 @@ module Gitlab
@worker_queues[rails_path] ||= QUEUE_CONFIG_PATHS.flat_map do |path| @worker_queues[rails_path] ||= QUEUE_CONFIG_PATHS.flat_map do |path|
full_path = File.join(rails_path, path) full_path = File.join(rails_path, path)
queues = File.exist?(full_path) ? YAML.load_file(full_path) : []
File.exist?(full_path) ? YAML.load_file(full_path) : [] # https://gitlab.com/gitlab-org/gitlab/issues/199230
queues.map { |queue| queue.is_a?(Hash) ? queue[:name] : queue }
end end
end end
...@@ -37,6 +39,12 @@ module Gitlab ...@@ -37,6 +39,12 @@ module Gitlab
[queue, *queues_set.grep(/\A#{queue}:/)] [queue, *queues_set.grep(/\A#{queue}:/)]
end end
end end
def clear_memoization!
if instance_variable_defined?('@worker_queues')
remove_instance_variable('@worker_queues')
end
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables # rubocop:enable Gitlab/ModuleWithInstanceVariables
end end
end end
......
# frozen_string_literal: true
module Gitlab
module SidekiqConfig
# For queues that don't have explicit workers - default and mailers
class DummyWorker
attr_accessor :queue
ATTRIBUTE_METHODS = {
feature_category: :get_feature_category,
has_external_dependencies: :worker_has_external_dependencies?,
latency_sensitive: :latency_sensitive_worker?,
resource_boundary: :get_worker_resource_boundary,
weight: :get_weight
}.freeze
def initialize(queue, attributes = {})
@queue = queue
@attributes = attributes
end
def queue_namespace
nil
end
ATTRIBUTE_METHODS.each do |attribute, meth|
define_method meth do
@attributes[attribute]
end
end
end
end
end
...@@ -41,11 +41,18 @@ module Gitlab ...@@ -41,11 +41,18 @@ module Gitlab
# YAML representation # YAML representation
def encode_with(coder) def encode_with(coder)
coder.represent_scalar(nil, to_yaml) coder.represent_map(nil, to_yaml)
end end
def to_yaml def to_yaml
queue {
name: queue,
feature_category: get_feature_category,
has_external_dependencies: worker_has_external_dependencies?,
latency_sensitive: latency_sensitive_worker?,
resource_boundary: get_worker_resource_boundary,
weight: get_weight
}
end end
def namespace_and_weight def namespace_and_weight
......
# frozen_string_literal: true
# Seed test groups with:
# 1. 2 Subgroups per level
# 1. 2 Users & group members per group
# 1. 2 Epics, 2 Milestones & 2 Projects per group
# 1. Project issues
#
# It also assigns each project's issue with one of group's or ascendants
# groups milestone & epic.
#
# @param subgroups_depth - number of subgroup levels
# @param username - user creating subgroups (i.e. GitLab admin)
#
# @example
# bundle exec rake "gitlab:seed:group_seed[5, root]"
#
namespace :gitlab do
namespace :seed do
desc 'Seed groups with sub-groups/projects/epics/milestones for Group Import testing'
task :group_seed, [:subgroups_depth, :username] => :gitlab_environment do |_t, args|
require 'sidekiq/testing'
GroupSeeder.new(
subgroups_depth: args.subgroups_depth,
username: args.username
).seed
end
end
end
class GroupSeeder
PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-test.git'
attr_reader :all_group_ids
def initialize(subgroups_depth:, username:)
@subgroups_depth = subgroups_depth.to_i
@user = User.find_by_username(username)
@group_names = Set.new
@resource_count = 2
@all_groups = {}
@all_group_ids = []
end
def seed
create_groups
puts 'Done!'
end
def create_groups
create_root_group
create_sub_groups
create_users_and_members
create_epics if Gitlab.ee?
create_labels
create_milestones
Sidekiq::Testing.inline! do
create_projects
end
end
def create_users_and_members
all_group_ids.each do |group_id|
@resource_count.times do |_|
user = create_user
create_member(user.id, group_id)
end
end
end
def create_root_group
root_group = ::Groups::CreateService.new(@user, group_params).execute
track_group_id(1, root_group.id)
end
def create_sub_groups
(2..@subgroups_depth).each do |level|
parent_level = level - 1
current_level = level
parent_groups = @all_groups[parent_level]
parent_groups.each do |parent_id|
@resource_count.times do |_|
sub_group = ::Groups::CreateService.new(@user, group_params(parent_id: parent_id)).execute
track_group_id(current_level, sub_group.id)
end
end
end
end
def track_group_id(depth_level, group_id)
@all_groups[depth_level] ||= []
@all_groups[depth_level] << group_id
@all_group_ids << group_id
end
def group_params(parent_id: nil)
name = unique_name
{
name: name,
path: name,
parent_id: parent_id
}
end
def unique_name
name = ffaker_name
name = ffaker_name until @group_names.add?(name)
name
end
def ffaker_name
FFaker::Lorem.characters(5)
end
def create_user
User.create!(
username: FFaker::Internet.user_name,
name: FFaker::Name.name,
email: FFaker::Internet.email,
confirmed_at: DateTime.now,
password: Devise.friendly_token
)
end
def create_member(user_id, group_id)
roles = Gitlab::Access.values
GroupMember.create(user_id: user_id, access_level: roles.sample, source_id: group_id)
end
def create_epics
all_group_ids.each do |group_id|
@resource_count.times do |_|
group = Group.find(group_id)
epic_params = {
title: FFaker::Lorem.sentence(6),
description: FFaker::Lorem.paragraphs(3).join("\n\n"),
author: group.users.sample,
group: group
}
Epic.create!(epic_params)
end
end
end
def create_labels
all_group_ids.each do |group_id|
@resource_count.times do |_|
group = Group.find(group_id)
label_title = FFaker::Product.brand
Labels::CreateService.new(title: label_title, color: "##{Digest::MD5.hexdigest(label_title)[0..5]}").execute(group: group)
end
end
end
def create_milestones
all_group_ids.each do |group_id|
@resource_count.times do |i|
group = Group.find(group_id)
milestone_params = {
title: "v#{i}.0",
description: FFaker::Lorem.sentence,
state: [:active, :closed].sample
}
Milestones::CreateService.new(group, group.members.sample, milestone_params).execute
end
end
end
def create_projects
all_group_ids.each do |group_id|
group = Group.find(group_id)
@resource_count.times do |i|
_, project_path = PROJECT_URL.split('/')[-2..-1]
project_path.gsub!('.git', '')
params = {
import_url: PROJECT_URL,
namespace_id: group.id,
name: project_path.titleize + FFaker::Lorem.characters(10),
description: FFaker::Lorem.sentence,
visibility_level: 0,
skip_disk_validation: true
}
project = nil
Sidekiq::Worker.skipping_transaction_check do
project = ::Projects::CreateService.new(@user, params).execute
project.send(:_run_after_commit_queue)
project.import_state.send(:_run_after_commit_queue)
project.repository.expire_all_method_caches
end
create_project_issues(project)
assign_issues_to_epics_and_milestones(project)
end
end
end
def create_project_issues(project)
Gitlab::Seeder.quiet do
seeder = Quality::Seeders::Issues.new(project: project)
seeder.seed(backfill_weeks: 2, average_issues_per_week: 2)
end
end
def assign_issues_to_epics_and_milestones(project)
group_ids = project.group.self_and_ancestors.map(&:id)
project.issues.each do |issue|
issue_params = {
milestone: Milestone.where(group: group_ids).sample
}
issue_params[:epic] = Epic.where(group: group_ids).sample if Gitlab.ee?
issue.update(issue_params)
end
end
end
...@@ -1260,12 +1260,6 @@ msgstr "" ...@@ -1260,12 +1260,6 @@ msgstr ""
msgid "AdminArea|You’re about to stop all jobs.This will halt all current jobs that are running." msgid "AdminArea|You’re about to stop all jobs.This will halt all current jobs that are running."
msgstr "" msgstr ""
msgid "AdminCredentials|Personal Access Tokens"
msgstr ""
msgid "AdminCredentials|SSH Keys"
msgstr ""
msgid "AdminDashboard|Error loading the statistics. Please try again" msgid "AdminDashboard|Error loading the statistics. Please try again"
msgstr "" msgstr ""
...@@ -1413,9 +1407,6 @@ msgstr "" ...@@ -1413,9 +1407,6 @@ msgstr ""
msgid "AdminUsers|New user" msgid "AdminUsers|New user"
msgstr "" msgstr ""
msgid "AdminUsers|No credentials found"
msgstr ""
msgid "AdminUsers|No users found" msgid "AdminUsers|No users found"
msgstr "" msgstr ""
...@@ -5622,6 +5613,15 @@ msgstr "" ...@@ -5622,6 +5613,15 @@ msgstr ""
msgid "Credentials" msgid "Credentials"
msgstr "" msgstr ""
msgid "CredentialsInventory|No credentials found"
msgstr ""
msgid "CredentialsInventory|Personal Access Tokens"
msgstr ""
msgid "CredentialsInventory|SSH Keys"
msgstr ""
msgid "Critical vulnerabilities present" msgid "Critical vulnerabilities present"
msgstr "" msgstr ""
......
...@@ -144,14 +144,6 @@ describe Projects::ReleasesController do ...@@ -144,14 +144,6 @@ describe Projects::ReleasesController do
end end
end end
context 'when feature flag `release_edit_page` is disabled' do
before do
stub_feature_flags(release_edit_page: false)
end
it_behaves_like 'not found'
end
context 'when release does not exist' do context 'when release does not exist' do
let!(:release) { } let!(:release) { }
let(:tag) { 'non-existent-tag' } let(:tag) { 'non-existent-tag' }
......
...@@ -374,5 +374,10 @@ x6zG6WoibsbsJMj70nwseUnPTBQNDP+j61RJjC/r ...@@ -374,5 +374,10 @@ x6zG6WoibsbsJMj70nwseUnPTBQNDP+j61RJjC/r
-----END EC PRIVATE KEY-----' -----END EC PRIVATE KEY-----'
end end
end end
trait :instance_serverless do
wildcard { true }
domain_type { :instance }
end
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :serverless_domain_cluster, class: 'Serverless::DomainCluster' do factory :serverless_domain_cluster, class: '::Serverless::DomainCluster' do
pages_domain { create(:pages_domain) } pages_domain { create(:pages_domain) }
knative { create(:clusters_applications_knative) } knative { create(:clusters_applications_knative) }
creator { create(:user) } creator { create(:user) }
......
...@@ -33,17 +33,22 @@ describe IssuesFinder do ...@@ -33,17 +33,22 @@ describe IssuesFinder do
before do before do
project2.add_developer(user3) project2.add_developer(user3)
issue3.assignees = [user2, user3] issue2.assignees = [user2]
issue3.assignees = [user3]
end end
it_behaves_like 'assignee username filter' do it_behaves_like 'assignee username filter' do
let(:params) { { assignee_username: [user2.username, user3.username] } } let(:params) { { assignee_username: [user2.username] } }
let(:expected_issuables) { [issue3] } let(:expected_issuables) { [issue2] }
end end
it_behaves_like 'assignee NOT username filter' do it_behaves_like 'assignee NOT username filter' do
let(:params) { { not: { assignee_username: [user2.username, user3.username] } } } before do
let(:expected_issuables) { [issue1, issue2, issue4] } issue2.assignees = [user2]
end
let(:params) { { not: { assignee_username: [user.username, user2.username] } } }
let(:expected_issuables) { [issue3, issue4] }
end end
end end
...@@ -395,8 +400,8 @@ describe IssuesFinder do ...@@ -395,8 +400,8 @@ describe IssuesFinder do
context 'using NOT' do context 'using NOT' do
let(:params) { { not: { label_name: [label.title, label2.title].join(',') } } } let(:params) { { not: { label_name: [label.title, label2.title].join(',') } } }
it 'returns issues that do not have ALL labels provided' do it 'returns issues that do not have any of the labels provided' do
expect(issues).to contain_exactly(issue1, issue3, issue4) expect(issues).to contain_exactly(issue1, issue4)
end end
end end
end end
...@@ -417,8 +422,8 @@ describe IssuesFinder do ...@@ -417,8 +422,8 @@ describe IssuesFinder do
context 'using NOT' do context 'using NOT' do
let(:params) { { not: { label_name: [label.title, label2.title].join(',') } } } let(:params) { { not: { label_name: [label.title, label2.title].join(',') } } }
it 'returns issues that do not have ALL labels provided' do it 'returns issues that do not have ANY ONE of the labels provided' do
expect(issues).to contain_exactly(issue1, issue3, issue4) expect(issues).to contain_exactly(issue1, issue4)
end end
end end
end end
......
...@@ -107,7 +107,7 @@ describe ApplicationSettingsHelper do ...@@ -107,7 +107,7 @@ describe ApplicationSettingsHelper do
let(:project) { build(:project) } let(:project) { build(:project) }
before do before do
stub_application_setting(instance_administration_project: project) stub_application_setting(self_monitoring_project: project)
end end
it 'returns self_monitoring_project_exists true' do it 'returns self_monitoring_project_exists true' do
......
...@@ -103,7 +103,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -103,7 +103,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end end
it 'creates project with correct name and description' do it 'creates project with correct name and description' do
path = 'administration/monitoring/gitlab_instance_administration_project/index' path = 'administration/monitoring/gitlab_self_monitoring_project/index'
docs_path = Rails.application.routes.url_helpers.help_page_path(path) docs_path = Rails.application.routes.url_helpers.help_page_path(path)
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:success)
...@@ -122,13 +122,13 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -122,13 +122,13 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
it 'saves the project id' do it 'saves the project id' do
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:success)
expect(application_setting.instance_administration_project_id).to eq(project.id) expect(application_setting.self_monitoring_project_id).to eq(project.id)
end end
it 'returns error when saving project ID fails' do it 'returns error when saving project ID fails' do
allow(application_setting).to receive(:update).and_call_original allow(application_setting).to receive(:update).and_call_original
allow(application_setting).to receive(:update) allow(application_setting).to receive(:update)
.with(instance_administration_project_id: anything) .with(self_monitoring_project_id: anything)
.and_return(false) .and_return(false)
expect(result).to eq( expect(result).to eq(
...@@ -144,7 +144,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -144,7 +144,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
before do before do
application_setting.instance_administrators_group_id = existing_group.id application_setting.instance_administrators_group_id = existing_group.id
application_setting.instance_administration_project_id = existing_project.id application_setting.self_monitoring_project_id = existing_project.id
end end
it 'returns success' do it 'returns success' do
......
...@@ -24,7 +24,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService do ...@@ -24,7 +24,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService do
let(:application_setting) do let(:application_setting) do
create( create(
:application_setting, :application_setting,
instance_administration_project_id: project.id, self_monitoring_project_id: project.id,
instance_administrators_group_id: group.id instance_administrators_group_id: group.id
) )
end end
...@@ -38,7 +38,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService do ...@@ -38,7 +38,7 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService do
it 'deletes project ID from application settings' do it 'deletes project ID from application settings' do
subject.execute subject.execute
expect(application_setting.reload.instance_administration_project_id).to be_nil expect(application_setting.reload.self_monitoring_project_id).to be_nil
end end
it 'does not delete group' do it 'does not delete group' do
......
...@@ -6,7 +6,7 @@ describe Gitlab::Prometheus::Queries::KnativeInvocationQuery do ...@@ -6,7 +6,7 @@ describe Gitlab::Prometheus::Queries::KnativeInvocationQuery do
include PrometheusHelpers include PrometheusHelpers
let(:project) { create(:project) } let(:project) { create(:project) }
let(:serverless_func) { Serverless::Function.new(project, 'test-name', 'test-ns') } let(:serverless_func) { ::Serverless::Function.new(project, 'test-name', 'test-ns') }
let(:client) { double('prometheus_client') } let(:client) { double('prometheus_client') }
subject { described_class.new(client) } subject { described_class.new(client) }
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Serverless::FunctionURI do
let(:function) { 'test-function' }
let(:domain) { 'serverless.gitlab.io' }
let(:pages_domain) { create(:pages_domain, :instance_serverless, domain: domain) }
let!(:cluster) { create(:serverless_domain_cluster, uuid: 'abcdef12345678', pages_domain: pages_domain) }
let(:valid_cluster) { 'aba1cdef123456f278' }
let(:invalid_cluster) { 'aba1cdef123456f178' }
let!(:environment) { create(:environment, name: 'test') }
let(:valid_uri) { "https://#{function}-#{valid_cluster}#{"%x" % environment.id}-#{environment.slug}.#{domain}" }
let(:valid_fqdn) { "#{function}-#{valid_cluster}#{"%x" % environment.id}-#{environment.slug}.#{domain}" }
let(:invalid_uri) { "https://#{function}-#{invalid_cluster}#{"%x" % environment.id}-#{environment.slug}.#{domain}" }
shared_examples 'a valid FunctionURI class' do
describe '#to_s' do
it 'matches valid URI' do
expect(subject.to_s).to eq valid_uri
end
end
describe '#function' do
it 'returns function' do
expect(subject.function).to eq function
end
end
describe '#cluster' do
it 'returns cluster' do
expect(subject.cluster).to eq cluster
end
end
describe '#environment' do
it 'returns environment' do
expect(subject.environment).to eq environment
end
end
end
describe '.new' do
context 'with valid arguments' do
subject { described_class.new(function: function, cluster: cluster, environment: environment) }
it_behaves_like 'a valid FunctionURI class'
end
context 'with invalid arguments' do
subject { described_class.new(function: function, environment: environment) }
it 'raises an exception' do
expect { subject }.to raise_error(ArgumentError)
end
end
end
describe '.parse' do
context 'with valid URI' do
subject { described_class.parse(valid_uri) }
it_behaves_like 'a valid FunctionURI class'
end
context 'with valid FQDN' do
subject { described_class.parse(valid_fqdn) }
it_behaves_like 'a valid FunctionURI class'
end
context 'with invalid URI' do
subject { described_class.parse(invalid_uri) }
it 'returns nil' do
expect(subject).to be_nil
end
end
end
end
# frozen_string_literal: true
require 'fast_spec_helper'
describe Gitlab::SidekiqConfig::CliMethods do
let(:dummy_root) { '/tmp/' }
describe '.worker_queues' do
def expand_path(path)
File.join(dummy_root, path)
end
def stub_exists(exists: true)
['app/workers/all_queues.yml', 'ee/app/workers/all_queues.yml'].each do |path|
allow(File).to receive(:exist?).with(expand_path(path)).and_return(exists)
end
end
def stub_contents(foss_queues, ee_queues)
allow(YAML).to receive(:load_file)
.with(expand_path('app/workers/all_queues.yml'))
.and_return(foss_queues)
allow(YAML).to receive(:load_file)
.with(expand_path('ee/app/workers/all_queues.yml'))
.and_return(ee_queues)
end
before do
described_class.clear_memoization!
end
context 'when the file exists' do
before do
stub_exists(exists: true)
end
shared_examples 'valid file contents' do
it 'memoizes the result' do
result = described_class.worker_queues(dummy_root)
stub_exists(exists: false)
expect(described_class.worker_queues(dummy_root)).to eq(result)
end
it 'flattens and joins the contents' do
expected_queues = %w[queue_a queue_b]
expected_queues = expected_queues.first(1) unless Gitlab.ee?
expect(described_class.worker_queues(dummy_root))
.to match_array(expected_queues)
end
end
context 'when the file contains an array of strings' do
before do
stub_contents(['queue_a'], ['queue_b'])
end
include_examples 'valid file contents'
end
context 'when the file contains an array of hashes' do
before do
stub_contents([{ name: 'queue_a' }], [{ name: 'queue_b' }])
end
include_examples 'valid file contents'
end
end
context 'when the file does not exist' do
before do
stub_exists(exists: false)
end
it 'returns an empty array' do
expect(described_class.worker_queues(dummy_root)).to be_empty
end
end
end
describe '.expand_queues' do
let(:all_queues) do
['cronjob:stuck_import_jobs', 'cronjob:stuck_merge_jobs', 'post_receive']
end
it 'defaults the value of the second argument to .worker_queues' do
allow(described_class).to receive(:worker_queues).and_return([])
expect(described_class.expand_queues(['cronjob']))
.to contain_exactly('cronjob')
allow(described_class).to receive(:worker_queues).and_return(all_queues)
expect(described_class.expand_queues(['cronjob']))
.to contain_exactly('cronjob', 'cronjob:stuck_import_jobs', 'cronjob:stuck_merge_jobs')
end
it 'expands queue namespaces to concrete queue names' do
expect(described_class.expand_queues(['cronjob'], all_queues))
.to contain_exactly('cronjob', 'cronjob:stuck_import_jobs', 'cronjob:stuck_merge_jobs')
end
it 'lets concrete queue names pass through' do
expect(described_class.expand_queues(['post_receive'], all_queues))
.to contain_exactly('post_receive')
end
it 'lets unknown queues pass through' do
expect(described_class.expand_queues(['unknown'], all_queues))
.to contain_exactly('unknown')
end
end
end
...@@ -3,9 +3,17 @@ ...@@ -3,9 +3,17 @@
require 'fast_spec_helper' require 'fast_spec_helper'
describe Gitlab::SidekiqConfig::Worker do describe Gitlab::SidekiqConfig::Worker do
def create_worker(queue:, weight: 0) def create_worker(queue:, **attributes)
namespace = queue.include?(':') && queue.split(':').first namespace = queue.include?(':') && queue.split(':').first
inner_worker = double(queue: queue, queue_namespace: namespace, get_weight: weight) inner_worker = double(
queue: queue,
queue_namespace: namespace,
get_feature_category: attributes[:feature_category],
get_weight: attributes[:weight],
get_worker_resource_boundary: attributes[:resource_boundary],
latency_sensitive_worker?: attributes[:latency_sensitive],
worker_has_external_dependencies?: attributes[:has_external_dependencies]
)
described_class.new(inner_worker, ee: false) described_class.new(inner_worker, ee: false)
end end
...@@ -75,13 +83,32 @@ describe Gitlab::SidekiqConfig::Worker do ...@@ -75,13 +83,32 @@ describe Gitlab::SidekiqConfig::Worker do
end end
describe 'YAML encoding' do describe 'YAML encoding' do
it 'encodes the worker in YAML as a string of the queue' do it 'encodes the worker in YAML as a hash of the queue' do
worker_a = create_worker(queue: 'a') attributes_a = {
worker_b = create_worker(queue: 'b') feature_category: :source_code_management,
has_external_dependencies: false,
latency_sensitive: false,
resource_boundary: :memory,
weight: 2
}
attributes_b = {
feature_category: :not_owned,
has_external_dependencies: true,
latency_sensitive: true,
resource_boundary: :unknown,
weight: 1
}
worker_a = create_worker(queue: 'a', **attributes_a)
worker_b = create_worker(queue: 'b', **attributes_b)
expect(YAML.dump(worker_a))
.to eq(YAML.dump(attributes_a.reverse_merge(name: 'a')))
expect(YAML.dump(worker_a)).to eq(YAML.dump('a'))
expect(YAML.dump([worker_a, worker_b])) expect(YAML.dump([worker_a, worker_b]))
.to eq(YAML.dump(%w[a b])) .to eq(YAML.dump([attributes_a.reverse_merge(name: 'a'),
attributes_b.reverse_merge(name: 'b')]))
end end
end end
......
...@@ -24,27 +24,6 @@ describe Gitlab::SidekiqConfig do ...@@ -24,27 +24,6 @@ describe Gitlab::SidekiqConfig do
end end
end end
describe '.expand_queues' do
it 'expands queue namespaces to concrete queue names' do
queues = described_class.expand_queues(%w[cronjob])
expect(queues).to include('cronjob:stuck_import_jobs')
expect(queues).to include('cronjob:stuck_merge_jobs')
end
it 'lets concrete queue names pass through' do
queues = described_class.expand_queues(%w[post_receive])
expect(queues).to include('post_receive')
end
it 'lets unknown queues pass through' do
queues = described_class.expand_queues(%w[unknown])
expect(queues).to include('unknown')
end
end
describe '.workers_for_all_queues_yml' do describe '.workers_for_all_queues_yml' do
it 'returns a tuple with FOSS workers first' do it 'returns a tuple with FOSS workers first' do
expect(described_class.workers_for_all_queues_yml.first) expect(described_class.workers_for_all_queues_yml.first)
...@@ -53,29 +32,31 @@ describe Gitlab::SidekiqConfig do ...@@ -53,29 +32,31 @@ describe Gitlab::SidekiqConfig do
end end
describe '.all_queues_yml_outdated?' do describe '.all_queues_yml_outdated?' do
before do let(:workers) do
workers = [ [
PostReceive,
MergeWorker, MergeWorker,
PostReceive,
ProcessCommitWorker ProcessCommitWorker
].map { |worker| described_class::Worker.new(worker, ee: false) } ].map { |worker| described_class::Worker.new(worker, ee: false) }
end
before do
allow(described_class).to receive(:workers).and_return(workers) allow(described_class).to receive(:workers).and_return(workers)
allow(Gitlab).to receive(:ee?).and_return(false) allow(Gitlab).to receive(:ee?).and_return(false)
end end
it 'returns true if the YAML file does not match the application code' do it 'returns true if the YAML file does not matcph the application code' do
allow(File).to receive(:read) allow(YAML).to receive(:load_file)
.with(described_class::FOSS_QUEUE_CONFIG_PATH) .with(described_class::FOSS_QUEUE_CONFIG_PATH)
.and_return(YAML.dump(%w[post_receive merge])) .and_return(workers.first(2).map(&:to_yaml))
expect(described_class.all_queues_yml_outdated?).to be(true) expect(described_class.all_queues_yml_outdated?).to be(true)
end end
it 'returns false if the YAML file matches the application code' do it 'returns false if the YAML file matches the application code' do
allow(File).to receive(:read) allow(YAML).to receive(:load_file)
.with(described_class::FOSS_QUEUE_CONFIG_PATH) .with(described_class::FOSS_QUEUE_CONFIG_PATH)
.and_return(YAML.dump(%w[merge post_receive process_commit])) .and_return(workers.map(&:to_yaml))
expect(described_class.all_queues_yml_outdated?).to be(false) expect(described_class.all_queues_yml_outdated?).to be(false)
end end
...@@ -125,17 +106,17 @@ describe Gitlab::SidekiqConfig do ...@@ -125,17 +106,17 @@ describe Gitlab::SidekiqConfig do
end end
it 'returns true if the YAML file does not match the application code' do it 'returns true if the YAML file does not match the application code' do
allow(File).to receive(:read) allow(YAML).to receive(:load_file)
.with(described_class::SIDEKIQ_QUEUES_PATH) .with(described_class::SIDEKIQ_QUEUES_PATH)
.and_return(YAML.dump(queues: expected_queues.reverse)) .and_return(queues: expected_queues.reverse)
expect(described_class.sidekiq_queues_yml_outdated?).to be(true) expect(described_class.sidekiq_queues_yml_outdated?).to be(true)
end end
it 'returns false if the YAML file matches the application code' do it 'returns false if the YAML file matches the application code' do
allow(File).to receive(:read) allow(YAML).to receive(:load_file)
.with(described_class::SIDEKIQ_QUEUES_PATH) .with(described_class::SIDEKIQ_QUEUES_PATH)
.and_return(YAML.dump(queues: expected_queues)) .and_return(queues: expected_queues)
expect(described_class.sidekiq_queues_yml_outdated?).to be(false) expect(described_class.sidekiq_queues_yml_outdated?).to be(false)
end end
......
...@@ -17,7 +17,7 @@ describe Clusters::Applications::Knative do ...@@ -17,7 +17,7 @@ describe Clusters::Applications::Knative do
end end
describe 'associations' do describe 'associations' do
it { is_expected.to have_one(:serverless_domain_cluster).class_name('Serverless::DomainCluster').with_foreign_key('clusters_applications_knative_id').inverse_of(:knative) } it { is_expected.to have_one(:serverless_domain_cluster).class_name('::Serverless::DomainCluster').with_foreign_key('clusters_applications_knative_id').inverse_of(:knative) }
end end
describe 'when cloud run is enabled' do describe 'when cloud run is enabled' do
......
...@@ -70,7 +70,7 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do ...@@ -70,7 +70,7 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do
before do before do
service.api_url = 'http://localhost:9090' service.api_url = 'http://localhost:9090'
stub_application_setting(instance_administration_project_id: project.id) stub_application_setting(self_monitoring_project_id: project.id)
stub_config(prometheus: { enable: true, listen_address: 'localhost:9090' }) stub_config(prometheus: { enable: true, listen_address: 'localhost:9090' })
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe Serverless::DomainCluster do describe ::Serverless::DomainCluster do
subject { create(:serverless_domain_cluster) } subject { create(:serverless_domain_cluster) }
describe 'validations' do describe 'validations' do
...@@ -46,4 +46,8 @@ describe Serverless::DomainCluster do ...@@ -46,4 +46,8 @@ describe Serverless::DomainCluster do
end end
end end
end end
describe 'domain' do
it { is_expected.to respond_to(:domain) }
end
end end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe Serverless::Function do describe ::Serverless::Function do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:func) { described_class.new(project, 'test', 'test-ns') } let(:func) { described_class.new(project, 'test', 'test-ns') }
......
...@@ -84,8 +84,8 @@ describe 'Self-Monitoring project requests' do ...@@ -84,8 +84,8 @@ describe 'Self-Monitoring project requests' do
let(:project) { build(:project) } let(:project) { build(:project) }
before do before do
stub_application_setting(instance_administration_project_id: 1) stub_application_setting(self_monitoring_project_id: 1)
stub_application_setting(instance_administration_project: project) stub_application_setting(self_monitoring_project: project)
end end
it 'does not need job_id' do it 'does not need job_id' do
...@@ -169,7 +169,7 @@ describe 'Self-Monitoring project requests' do ...@@ -169,7 +169,7 @@ describe 'Self-Monitoring project requests' do
.with(job_id) .with(job_id)
.and_return(true) .and_return(true)
stub_application_setting(instance_administration_project_id: 1) stub_application_setting(self_monitoring_project_id: 1)
end end
it_behaves_like 'sets polling header and returns accepted' do it_behaves_like 'sets polling header and returns accepted' do
...@@ -179,7 +179,7 @@ describe 'Self-Monitoring project requests' do ...@@ -179,7 +179,7 @@ describe 'Self-Monitoring project requests' do
context 'when self-monitoring project exists and job does not exist' do context 'when self-monitoring project exists and job does not exist' do
before do before do
stub_application_setting(instance_administration_project_id: 1) stub_application_setting(self_monitoring_project_id: 1)
end end
it 'returns bad_request' do it 'returns bad_request' do
......
...@@ -12,7 +12,7 @@ RSpec.shared_examples 'not accessible if feature flag is disabled' do ...@@ -12,7 +12,7 @@ RSpec.shared_examples 'not accessible if feature flag is disabled' do
expect(response).to have_gitlab_http_status(:not_implemented) expect(response).to have_gitlab_http_status(:not_implemented)
expect(json_response).to eq( expect(json_response).to eq(
'message' => _('Self-monitoring is not enabled on this GitLab server, contact your administrator.'), 'message' => _('Self-monitoring is not enabled on this GitLab server, contact your administrator.'),
'documentation_url' => help_page_path('administration/monitoring/gitlab_instance_administration_project/index') 'documentation_url' => help_page_path('administration/monitoring/gitlab_self_monitoring_project/index')
) )
end end
end end
......
# frozen_string_literal: true
require 'rake_helper'
describe 'gitlab:seed:group_seed rake task' do
let(:username) { 'group_seed' }
let!(:user) { create(:user, username: username) }
let(:task_params) { [2, username] }
before do
Rake.application.rake_require('tasks/gitlab/seed/group_seed')
end
subject { run_rake_task('gitlab:seed:group_seed', task_params) }
it 'performs group seed successfully' do
expect { subject }.not_to raise_error
group = user.groups.first
expect(user.groups.count).to be 3
expect(group.projects.count).to be 2
expect(group.members.count).to be 3
expect(group.milestones.count).to be 2
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment