From 74ad68a3c4943d34cea9d30c0b5e226e3f3ce0c6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 8 Nov 2024 15:17:16 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../factory_bot/excessive_create_list.yml | 2 +- .../rspec/before_all_role_assignment.yml | 4 +- .rubocop_todo/rspec/feature_category.yml | 2 - .../rspec/no_expectation_example.yml | 2 +- .../worker_data_consistency.yml | 5 - GITLAB_KAS_VERSION | 2 +- app/assets/javascripts/boards/index.js | 1 + app/assets/javascripts/issues/list/index.js | 2 + .../components/work_item_detail.vue | 12 +- .../components/work_item_links/index.js | 3 + .../components/work_item_time_tracking.vue | 4 +- app/assets/javascripts/work_items/index.js | 2 + app/controllers/concerns/stream_diffs.rb | 14 ++ app/helpers/events_helper.rb | 6 +- app/models/concerns/commit_signature.rb | 8 +- .../shared/_tags_list.html.haml | 2 +- .../shared/_index.html.haml | 2 +- app/workers/chat_notification_worker.rb | 2 +- app/workers/integrations/execute_worker.rb | 2 +- app/workers/integrations/irker_worker.rb | 2 +- .../jira_connect/forward_event_worker.rb | 2 +- .../jira_connect/retry_request_worker.rb | 2 +- config/events/schema.json | 7 + config/initializers/json_schemer.rb | 10 ++ ...05_clusters_applications_cert_managers.yml | 3 +- ...10216175407_clusters_applications_helm.yml | 3 +- ...16175409_clusters_applications_ingress.yml | 3 +- ...16175411_clusters_applications_knative.yml | 3 +- ...0216175413_clusters_management_project.yml | 3 +- .../20210216175415_clusters_disabled.yml | 3 +- .../20210216175417_clusters_enabled.yml | 3 +- .../20210216175419_clusters_platforms_gke.yml | 3 +- .../20210216175420_clusters_platforms_eks.yml | 3 +- ...20210216175422_clusters_platforms_user.yml | 3 +- ...10216175424_instance_clusters_disabled.yml | 3 +- ...210216175426_instance_clusters_enabled.yml | 3 +- ...20210216175428_group_clusters_disabled.yml | 3 +- .../20210216175430_group_clusters_enabled.yml | 3 +- ...210216175432_project_clusters_disabled.yml | 3 +- ...0210216175434_project_clusters_enabled.yml | 3 +- ...51_agent_users_using_ci_tunnel_monthly.yml | 3 +- .../counts_all/20210216175232_clusters.yml | 3 +- .../20210216175234_clusters_enabled.yml | 3 +- ...0210216175236_project_clusters_enabled.yml | 3 +- .../20210216175238_group_clusters_enabled.yml | 3 +- ...210216175240_instance_clusters_enabled.yml | 3 +- .../20210216175242_clusters_disabled.yml | 3 +- ...210216175244_project_clusters_disabled.yml | 3 +- ...20210216175246_group_clusters_disabled.yml | 3 +- ...10216175248_instance_clusters_disabled.yml | 3 +- .../20210216175250_clusters_platforms_eks.yml | 3 +- .../20210216175251_clusters_platforms_gke.yml | 3 +- ...20210216175253_clusters_platforms_user.yml | 3 +- ...10216175255_clusters_applications_helm.yml | 3 +- ...16175257_clusters_applications_ingress.yml | 3 +- ...59_clusters_applications_cert_managers.yml | 3 +- ...75301_clusters_applications_crossplane.yml | 3 +- ...75303_clusters_applications_prometheus.yml | 3 +- ...216175305_clusters_applications_runner.yml | 3 +- ...16175307_clusters_applications_knative.yml | 3 +- ...09_clusters_applications_elastic_stack.yml | 3 +- ...16175310_clusters_applications_jupyter.yml | 3 +- ...216175312_clusters_applications_cilium.yml | 3 +- ...0216175314_clusters_management_project.yml | 3 +- .../20210216175316_kubernetes_agents.yml | 3 +- ...216175318_kubernetes_agents_with_token.yml | 3 +- ...29_clusters_applications_cert_managers.yml | 3 +- ...10216175331_clusters_applications_helm.yml | 3 +- ...16175333_clusters_applications_ingress.yml | 3 +- ...16175335_clusters_applications_knative.yml | 3 +- ...0216175337_clusters_management_project.yml | 3 +- .../20210216175339_clusters_disabled.yml | 3 +- .../20210216175341_clusters_enabled.yml | 3 +- .../20210216175343_clusters_platforms_gke.yml | 3 +- .../20210216175345_clusters_platforms_eks.yml | 3 +- ...20210216175346_clusters_platforms_user.yml | 3 +- ...10216175348_instance_clusters_disabled.yml | 3 +- ...210216175350_instance_clusters_enabled.yml | 3 +- ...20210216175352_group_clusters_disabled.yml | 3 +- .../20210216175354_group_clusters_enabled.yml | 3 +- ...210216175356_project_clusters_disabled.yml | 3 +- ...0210216175358_project_clusters_enabled.yml | 3 +- ...175403_projects_with_prometheus_alerts.yml | 3 +- ...216181949_clusters_applications_runner.yml | 3 +- ...kubernetes_agent_k8s_api_proxy_request.yml | 3 +- ...00930_clusters_integrations_prometheus.yml | 3 +- ...31_clusters_integrations_elastic_stack.yml | 3 +- config/metrics/schema/base.json | 10 +- .../metrics/settings/20230328165533_mode.yml | 3 +- ...ensure_id_uniqueness_for_p_ci_pipelines.rb | 18 +++ db/schema_migrations/20241108105453 | 1 + db/structure.sql | 37 +++-- doc/api/vulnerabilities.md | 10 +- doc/development/work_items_widgets.md | 2 +- .../repository/signed_commits/index.md | 2 +- .../tracking/event_definition_validator.rb | 7 +- lib/gitlab/usage/metric_definition.rb | 9 +- locale/gitlab.pot | 3 + scripts/internal_events/cli/metric.rb | 2 +- .../controllers/concerns/stream_diffs_spec.rb | 6 + .../work_items/create_issue_work_item_spec.rb | 0 .../work_items/linked_work_items_spec.rb | 0 .../work_items/shortcuts_work_item_spec.rb | 0 .../work_items/work_item_children_spec.rb | 0 .../work_items/work_item_spec.rb | 0 .../work_items_list_filters_spec.rb | 0 .../components/work_item_detail_modal_spec.js | 1 + .../components/work_item_detail_spec.js | 17 +++ .../components/work_item_drawer_spec.js | 1 + spec/frontend/work_items/router_spec.js | 1 + .../ci/project_pipeline_resolver_spec.rb | 35 ++--- ...peline_partition_id_on_p_ci_builds_spec.rb | 6 +- .../delete_orphaned_build_records_spec.rb | 6 +- ...orphaned_pipeline_variable_records_spec.rb | 6 +- .../delete_orphaned_stage_records_spec.rb | 6 +- ...nullify_builds_auto_canceled_by_id_spec.rb | 6 +- .../gitlab/ci/badge/pipeline/status_spec.rb | 142 +++++++----------- .../event_definition_validator_spec.rb | 2 + .../gitlab/usage/metric_definition_spec.rb | 2 + spec/models/ci/pipeline_spec.rb | 17 ++- .../commit_signatures/gpg_signature_spec.rb | 45 +++++- .../commit_signatures/ssh_signature_spec.rb | 31 +++- spec/scripts/setup/tests-metadata_spec.rb | 2 +- .../helpers/user_with_namespace_shim.yml | 2 +- .../_generic_commit_status.html.haml_spec.rb | 18 ++- 125 files changed, 486 insertions(+), 259 deletions(-) create mode 100644 config/initializers/json_schemer.rb create mode 100644 db/post_migrate/20241108105453_ensure_id_uniqueness_for_p_ci_pipelines.rb create mode 100644 db/schema_migrations/20241108105453 rename spec/features/{projects => }/work_items/create_issue_work_item_spec.rb (100%) rename spec/features/{projects => }/work_items/linked_work_items_spec.rb (100%) rename spec/features/{projects => }/work_items/shortcuts_work_item_spec.rb (100%) rename spec/features/{projects => }/work_items/work_item_children_spec.rb (100%) rename spec/features/{projects => }/work_items/work_item_spec.rb (100%) rename spec/features/{projects => }/work_items/work_items_list_filters_spec.rb (100%) diff --git a/.rubocop_todo/factory_bot/excessive_create_list.yml b/.rubocop_todo/factory_bot/excessive_create_list.yml index 3b498e8ad80..62b53e08b9e 100644 --- a/.rubocop_todo/factory_bot/excessive_create_list.yml +++ b/.rubocop_todo/factory_bot/excessive_create_list.yml @@ -20,8 +20,8 @@ FactoryBot/ExcessiveCreateList: - 'spec/features/issues/user_edits_issue_spec.rb' - 'spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb' - 'spec/features/projects/container_registry_spec.rb' - - 'spec/features/projects/work_items/work_item_spec.rb' - 'spec/features/users/overview_spec.rb' + - 'spec/features/work_items/work_item_spec.rb' - 'spec/frontend/fixtures/timelogs.rb' - 'spec/lib/gitlab/database/background_migration/batched_migration_spec.rb' - 'spec/lib/gitlab/database/consistency_checker_spec.rb' diff --git a/.rubocop_todo/rspec/before_all_role_assignment.yml b/.rubocop_todo/rspec/before_all_role_assignment.yml index c5af3b413ae..519ef083ab5 100644 --- a/.rubocop_todo/rspec/before_all_role_assignment.yml +++ b/.rubocop_todo/rspec/before_all_role_assignment.yml @@ -808,8 +808,6 @@ RSpec/BeforeAllRoleAssignment: - 'spec/features/projects/terraform_spec.rb' - 'spec/features/projects/user_sees_user_popover_spec.rb' - 'spec/features/projects/user_views_empty_project_spec.rb' - - 'spec/features/projects/work_items/work_item_children_spec.rb' - - 'spec/features/projects/work_items/work_item_spec.rb' - 'spec/features/promotion_spec.rb' - 'spec/features/registrations/oauth_registration_spec.rb' - 'spec/features/reportable_note/snippets_spec.rb' @@ -824,6 +822,8 @@ RSpec/BeforeAllRoleAssignment: - 'spec/features/search/user_uses_header_search_field_spec.rb' - 'spec/features/user_can_display_performance_bar_spec.rb' - 'spec/features/user_sorts_things_spec.rb' + - 'spec/features/work_items/work_item_children_spec.rb' + - 'spec/features/work_items/work_item_spec.rb' - 'spec/finders/alert_management/alerts_finder_spec.rb' - 'spec/finders/autocomplete/deploy_keys_with_write_access_finder_spec.rb' - 'spec/finders/autocomplete/routes_finder_spec.rb' diff --git a/.rubocop_todo/rspec/feature_category.yml b/.rubocop_todo/rspec/feature_category.yml index 8987e088cc4..51d546f9a9b 100644 --- a/.rubocop_todo/rspec/feature_category.yml +++ b/.rubocop_todo/rspec/feature_category.yml @@ -2135,7 +2135,6 @@ RSpec/FeatureCategory: - 'spec/lib/gitlab/ci/badge/coverage/report_spec.rb' - 'spec/lib/gitlab/ci/badge/coverage/template_spec.rb' - 'spec/lib/gitlab/ci/badge/pipeline/metadata_spec.rb' - - 'spec/lib/gitlab/ci/badge/pipeline/status_spec.rb' - 'spec/lib/gitlab/ci/badge/pipeline/template_spec.rb' - 'spec/lib/gitlab/ci/badge/release/latest_release_spec.rb' - 'spec/lib/gitlab/ci/badge/release/metadata_spec.rb' @@ -4155,7 +4154,6 @@ RSpec/FeatureCategory: - 'spec/views/projects/imports/new.html.haml_spec.rb' - 'spec/views/projects/issues/_related_branches.html.haml_spec.rb' - 'spec/views/projects/issues/show.html.haml_spec.rb' - - 'spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb' - 'spec/views/projects/jobs/show.html.haml_spec.rb' - 'spec/views/projects/merge_requests/_commits.html.haml_spec.rb' - 'spec/views/projects/merge_requests/edit.html.haml_spec.rb' diff --git a/.rubocop_todo/rspec/no_expectation_example.yml b/.rubocop_todo/rspec/no_expectation_example.yml index 3191780e7d7..e3f83c39a97 100644 --- a/.rubocop_todo/rspec/no_expectation_example.yml +++ b/.rubocop_todo/rspec/no_expectation_example.yml @@ -85,9 +85,9 @@ RSpec/NoExpectationExample: - 'spec/features/projects/environments/environment_spec.rb' - 'spec/features/projects/files/template_selector_menu_spec.rb' - 'spec/features/projects/files/undo_template_spec.rb' - - 'spec/features/projects/work_items/linked_work_items_spec.rb' - 'spec/features/user_settings/ssh_keys_spec.rb' - 'spec/features/users/login_spec.rb' + - 'spec/features/work_items/linked_work_items_spec.rb' - 'spec/frontend/fixtures/issues.rb' - 'spec/frontend/fixtures/listbox.rb' - 'spec/frontend/fixtures/merge_requests.rb' diff --git a/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml b/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml index 56ac9f8aef6..21c1337cb55 100644 --- a/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml +++ b/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml @@ -5,7 +5,6 @@ SidekiqLoadBalancing/WorkerDataConsistency: - 'app/workers/bulk_imports/pipeline_batch_worker.rb' - 'app/workers/bulk_imports/relation_batch_export_worker.rb' - 'app/workers/bulk_imports/stale_import_worker.rb' - - 'app/workers/chat_notification_worker.rb' - 'app/workers/ci/archive_traces_cron_worker.rb' - 'app/workers/ci/build_prepare_worker.rb' - 'app/workers/ci/build_schedule_worker.rb' @@ -124,8 +123,6 @@ SidekiqLoadBalancing/WorkerDataConsistency: - 'app/workers/incident_management/close_incident_worker.rb' - 'app/workers/incident_management/pager_duty/process_incident_worker.rb' - 'app/workers/incident_management/process_alert_worker_v2.rb' - - 'app/workers/integrations/execute_worker.rb' - - 'app/workers/integrations/irker_worker.rb' - 'app/workers/integrations/propagate_integration_descendant_worker.rb' - 'app/workers/invalid_gpg_signature_update_worker.rb' - 'app/workers/issuable/label_links_destroy_worker.rb' @@ -135,8 +132,6 @@ SidekiqLoadBalancing/WorkerDataConsistency: - 'app/workers/issues/close_worker.rb' - 'app/workers/issues/placement_worker.rb' - 'app/workers/issues/rebalancing_worker.rb' - - 'app/workers/jira_connect/forward_event_worker.rb' - - 'app/workers/jira_connect/retry_request_worker.rb' - 'app/workers/loose_foreign_keys/cleanup_worker.rb' - 'app/workers/mail_scheduler/issue_due_worker.rb' - 'app/workers/mail_scheduler/notification_service_worker.rb' diff --git a/GITLAB_KAS_VERSION b/GITLAB_KAS_VERSION index 0b246b77c85..07122593911 100644 --- a/GITLAB_KAS_VERSION +++ b/GITLAB_KAS_VERSION @@ -1 +1 @@ -e39eef132f47d2c679e0cc5d199406084135540b +a3bc04233c29d8368ac509e8c360bf82f104a2ce diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index 0fda728cf8c..d6ab3f7dc66 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -127,6 +127,7 @@ function mountBoardApp(el) { hasIssueWeightsFeature: parseBoolean(el.dataset.weightFeatureAvailable), hasIssuableHealthStatusFeature: parseBoolean(el.dataset.healthStatusFeatureAvailable), hasSubepicsFeature: parseBoolean(el.dataset.subEpicsFeatureAvailable), + hasLinkedItemsEpicsFeature: parseBoolean(el.dataset.hasLinkedItemsEpicsFeature), }, render: (createComponent) => createComponent(BoardApp), }); diff --git a/app/assets/javascripts/issues/list/index.js b/app/assets/javascripts/issues/list/index.js index d5569f52054..f76a1f53816 100644 --- a/app/assets/javascripts/issues/list/index.js +++ b/app/assets/javascripts/issues/list/index.js @@ -118,6 +118,7 @@ export async function mountIssuesListApp() { wiIssuesListPath, wiLabelsManagePath, wiReportAbusePath, + hasLinkedItemsEpicsFeature, } = el.dataset; return new Vue({ @@ -202,6 +203,7 @@ export async function mountIssuesListApp() { labelsManagePath: wiLabelsManagePath, reportAbusePath: wiReportAbusePath, hasSubepicsFeature: false, + hasLinkedItemsEpicsFeature: parseBoolean(hasLinkedItemsEpicsFeature), }, render: (createComponent) => createComponent(IssuesListApp), }); diff --git a/app/assets/javascripts/work_items/components/work_item_detail.vue b/app/assets/javascripts/work_items/components/work_item_detail.vue index 0785498ebfc..feb59ffd6a6 100644 --- a/app/assets/javascripts/work_items/components/work_item_detail.vue +++ b/app/assets/javascripts/work_items/components/work_item_detail.vue @@ -104,7 +104,13 @@ export default { WorkItemAbuseModal, }, mixins: [glFeatureFlagMixin()], - inject: ['fullPath', 'reportAbusePath', 'groupPath', 'hasSubepicsFeature'], + inject: [ + 'fullPath', + 'reportAbusePath', + 'groupPath', + 'hasSubepicsFeature', + 'hasLinkedItemsEpicsFeature', + ], props: { isModal: { type: Boolean, @@ -374,7 +380,9 @@ export default { return !this.isModal && !this.editMode && !this.isDrawer; }, workItemLinkedItems() { - return this.isWidgetPresent(WIDGET_TYPE_LINKED_ITEMS); + return this.workItemType === WORK_ITEM_TYPE_VALUE_EPIC + ? this.isWidgetPresent(WIDGET_TYPE_LINKED_ITEMS) && this.hasLinkedItemsEpicsFeature + : this.isWidgetPresent(WIDGET_TYPE_LINKED_ITEMS); }, showWorkItemTree() { return this.isWidgetPresent(WIDGET_TYPE_HIERARCHY) && this.allowedChildTypes?.length > 0; diff --git a/app/assets/javascripts/work_items/components/work_item_links/index.js b/app/assets/javascripts/work_items/components/work_item_links/index.js index 93adb52bd7e..d3cb1e140ff 100644 --- a/app/assets/javascripts/work_items/components/work_item_links/index.js +++ b/app/assets/javascripts/work_items/components/work_item_links/index.js @@ -1,6 +1,7 @@ import Vue from 'vue'; import { GlToast } from '@gitlab/ui'; import { apolloProvider } from '~/graphql_shared/issuable_client'; +import { parseBoolean } from '~/lib/utils/common_utils'; import WorkItemLinks from './work_item_links.vue'; Vue.use(GlToast); @@ -25,6 +26,7 @@ export default function initWorkItemLinks() { wiLabelsManagePath, wiNewCommentTemplatePaths, wiReportAbusePath, + hasLinkedItemsEpicsFeature, } = workItemLinksRoot.dataset; return new Vue({ @@ -45,6 +47,7 @@ export default function initWorkItemLinks() { labelsManagePath: wiLabelsManagePath, newCommentTemplatePaths: JSON.parse(wiNewCommentTemplatePaths), reportAbusePath: wiReportAbusePath, + hasLinkedItemsEpicsFeature: parseBoolean(hasLinkedItemsEpicsFeature), }, render: (createElement) => createElement(WorkItemLinks, { diff --git a/app/assets/javascripts/work_items/components/work_item_time_tracking.vue b/app/assets/javascripts/work_items/components/work_item_time_tracking.vue index 0471099d778..7f53fbf4715 100644 --- a/app/assets/javascripts/work_items/components/work_item_time_tracking.vue +++ b/app/assets/javascripts/work_items/components/work_item_time_tracking.vue @@ -132,6 +132,7 @@ export default { v-gl-modal="'time-tracking-report'" v-gl-tooltip="s__('TimeTracking|View time tracking report')" variant="link" + class="!gl-text-sm" data-testid="view-time-spent-button" > {{ humanTotalTimeSpent }} @@ -152,6 +153,7 @@ export default { v-gl-modal="$options.setTimeEstimateModalId" v-gl-tooltip="s__('TimeTracking|Set estimate')" variant="link" + class="!gl-text-sm" data-testid="set-estimate-button" > {{ humanTimeEstimate }} @@ -163,7 +165,7 @@ export default { diff --git a/app/assets/javascripts/work_items/index.js b/app/assets/javascripts/work_items/index.js index b53616c6831..cf1d23f3ccf 100644 --- a/app/assets/javascripts/work_items/index.js +++ b/app/assets/javascripts/work_items/index.js @@ -56,6 +56,7 @@ export const initWorkItemsRoot = ({ workItemType, workspaceType } = {}) => { canBulkEditEpics, groupIssuesPath, labelsFetchPath, + hasLinkedItemsEpicsFeature, } = el.dataset; const isGroup = workspaceType === WORKSPACE_GROUP; @@ -125,6 +126,7 @@ export const initWorkItemsRoot = ({ workItemType, workspaceType } = {}) => { canBulkEditEpics: parseBoolean(canBulkEditEpics), groupIssuesPath, labelsFetchPath, + hasLinkedItemsEpicsFeature: parseBoolean(hasLinkedItemsEpicsFeature), }, mounted() { performanceMarkAndMeasure({ diff --git a/app/controllers/concerns/stream_diffs.rb b/app/controllers/concerns/stream_diffs.rb index 8215351ea90..120eeb493ae 100644 --- a/app/controllers/concerns/stream_diffs.rb +++ b/app/controllers/concerns/stream_diffs.rb @@ -20,6 +20,14 @@ module StreamDiffs response.stream.close end + def request + # We only need to do this in rapid diffs streaming endpoints + # as calling `request.format` (which can happen when rendering view components + # but can possibly happen in other places as well) can raise an exception + # while streaming diffs. + Request.new(super) + end + private def rapid_diffs_enabled? @@ -50,4 +58,10 @@ module StreamDiffs layout: false ) end + + class Request < SimpleDelegator + def format + Mime::Type.lookup("text/html") + end + end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index c0038713667..408d48266ab 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -270,11 +270,7 @@ module EventsHelper end def event_wiki_page_target_url(event) - if event.project_id.present? - project_wiki_url(event.project, event.target&.canonical_slug || Wiki::HOMEPAGE) - elsif event.group_id.present? - group_wiki_url(event.group, event.target&.canonical_slug || Wiki::HOMEPAGE) - end + project_wiki_url(event.project, event.target&.canonical_slug || Wiki::HOMEPAGE) if event.project_id.present? end def event_note_title_html(event) diff --git a/app/models/concerns/commit_signature.rb b/app/models/concerns/commit_signature.rb index 2eac6e62dac..777124702ff 100644 --- a/app/models/concerns/commit_signature.rb +++ b/app/models/concerns/commit_signature.rb @@ -44,7 +44,7 @@ module CommitSignature def reverified_status return verification_status unless Feature.enabled?(:check_for_mailmapped_commit_emails, project) - return verification_status unless verified? && ssh? + return verification_status unless verified_ssh? || verified_system? verified_emails = signed_by_user&.verified_emails if verified_emails&.exclude?(commit.author_email) @@ -53,4 +53,10 @@ module CommitSignature verification_status end end + + private + + def verified_ssh? + verified? && ssh? + end end diff --git a/app/views/projects/protected_tags/shared/_tags_list.html.haml b/app/views/projects/protected_tags/shared/_tags_list.html.haml index 03c6e262053..098a65a095a 100644 --- a/app/views/projects/protected_tags/shared/_tags_list.html.haml +++ b/app/views/projects/protected_tags/shared/_tags_list.html.haml @@ -24,4 +24,4 @@ %th %tbody= yield - = paginate @protected_tags, theme: 'gitlab' + = paginate @protected_tags, theme: 'gitlab', params: { anchor: 'js-protected-tags-settings' } diff --git a/app/views/protected_branches/shared/_index.html.haml b/app/views/protected_branches/shared/_index.html.haml index 7b6e43bc82c..b49f5d30155 100644 --- a/app/views/protected_branches/shared/_index.html.haml +++ b/app/views/protected_branches/shared/_index.html.haml @@ -34,4 +34,4 @@ = content_for :create_protected_branch - c.with_pagination do - = paginate @protected_branches, theme: 'gitlab' + = paginate @protected_branches, theme: 'gitlab', params: { anchor: 'js-protected-branches-settings' } diff --git a/app/workers/chat_notification_worker.rb b/app/workers/chat_notification_worker.rb index 4ee32a43808..12056df2cfa 100644 --- a/app/workers/chat_notification_worker.rb +++ b/app/workers/chat_notification_worker.rb @@ -3,7 +3,7 @@ class ChatNotificationWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker - data_consistency :always + data_consistency :sticky TimeoutExceeded = Class.new(StandardError) diff --git a/app/workers/integrations/execute_worker.rb b/app/workers/integrations/execute_worker.rb index c54f5073a4f..ca3abd0f4d0 100644 --- a/app/workers/integrations/execute_worker.rb +++ b/app/workers/integrations/execute_worker.rb @@ -4,7 +4,7 @@ module Integrations class ExecuteWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker - data_consistency :always + data_consistency :delayed sidekiq_options retry: 3 sidekiq_options dead: false feature_category :integrations diff --git a/app/workers/integrations/irker_worker.rb b/app/workers/integrations/irker_worker.rb index b6f5e9db227..a141ed206ef 100644 --- a/app/workers/integrations/irker_worker.rb +++ b/app/workers/integrations/irker_worker.rb @@ -8,7 +8,7 @@ module Integrations class IrkerWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker - data_consistency :always + data_consistency :sticky sidekiq_options retry: 3 feature_category :integrations urgency :low diff --git a/app/workers/jira_connect/forward_event_worker.rb b/app/workers/jira_connect/forward_event_worker.rb index 14922db5420..1264c967510 100644 --- a/app/workers/jira_connect/forward_event_worker.rb +++ b/app/workers/jira_connect/forward_event_worker.rb @@ -4,7 +4,7 @@ module JiraConnect class ForwardEventWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker - data_consistency :always + data_consistency :delayed queue_namespace :jira_connect feature_category :integrations urgency :low diff --git a/app/workers/jira_connect/retry_request_worker.rb b/app/workers/jira_connect/retry_request_worker.rb index b0f6dada639..bfa0e48feca 100644 --- a/app/workers/jira_connect/retry_request_worker.rb +++ b/app/workers/jira_connect/retry_request_worker.rb @@ -4,7 +4,7 @@ module JiraConnect class RetryRequestWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker - data_consistency :always + data_consistency :delayed queue_namespace :jira_connect feature_category :integrations urgency :low diff --git a/config/events/schema.json b/config/events/schema.json index 6e43b23bba2..3689238550e 100644 --- a/config/events/schema.json +++ b/config/events/schema.json @@ -136,6 +136,13 @@ "product_group": { "$ref": "../metrics/schema/product_groups.json" }, + "product_categories": { + "type": "array", + "items": { + "type": "string", + "format": "known_product_category" + } + }, "introduced_by_url": { "type": [ "string", diff --git a/config/initializers/json_schemer.rb b/config/initializers/json_schemer.rb new file mode 100644 index 00000000000..44627b23dc7 --- /dev/null +++ b/config/initializers/json_schemer.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +JSONSchemer.configure do |config| + categories_filepath = Rails.root.join('config/feature_categories.yml') + feature_categories = YAML.load_file(categories_filepath) + + config.formats['known_product_category'] = proc do |category, _format| + feature_categories.include?(category) + end +end diff --git a/config/metrics/counts_28d/20210216175405_clusters_applications_cert_managers.yml b/config/metrics/counts_28d/20210216175405_clusters_applications_cert_managers.yml index 5b4fd0e0362..894f6ee7df7 100644 --- a/config/metrics/counts_28d/20210216175405_clusters_applications_cert_managers.yml +++ b/config/metrics/counts_28d/20210216175405_clusters_applications_cert_managers.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_applications_cert_managers description: Count user ids from GitLab Managed clusters with Cert Manager enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175407_clusters_applications_helm.yml b/config/metrics/counts_28d/20210216175407_clusters_applications_helm.yml index 5a9b376d36d..6d2885f618c 100644 --- a/config/metrics/counts_28d/20210216175407_clusters_applications_helm.yml +++ b/config/metrics/counts_28d/20210216175407_clusters_applications_helm.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_applications_helm description: Count user ids from GitLab Managed clusters with Helm enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175409_clusters_applications_ingress.yml b/config/metrics/counts_28d/20210216175409_clusters_applications_ingress.yml index 507600fbf1d..7c1efd6acad 100644 --- a/config/metrics/counts_28d/20210216175409_clusters_applications_ingress.yml +++ b/config/metrics/counts_28d/20210216175409_clusters_applications_ingress.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_applications_ingress description: Count user ids from GitLab Managed clusters with Ingress enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175411_clusters_applications_knative.yml b/config/metrics/counts_28d/20210216175411_clusters_applications_knative.yml index 01f3fd6bdfc..c300ff94988 100644 --- a/config/metrics/counts_28d/20210216175411_clusters_applications_knative.yml +++ b/config/metrics/counts_28d/20210216175411_clusters_applications_knative.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_applications_knative description: Count user ids from GitLab Managed clusters with Knative enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175413_clusters_management_project.yml b/config/metrics/counts_28d/20210216175413_clusters_management_project.yml index 668623b78b6..6fcf068764d 100644 --- a/config/metrics/counts_28d/20210216175413_clusters_management_project.yml +++ b/config/metrics/counts_28d/20210216175413_clusters_management_project.yml @@ -4,7 +4,8 @@ key_path: usage_activity_by_stage_monthly.configure.clusters_management_project description: Number of Kubernetes clusters with clusters management project being set product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175415_clusters_disabled.yml b/config/metrics/counts_28d/20210216175415_clusters_disabled.yml index 1e0c45d30ef..91297aa6292 100644 --- a/config/metrics/counts_28d/20210216175415_clusters_disabled.yml +++ b/config/metrics/counts_28d/20210216175415_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_disabled description: Number of user ids from GitLab Managed disabled clusters product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175417_clusters_enabled.yml b/config/metrics/counts_28d/20210216175417_clusters_enabled.yml index e1a39387670..be2dad8a1db 100644 --- a/config/metrics/counts_28d/20210216175417_clusters_enabled.yml +++ b/config/metrics/counts_28d/20210216175417_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_enabled description: Number of distict user ids from GitLab Managed clusters currently enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175419_clusters_platforms_gke.yml b/config/metrics/counts_28d/20210216175419_clusters_platforms_gke.yml index 8549e80d0d8..29eb9f1fa25 100644 --- a/config/metrics/counts_28d/20210216175419_clusters_platforms_gke.yml +++ b/config/metrics/counts_28d/20210216175419_clusters_platforms_gke.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_platforms_gke description: Number of user ids from GitLab Managed clusters provisioned with GitLab on GCE GKE product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175420_clusters_platforms_eks.yml b/config/metrics/counts_28d/20210216175420_clusters_platforms_eks.yml index 4cc9f6304b7..c86e70a0ebe 100644 --- a/config/metrics/counts_28d/20210216175420_clusters_platforms_eks.yml +++ b/config/metrics/counts_28d/20210216175420_clusters_platforms_eks.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_platforms_eks description: Number of user ids from GitLab Managed clusters provisioned with GitLab on AWS EKS product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175422_clusters_platforms_user.yml b/config/metrics/counts_28d/20210216175422_clusters_platforms_user.yml index e88213b5428..36760a0dac5 100644 --- a/config/metrics/counts_28d/20210216175422_clusters_platforms_user.yml +++ b/config/metrics/counts_28d/20210216175422_clusters_platforms_user.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.clusters_platforms_user description: Number of user ids from GitLab Managed clusters that are user provisioned product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175424_instance_clusters_disabled.yml b/config/metrics/counts_28d/20210216175424_instance_clusters_disabled.yml index 37881aaf5ea..d9c427e091d 100644 --- a/config/metrics/counts_28d/20210216175424_instance_clusters_disabled.yml +++ b/config/metrics/counts_28d/20210216175424_instance_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.instance_clusters_disabled description: Number of users from GitLab Managed disabled clusters attached to the instance product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175426_instance_clusters_enabled.yml b/config/metrics/counts_28d/20210216175426_instance_clusters_enabled.yml index 52edb7afedf..c6af1c365c5 100644 --- a/config/metrics/counts_28d/20210216175426_instance_clusters_enabled.yml +++ b/config/metrics/counts_28d/20210216175426_instance_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.instance_clusters_enabled description: Number of user ids from GitLab Managed enabled clusters attached to the instance product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175428_group_clusters_disabled.yml b/config/metrics/counts_28d/20210216175428_group_clusters_disabled.yml index 95bf3e0bf7c..803a8bd91c8 100644 --- a/config/metrics/counts_28d/20210216175428_group_clusters_disabled.yml +++ b/config/metrics/counts_28d/20210216175428_group_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.group_clusters_disabled description: Number of user ids GitLab Managed disabled clusters attached to groups product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175430_group_clusters_enabled.yml b/config/metrics/counts_28d/20210216175430_group_clusters_enabled.yml index 3b84cdd59fe..16d72bb30f2 100644 --- a/config/metrics/counts_28d/20210216175430_group_clusters_enabled.yml +++ b/config/metrics/counts_28d/20210216175430_group_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.group_clusters_enabled description: Count disctinct user ids from GitLab Managed enabled clusters attached to groups product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175432_project_clusters_disabled.yml b/config/metrics/counts_28d/20210216175432_project_clusters_disabled.yml index 98e4f69d6fb..8180cc0031e 100644 --- a/config/metrics/counts_28d/20210216175432_project_clusters_disabled.yml +++ b/config/metrics/counts_28d/20210216175432_project_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.project_clusters_disabled description: Number of user ids from GitLab Managed disabled clusters attached to projects product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20210216175434_project_clusters_enabled.yml b/config/metrics/counts_28d/20210216175434_project_clusters_enabled.yml index b107d906ae5..bfecd17dddd 100644 --- a/config/metrics/counts_28d/20210216175434_project_clusters_enabled.yml +++ b/config/metrics/counts_28d/20210216175434_project_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: operational key_path: usage_activity_by_stage_monthly.configure.project_clusters_enabled description: Number of user ids from GitLab Managed enabled clusters attached to projects product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: 28d diff --git a/config/metrics/counts_28d/20220729001651_agent_users_using_ci_tunnel_monthly.yml b/config/metrics/counts_28d/20220729001651_agent_users_using_ci_tunnel_monthly.yml index 83cd443607b..f737ba150ff 100644 --- a/config/metrics/counts_28d/20220729001651_agent_users_using_ci_tunnel_monthly.yml +++ b/config/metrics/counts_28d/20220729001651_agent_users_using_ci_tunnel_monthly.yml @@ -2,7 +2,8 @@ key_path: redis_hll_counters.kubernetes_agent.agent_users_using_ci_tunnel_monthly description: MAU of the Agent for Kubernetes CI/CD Tunnel product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active milestone: "15.3" diff --git a/config/metrics/counts_all/20210216175232_clusters.yml b/config/metrics/counts_all/20210216175232_clusters.yml index c4ed7203a5c..7c4ace99a44 100644 --- a/config/metrics/counts_all/20210216175232_clusters.yml +++ b/config/metrics/counts_all/20210216175232_clusters.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters description: Total GitLab Managed clusters both enabled and disabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175234_clusters_enabled.yml b/config/metrics/counts_all/20210216175234_clusters_enabled.yml index e05a787c56d..d806fb7efff 100644 --- a/config/metrics/counts_all/20210216175234_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175234_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_enabled description: Number of Kubernetes clusters attached to GitLab currently enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml b/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml index a0737b86095..b11d204fce0 100644 --- a/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.project_clusters_enabled description: Total GitLab Managed clusters attached to projects product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175238_group_clusters_enabled.yml b/config/metrics/counts_all/20210216175238_group_clusters_enabled.yml index 29fec812097..11645521f59 100644 --- a/config/metrics/counts_all/20210216175238_group_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175238_group_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.group_clusters_enabled description: Total GitLab Managed clusters attached to groups product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175240_instance_clusters_enabled.yml b/config/metrics/counts_all/20210216175240_instance_clusters_enabled.yml index a60745eea4c..0fe7a1288c7 100644 --- a/config/metrics/counts_all/20210216175240_instance_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175240_instance_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.instance_clusters_enabled description: Total GitLab Managed clusters attached to the instance product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175242_clusters_disabled.yml b/config/metrics/counts_all/20210216175242_clusters_disabled.yml index aefe53a3c91..436a661bf3c 100644 --- a/config/metrics/counts_all/20210216175242_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175242_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_disabled description: Number of Kubernetes clusters attached to GitLab currently disabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175244_project_clusters_disabled.yml b/config/metrics/counts_all/20210216175244_project_clusters_disabled.yml index 669f6b76d50..a0667f4d379 100644 --- a/config/metrics/counts_all/20210216175244_project_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175244_project_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.project_clusters_disabled description: Total GitLab Managed disabled clusters previously attached to projects product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175246_group_clusters_disabled.yml b/config/metrics/counts_all/20210216175246_group_clusters_disabled.yml index 8f08dc0f099..65e36efea2c 100644 --- a/config/metrics/counts_all/20210216175246_group_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175246_group_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.group_clusters_disabled description: Total GitLab Managed disabled clusters previously attached to groups product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml b/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml index 101dd59ba94..7d947dbe3ce 100644 --- a/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.instance_clusters_disabled description: Total GitLab Managed disabled clusters previously attached to the instance product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175250_clusters_platforms_eks.yml b/config/metrics/counts_all/20210216175250_clusters_platforms_eks.yml index 555bbaf870d..4ba9f16b821 100644 --- a/config/metrics/counts_all/20210216175250_clusters_platforms_eks.yml +++ b/config/metrics/counts_all/20210216175250_clusters_platforms_eks.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_platforms_eks description: Total GitLab Managed clusters provisioned with GitLab on AWS EKS product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175251_clusters_platforms_gke.yml b/config/metrics/counts_all/20210216175251_clusters_platforms_gke.yml index 77958ffb868..473286e08b0 100644 --- a/config/metrics/counts_all/20210216175251_clusters_platforms_gke.yml +++ b/config/metrics/counts_all/20210216175251_clusters_platforms_gke.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_platforms_gke description: Total GitLab Managed clusters provisioned with GitLab on GCE GKE product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175253_clusters_platforms_user.yml b/config/metrics/counts_all/20210216175253_clusters_platforms_user.yml index 27e172e7d2e..e2b234c3d7a 100644 --- a/config/metrics/counts_all/20210216175253_clusters_platforms_user.yml +++ b/config/metrics/counts_all/20210216175253_clusters_platforms_user.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_platforms_user description: Total GitLab Managed clusters that are user provisioned product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175255_clusters_applications_helm.yml b/config/metrics/counts_all/20210216175255_clusters_applications_helm.yml index 95c743c76f2..7a26691a8bb 100644 --- a/config/metrics/counts_all/20210216175255_clusters_applications_helm.yml +++ b/config/metrics/counts_all/20210216175255_clusters_applications_helm.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_helm description: Total GitLab Managed clusters with GitLab Managed App:Helm enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175257_clusters_applications_ingress.yml b/config/metrics/counts_all/20210216175257_clusters_applications_ingress.yml index d98cb81354b..5d61b4b33c7 100644 --- a/config/metrics/counts_all/20210216175257_clusters_applications_ingress.yml +++ b/config/metrics/counts_all/20210216175257_clusters_applications_ingress.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_ingress description: Total GitLab Managed clusters with GitLab Managed App:Ingress installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175259_clusters_applications_cert_managers.yml b/config/metrics/counts_all/20210216175259_clusters_applications_cert_managers.yml index 44db1e8ea0c..b84d6002ef9 100644 --- a/config/metrics/counts_all/20210216175259_clusters_applications_cert_managers.yml +++ b/config/metrics/counts_all/20210216175259_clusters_applications_cert_managers.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_cert_managers description: Total GitLab Managed clusters with GitLab Managed App:Cert Manager installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175301_clusters_applications_crossplane.yml b/config/metrics/counts_all/20210216175301_clusters_applications_crossplane.yml index a655f7a82dc..b40b1a8f699 100644 --- a/config/metrics/counts_all/20210216175301_clusters_applications_crossplane.yml +++ b/config/metrics/counts_all/20210216175301_clusters_applications_crossplane.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_crossplane description: Total GitLab Managed clusters with GitLab Managed App:Crossplane installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175303_clusters_applications_prometheus.yml b/config/metrics/counts_all/20210216175303_clusters_applications_prometheus.yml index 0d1b48ca487..d6085b67cfa 100644 --- a/config/metrics/counts_all/20210216175303_clusters_applications_prometheus.yml +++ b/config/metrics/counts_all/20210216175303_clusters_applications_prometheus.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_prometheus description: Total GitLab Managed clusters with GitLab Managed App:Prometheus installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175305_clusters_applications_runner.yml b/config/metrics/counts_all/20210216175305_clusters_applications_runner.yml index f3a62aaf8c1..cc2c4e3d8f8 100644 --- a/config/metrics/counts_all/20210216175305_clusters_applications_runner.yml +++ b/config/metrics/counts_all/20210216175305_clusters_applications_runner.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_runner description: Total GitLab Managed clusters with GitLab Managed App:Runner installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175307_clusters_applications_knative.yml b/config/metrics/counts_all/20210216175307_clusters_applications_knative.yml index 2760191782b..edc901a07f9 100644 --- a/config/metrics/counts_all/20210216175307_clusters_applications_knative.yml +++ b/config/metrics/counts_all/20210216175307_clusters_applications_knative.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_knative description: Total GitLab Managed clusters with GitLab Managed App:Knative installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175309_clusters_applications_elastic_stack.yml b/config/metrics/counts_all/20210216175309_clusters_applications_elastic_stack.yml index af615a9d278..7d666b91292 100644 --- a/config/metrics/counts_all/20210216175309_clusters_applications_elastic_stack.yml +++ b/config/metrics/counts_all/20210216175309_clusters_applications_elastic_stack.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_elastic_stack description: Total GitLab Managed clusters with GitLab Managed App:Elastic Stack installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175310_clusters_applications_jupyter.yml b/config/metrics/counts_all/20210216175310_clusters_applications_jupyter.yml index d941fa2e122..0503d4deb10 100644 --- a/config/metrics/counts_all/20210216175310_clusters_applications_jupyter.yml +++ b/config/metrics/counts_all/20210216175310_clusters_applications_jupyter.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_applications_jupyter description: Total GitLab Managed clusters with GitLab Managed App:Jupyter installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175312_clusters_applications_cilium.yml b/config/metrics/counts_all/20210216175312_clusters_applications_cilium.yml index 01009063708..6886d36450e 100644 --- a/config/metrics/counts_all/20210216175312_clusters_applications_cilium.yml +++ b/config/metrics/counts_all/20210216175312_clusters_applications_cilium.yml @@ -3,7 +3,8 @@ data_category: operational key_path: counts.clusters_applications_cilium description: Total GitLab Managed clusters with GitLab Managed App:Cilium installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175314_clusters_management_project.yml b/config/metrics/counts_all/20210216175314_clusters_management_project.yml index d7e22e80c2f..ce80553da99 100644 --- a/config/metrics/counts_all/20210216175314_clusters_management_project.yml +++ b/config/metrics/counts_all/20210216175314_clusters_management_project.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_management_project description: Total GitLab Managed clusters with defined cluster management project product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175316_kubernetes_agents.yml b/config/metrics/counts_all/20210216175316_kubernetes_agents.yml index a1e6217df05..a876059e53a 100644 --- a/config/metrics/counts_all/20210216175316_kubernetes_agents.yml +++ b/config/metrics/counts_all/20210216175316_kubernetes_agents.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.kubernetes_agents description: Count of Kubernetes registered agents product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175318_kubernetes_agents_with_token.yml b/config/metrics/counts_all/20210216175318_kubernetes_agents_with_token.yml index 672b08d20a8..96f2afa434d 100644 --- a/config/metrics/counts_all/20210216175318_kubernetes_agents_with_token.yml +++ b/config/metrics/counts_all/20210216175318_kubernetes_agents_with_token.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.kubernetes_agents_with_token description: Count of Kubernetes agents with at least one token product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175329_clusters_applications_cert_managers.yml b/config/metrics/counts_all/20210216175329_clusters_applications_cert_managers.yml index 034b4f32959..4fab4c0b1ad 100644 --- a/config/metrics/counts_all/20210216175329_clusters_applications_cert_managers.yml +++ b/config/metrics/counts_all/20210216175329_clusters_applications_cert_managers.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_applications_cert_managers description: Total GitLab Managed clusters with GitLab Managed App:Cert Manager installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175331_clusters_applications_helm.yml b/config/metrics/counts_all/20210216175331_clusters_applications_helm.yml index 08ba25349f0..1257b5e6a5e 100644 --- a/config/metrics/counts_all/20210216175331_clusters_applications_helm.yml +++ b/config/metrics/counts_all/20210216175331_clusters_applications_helm.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_applications_helm description: Total GitLab Managed clusters with GitLab Managed App:Helm enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175333_clusters_applications_ingress.yml b/config/metrics/counts_all/20210216175333_clusters_applications_ingress.yml index 2b2d37060dd..e98b2b72699 100644 --- a/config/metrics/counts_all/20210216175333_clusters_applications_ingress.yml +++ b/config/metrics/counts_all/20210216175333_clusters_applications_ingress.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_applications_ingress description: Total GitLab Managed clusters with GitLab Managed App:Ingress installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175335_clusters_applications_knative.yml b/config/metrics/counts_all/20210216175335_clusters_applications_knative.yml index 0d27bdc857b..4f143a7c07d 100644 --- a/config/metrics/counts_all/20210216175335_clusters_applications_knative.yml +++ b/config/metrics/counts_all/20210216175335_clusters_applications_knative.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_applications_knative description: Total GitLab Managed clusters with GitLab Managed App:Knative installed product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210216175337_clusters_management_project.yml b/config/metrics/counts_all/20210216175337_clusters_management_project.yml index e65412486e2..c9a12919f01 100644 --- a/config/metrics/counts_all/20210216175337_clusters_management_project.yml +++ b/config/metrics/counts_all/20210216175337_clusters_management_project.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_management_project description: Total GitLab Managed clusters with defined cluster management project product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175339_clusters_disabled.yml b/config/metrics/counts_all/20210216175339_clusters_disabled.yml index b2538d91ce1..1cc1113da04 100644 --- a/config/metrics/counts_all/20210216175339_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175339_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_disabled description: Total GitLab Managed disabled clusters product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175341_clusters_enabled.yml b/config/metrics/counts_all/20210216175341_clusters_enabled.yml index 459a7f05bdb..a6f1d150fb4 100644 --- a/config/metrics/counts_all/20210216175341_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175341_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_enabled description: Total GitLab Managed clusters currently enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175343_clusters_platforms_gke.yml b/config/metrics/counts_all/20210216175343_clusters_platforms_gke.yml index 7593216b356..04d348bf5db 100644 --- a/config/metrics/counts_all/20210216175343_clusters_platforms_gke.yml +++ b/config/metrics/counts_all/20210216175343_clusters_platforms_gke.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_platforms_gke description: Total GitLab Managed clusters provisioned with GitLab on GCE GKE product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175345_clusters_platforms_eks.yml b/config/metrics/counts_all/20210216175345_clusters_platforms_eks.yml index 3f52d4e19eb..21db63e7848 100644 --- a/config/metrics/counts_all/20210216175345_clusters_platforms_eks.yml +++ b/config/metrics/counts_all/20210216175345_clusters_platforms_eks.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_platforms_eks description: Total GitLab Managed clusters provisioned with GitLab on AWS EKS product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175346_clusters_platforms_user.yml b/config/metrics/counts_all/20210216175346_clusters_platforms_user.yml index 465c94712fa..0c1f4497f10 100644 --- a/config/metrics/counts_all/20210216175346_clusters_platforms_user.yml +++ b/config/metrics/counts_all/20210216175346_clusters_platforms_user.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.clusters_platforms_user description: Total GitLab Managed clusters that are user provisioned product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175348_instance_clusters_disabled.yml b/config/metrics/counts_all/20210216175348_instance_clusters_disabled.yml index bb18063286b..6efd23b42e9 100644 --- a/config/metrics/counts_all/20210216175348_instance_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175348_instance_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.instance_clusters_disabled description: Total GitLab Managed disabled clusters attached to the instance product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175350_instance_clusters_enabled.yml b/config/metrics/counts_all/20210216175350_instance_clusters_enabled.yml index 52860ffacd0..e409a12057f 100644 --- a/config/metrics/counts_all/20210216175350_instance_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175350_instance_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.instance_clusters_enabled description: Total GitLab Managed enabled clusters attached to the instance product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175352_group_clusters_disabled.yml b/config/metrics/counts_all/20210216175352_group_clusters_disabled.yml index 96d5dde2564..65be62a8cd3 100644 --- a/config/metrics/counts_all/20210216175352_group_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175352_group_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.group_clusters_disabled description: Total GitLab Managed disabled clusters attached to groups product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175354_group_clusters_enabled.yml b/config/metrics/counts_all/20210216175354_group_clusters_enabled.yml index ef4625aa628..e83af39b044 100644 --- a/config/metrics/counts_all/20210216175354_group_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175354_group_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.group_clusters_enabled description: Total GitLab Managed enabled clusters attached to groups product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175356_project_clusters_disabled.yml b/config/metrics/counts_all/20210216175356_project_clusters_disabled.yml index 3c79fe4a52b..013a155bce1 100644 --- a/config/metrics/counts_all/20210216175356_project_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175356_project_clusters_disabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.project_clusters_disabled description: Total GitLab Managed disabled clusters attached to projects product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175358_project_clusters_enabled.yml b/config/metrics/counts_all/20210216175358_project_clusters_enabled.yml index 696aae2128c..06915aa27a9 100644 --- a/config/metrics/counts_all/20210216175358_project_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175358_project_clusters_enabled.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.project_clusters_enabled description: Total GitLab Managed enabled clusters attached to projects product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210216175403_projects_with_prometheus_alerts.yml b/config/metrics/counts_all/20210216175403_projects_with_prometheus_alerts.yml index 04c9da64adc..18baf03a16b 100644 --- a/config/metrics/counts_all/20210216175403_projects_with_prometheus_alerts.yml +++ b/config/metrics/counts_all/20210216175403_projects_with_prometheus_alerts.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.configure.projects_with_prometheus_alerts description: Projects with Prometheus alerting enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed milestone_removed: '14.0' diff --git a/config/metrics/counts_all/20210216181949_clusters_applications_runner.yml b/config/metrics/counts_all/20210216181949_clusters_applications_runner.yml index e0adcb13ede..6b80c7c43a4 100644 --- a/config/metrics/counts_all/20210216181949_clusters_applications_runner.yml +++ b/config/metrics/counts_all/20210216181949_clusters_applications_runner.yml @@ -3,7 +3,8 @@ data_category: optional key_path: usage_activity_by_stage.verify.clusters_applications_runner description: Count of users creating managed clusters with Runner enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/counts_all/20210505015532_kubernetes_agent_k8s_api_proxy_request.yml b/config/metrics/counts_all/20210505015532_kubernetes_agent_k8s_api_proxy_request.yml index 628f02381fa..5e6b3531843 100644 --- a/config/metrics/counts_all/20210505015532_kubernetes_agent_k8s_api_proxy_request.yml +++ b/config/metrics/counts_all/20210505015532_kubernetes_agent_k8s_api_proxy_request.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.kubernetes_agent_k8s_api_proxy_request description: Count of Kubernetes API proxy requests product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active milestone: '13.12' diff --git a/config/metrics/counts_all/20210916200930_clusters_integrations_prometheus.yml b/config/metrics/counts_all/20210916200930_clusters_integrations_prometheus.yml index fec6e0593de..1763694a7cb 100644 --- a/config/metrics/counts_all/20210916200930_clusters_integrations_prometheus.yml +++ b/config/metrics/counts_all/20210916200930_clusters_integrations_prometheus.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_integrations_prometheus description: Total clusters with Clusters::Integrations::Prometheus enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: active time_frame: all diff --git a/config/metrics/counts_all/20210916200931_clusters_integrations_elastic_stack.yml b/config/metrics/counts_all/20210916200931_clusters_integrations_elastic_stack.yml index 2ba959ec31d..c24ced8f8ed 100644 --- a/config/metrics/counts_all/20210916200931_clusters_integrations_elastic_stack.yml +++ b/config/metrics/counts_all/20210916200931_clusters_integrations_elastic_stack.yml @@ -3,7 +3,8 @@ data_category: optional key_path: counts.clusters_integrations_elastic_stack description: Total clusters with Clusters::Integrations::ElasticStack enabled product_group: environments -product_category: deployment_management +product_categories: +- deployment_management value_type: number status: removed time_frame: all diff --git a/config/metrics/schema/base.json b/config/metrics/schema/base.json index 57564921985..8ff68b4dade 100644 --- a/config/metrics/schema/base.json +++ b/config/metrics/schema/base.json @@ -25,6 +25,13 @@ "product_group": { "$ref": "product_groups.json" }, + "product_categories": { + "type": "array", + "items": { + "type": "string", + "format": "known_product_category" + } + }, "value_type": { "type": "string", "enum": [ @@ -161,9 +168,6 @@ "value_json_schema": { "type": "string" }, - "product_category": { - "type": "string" - }, "name": { "type": "string" }, diff --git a/config/metrics/settings/20230328165533_mode.yml b/config/metrics/settings/20230328165533_mode.yml index 55c504c4a9c..1053d749485 100644 --- a/config/metrics/settings/20230328165533_mode.yml +++ b/config/metrics/settings/20230328165533_mode.yml @@ -3,7 +3,8 @@ key_path: database.mode description: What PostgreSQL database mode is used. Possible values are "single-database", "single-database-ci-connection", or "multiple-databases" product_group: database -product_category: database +product_categories: +- database value_type: string status: active milestone: "15.11" diff --git a/db/post_migrate/20241108105453_ensure_id_uniqueness_for_p_ci_pipelines.rb b/db/post_migrate/20241108105453_ensure_id_uniqueness_for_p_ci_pipelines.rb new file mode 100644 index 00000000000..4110a0b4682 --- /dev/null +++ b/db/post_migrate/20241108105453_ensure_id_uniqueness_for_p_ci_pipelines.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class EnsureIdUniquenessForPCiPipelines < Gitlab::Database::Migration[2.2] + include Gitlab::Database::PartitioningMigrationHelpers::UniquenessHelpers + + milestone '17.6' + + TABLE_NAME = :p_ci_pipelines + SEQ_NAME = :ci_pipelines_id_seq + + def up + ensure_unique_id(TABLE_NAME, seq: SEQ_NAME) + end + + def down + revert_ensure_unique_id(TABLE_NAME, seq: SEQ_NAME) + end +end diff --git a/db/schema_migrations/20241108105453 b/db/schema_migrations/20241108105453 new file mode 100644 index 00000000000..fcb07fd6bb7 --- /dev/null +++ b/db/schema_migrations/20241108105453 @@ -0,0 +1 @@ +a4a3e3193389ae202c53d321d613fabde0c849da2c75d7676e661190e9a246de \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 1b28b6535eb..834f93d9afc 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -88,6 +88,19 @@ RETURN NEW; END $$; +CREATE FUNCTION assign_p_ci_pipelines_id_value() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN +IF NEW."id" IS NOT NULL THEN + RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored'; +END IF; +NEW."id" := nextval('ci_pipelines_id_seq'::regclass); +RETURN NEW; + +END +$$; + CREATE FUNCTION assign_p_ci_stages_id_value() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -9243,15 +9256,6 @@ CREATE TABLE p_ci_pipelines ( ) PARTITION BY LIST (partition_id); -CREATE SEQUENCE ci_pipelines_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE ci_pipelines_id_seq OWNED BY p_ci_pipelines.id; - CREATE TABLE ci_pipelines ( ref character varying, sha character varying, @@ -9281,13 +9285,22 @@ CREATE TABLE ci_pipelines ( ci_ref_id bigint, locked smallint DEFAULT 1 NOT NULL, partition_id bigint NOT NULL, - id bigint DEFAULT nextval('ci_pipelines_id_seq'::regclass) NOT NULL, + id bigint NOT NULL, auto_canceled_by_id bigint, auto_canceled_by_partition_id bigint, CONSTRAINT check_2ba2a044b9 CHECK ((project_id IS NOT NULL)), CONSTRAINT check_d7e99a025e CHECK ((lock_version IS NOT NULL)) ); +CREATE SEQUENCE ci_pipelines_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_pipelines_id_seq OWNED BY p_ci_pipelines.id; + CREATE TABLE ci_project_mirrors ( id bigint NOT NULL, project_id bigint NOT NULL, @@ -23364,8 +23377,6 @@ ALTER TABLE ONLY p_catalog_resource_sync_events ALTER COLUMN id SET DEFAULT next ALTER TABLE ONLY p_ci_builds_metadata ALTER COLUMN id SET DEFAULT nextval('ci_builds_metadata_id_seq'::regclass); -ALTER TABLE ONLY p_ci_pipelines ALTER COLUMN id SET DEFAULT nextval('ci_pipelines_id_seq'::regclass); - ALTER TABLE ONLY packages_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_build_infos_id_seq'::regclass); ALTER TABLE ONLY packages_conan_file_metadata ALTER COLUMN id SET DEFAULT nextval('packages_conan_file_metadata_id_seq'::regclass); @@ -34722,6 +34733,8 @@ CREATE TRIGGER assign_p_ci_job_artifacts_id_trigger BEFORE INSERT ON p_ci_job_ar CREATE TRIGGER assign_p_ci_pipeline_variables_id_trigger BEFORE INSERT ON p_ci_pipeline_variables FOR EACH ROW EXECUTE FUNCTION assign_p_ci_pipeline_variables_id_value(); +CREATE TRIGGER assign_p_ci_pipelines_id_trigger BEFORE INSERT ON p_ci_pipelines FOR EACH ROW EXECUTE FUNCTION assign_p_ci_pipelines_id_value(); + CREATE TRIGGER assign_p_ci_stages_id_trigger BEFORE INSERT ON p_ci_stages FOR EACH ROW EXECUTE FUNCTION assign_p_ci_stages_id_value(); CREATE TRIGGER assign_zoekt_tasks_id_trigger BEFORE INSERT ON zoekt_tasks FOR EACH ROW EXECUTE FUNCTION assign_zoekt_tasks_id_value(); diff --git a/doc/api/vulnerabilities.md b/doc/api/vulnerabilities.md index 32d7a0f843b..29ac1a82ea0 100644 --- a/doc/api/vulnerabilities.md +++ b/doc/api/vulnerabilities.md @@ -31,7 +31,7 @@ across GitLab releases. Use the Every API call to vulnerabilities must be [authenticated](rest/index.md#authentication). If an authenticated user does not have permission to -[view vulnerabilities](../user/permissions.md#project-members-permissions), +[view vulnerability report](../user/permissions.md#application-security), this request returns a `403 Forbidden` status code. ## Single vulnerability @@ -80,7 +80,7 @@ Example response: Confirms a given vulnerability. Returns status code `304` if the vulnerability is already confirmed. If an authenticated user does not have permission to -[confirm vulnerabilities](../user/permissions.md#project-members-permissions), +[change vulnerability status](../user/permissions.md#application-security), this request results in a `403` status code. ```plaintext @@ -125,7 +125,7 @@ Example response: Resolves a given vulnerability. Returns status code `304` if the vulnerability is already resolved. If an authenticated user does not have permission to -[resolve vulnerabilities](../user/permissions.md#project-members-permissions), +[change vulnerability status](../user/permissions.md#application-security), this request results in a `403` status code. ```plaintext @@ -170,7 +170,7 @@ Example response: Dismisses a given vulnerability. Returns status code `304` if the vulnerability is already dismissed. If an authenticated user does not have permission to -[dismiss vulnerabilities](../user/permissions.md#project-members-permissions), +[change vulnerability status](../user/permissions.md#application-security), this request results in a `403` status code. ```plaintext @@ -215,7 +215,7 @@ Example response: Reverts a given vulnerability to detected state. Returns status code `304` if the vulnerability is already in detected state. If an authenticated user does not have permission to -[revert vulnerability to detected state](../user/permissions.md#project-members-permissions), +[change vulnerability status](../user/permissions.md#application-security), this request results in a `403` status code. ```plaintext diff --git a/doc/development/work_items_widgets.md b/doc/development/work_items_widgets.md index 7ef17b267bf..dbd0718293c 100644 --- a/doc/development/work_items_widgets.md +++ b/doc/development/work_items_widgets.md @@ -154,7 +154,7 @@ Now you can update tests for existing files and write tests for the new files: 1. `spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js` or `ee/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js`. 1. `spec/frontend/work_items/components/work_item__spec.js` or `ee/spec/frontend/work_items/components/work_item__spec.js`. 1. `spec/frontend/work_items/graphql/resolvers_spec.js` or `ee/spec/frontend/work_items/graphql/resolvers_spec.js`. -1. `spec/features/projects/work_items/work_item_spec.rb` or `ee/spec/features/projects/work_items/work_item_spec.rb`. +1. `spec/features/work_items/work_item_spec.rb` or `ee/spec/features/work_items/work_item_spec.rb`. NOTE: You may find some feature specs failing because of excessive SQL queries. diff --git a/doc/user/project/repository/signed_commits/index.md b/doc/user/project/repository/signed_commits/index.md index f031a8d994b..63ef88b8dfa 100644 --- a/doc/user/project/repository/signed_commits/index.md +++ b/doc/user/project/repository/signed_commits/index.md @@ -69,7 +69,7 @@ The [`gitmailmap`](https://git-scm.com/docs/gitmailmap) feature allows users to GitLab uses these email addresses to provide links to the commit author. When using a `mailmap` author mapping, it's possible to have a verified commit with an unverified author email. -For SSH signatures with `mailmap` author mappings, GitLab displays an orange verified label with a warning sign. +For SSH and UI signatures with `mailmap` author mappings, GitLab displays an orange verified label with a warning sign. To restore the green verified label, verify the mapped email address, or remove the `mailmap` entry. ## Troubleshooting diff --git a/lib/gitlab/tracking/event_definition_validator.rb b/lib/gitlab/tracking/event_definition_validator.rb index b0d5b8a897b..3ea74e7cd1f 100644 --- a/lib/gitlab/tracking/event_definition_validator.rb +++ b/lib/gitlab/tracking/event_definition_validator.rb @@ -4,7 +4,10 @@ module Gitlab module Tracking class EventDefinitionValidator EVENT_SCHEMA_PATH = Rails.root.join('config/events/schema.json') - SCHEMA = ::JSONSchemer.schema(EVENT_SCHEMA_PATH) + + def self.definition_schema + @definition_schema ||= ::JSONSchemer.schema(EVENT_SCHEMA_PATH) + end def initialize(definition) @attributes = definition.attributes @@ -12,7 +15,7 @@ module Gitlab end def validation_errors - SCHEMA.validate(attributes.deep_stringify_keys).map do |error| + self.class.definition_schema.validate(attributes.deep_stringify_keys).map do |error| <<~ERROR_MSG --------------- VALIDATION ERROR --------------- Definition file: #{path} diff --git a/lib/gitlab/usage/metric_definition.rb b/lib/gitlab/usage/metric_definition.rb index ed077fe9f1d..f2771e79078 100644 --- a/lib/gitlab/usage/metric_definition.rb +++ b/lib/gitlab/usage/metric_definition.rb @@ -4,7 +4,6 @@ module Gitlab module Usage class MetricDefinition METRIC_SCHEMA_PATH = Rails.root.join('config', 'metrics', 'schema', 'base.json') - SCHEMA = ::JSONSchemer.schema(METRIC_SCHEMA_PATH) AVAILABLE_STATUSES = %w[active broken].to_set.freeze VALID_SERVICE_PING_STATUSES = %w[active broken].to_set.freeze @@ -91,14 +90,14 @@ module Gitlab end def validation_errors - SCHEMA.validate(@attributes.deep_stringify_keys).map do |error| + self.class.definition_schema.validate(@attributes.deep_stringify_keys).map do |error| <<~ERROR_MSG --------------- VALIDATION ERROR --------------- Metric file: #{path} Error type: #{error['type']} Data: #{error['data']} Path: #{error['data_pointer']} - Details: #{error['details']} + Details: #{error['details'] || error['error']} ERROR_MSG end end @@ -188,6 +187,10 @@ module Gitlab end end + def definition_schema + @definition_schema ||= ::JSONSchemer.schema(METRIC_SCHEMA_PATH) + end + private def load_all! diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 06e0bc932b1..a879419b2e6 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -49776,6 +49776,9 @@ msgstr "" msgid "SecurityOrchestration|Edit merge request approval policy" msgstr "" +msgid "SecurityOrchestration|Edit pipeline execution policy" +msgstr "" + msgid "SecurityOrchestration|Edit policy" msgstr "" diff --git a/scripts/internal_events/cli/metric.rb b/scripts/internal_events/cli/metric.rb index f6049a333d3..a24bfaa87e5 100755 --- a/scripts/internal_events/cli/metric.rb +++ b/scripts/internal_events/cli/metric.rb @@ -13,7 +13,7 @@ module InternalEventsCli :time_frame, :data_source, :data_category, - :product_category, + :product_categories, :distribution, :tier, :tiers, diff --git a/spec/controllers/concerns/stream_diffs_spec.rb b/spec/controllers/concerns/stream_diffs_spec.rb index 48a610713bd..8c29763bce9 100644 --- a/spec/controllers/concerns/stream_diffs_spec.rb +++ b/spec/controllers/concerns/stream_diffs_spec.rb @@ -42,4 +42,10 @@ RSpec.describe StreamDiffs, type: :controller, feature_category: :source_code_ma }) end end + + describe '#request' do + it 'forces format as HTML' do + expect(controller.new.request.format.to_s).to eq('text/html') + end + end end diff --git a/spec/features/projects/work_items/create_issue_work_item_spec.rb b/spec/features/work_items/create_issue_work_item_spec.rb similarity index 100% rename from spec/features/projects/work_items/create_issue_work_item_spec.rb rename to spec/features/work_items/create_issue_work_item_spec.rb diff --git a/spec/features/projects/work_items/linked_work_items_spec.rb b/spec/features/work_items/linked_work_items_spec.rb similarity index 100% rename from spec/features/projects/work_items/linked_work_items_spec.rb rename to spec/features/work_items/linked_work_items_spec.rb diff --git a/spec/features/projects/work_items/shortcuts_work_item_spec.rb b/spec/features/work_items/shortcuts_work_item_spec.rb similarity index 100% rename from spec/features/projects/work_items/shortcuts_work_item_spec.rb rename to spec/features/work_items/shortcuts_work_item_spec.rb diff --git a/spec/features/projects/work_items/work_item_children_spec.rb b/spec/features/work_items/work_item_children_spec.rb similarity index 100% rename from spec/features/projects/work_items/work_item_children_spec.rb rename to spec/features/work_items/work_item_children_spec.rb diff --git a/spec/features/projects/work_items/work_item_spec.rb b/spec/features/work_items/work_item_spec.rb similarity index 100% rename from spec/features/projects/work_items/work_item_spec.rb rename to spec/features/work_items/work_item_spec.rb diff --git a/spec/features/projects/work_items/work_items_list_filters_spec.rb b/spec/features/work_items/work_items_list_filters_spec.rb similarity index 100% rename from spec/features/projects/work_items/work_items_list_filters_spec.rb rename to spec/features/work_items/work_items_list_filters_spec.rb diff --git a/spec/frontend/work_items/components/work_item_detail_modal_spec.js b/spec/frontend/work_items/components/work_item_detail_modal_spec.js index 34689f295d6..fd06900b5f0 100644 --- a/spec/frontend/work_items/components/work_item_detail_modal_spec.js +++ b/spec/frontend/work_items/components/work_item_detail_modal_spec.js @@ -65,6 +65,7 @@ describe('WorkItemDetailModal component', () => { reportAbusePath: 'report/abuse', groupPath: '', hasSubepicsFeature: false, + hasLinkedItemsEpicsFeature: true, }, stubs: { GlModal, diff --git a/spec/frontend/work_items/components/work_item_detail_spec.js b/spec/frontend/work_items/components/work_item_detail_spec.js index 0e6ddb4bae7..dc0d1ece60b 100644 --- a/spec/frontend/work_items/components/work_item_detail_spec.js +++ b/spec/frontend/work_items/components/work_item_detail_spec.js @@ -145,6 +145,7 @@ describe('WorkItemDetail component', () => { modalIsGroup = null, workspacePermissionsHandler = workspacePermissionsAllowedHandler, uploadDesignMutationHandler = uploadSuccessDesignMutationHandler, + hasLinkedItemsEpicsFeature = true, } = {}) => { wrapper = shallowMountExtended(WorkItemDetail, { apolloProvider: createMockApollo([ @@ -180,6 +181,7 @@ describe('WorkItemDetail component', () => { fullPath: 'group/project', groupPath: 'group', reportAbusePath: '/report/abuse/path', + hasLinkedItemsEpicsFeature, }, stubs: { WorkItemAncestors: true, @@ -442,6 +444,21 @@ describe('WorkItemDetail component', () => { }); }); + describe('`linked_items_epics` is unavailable', () => { + it('does not show linked items widget', async () => { + const epicWorkItem = workItemByIidResponseFactory({ + workItemType: epicType, + }); + const epicHandler = jest.fn().mockResolvedValue(epicWorkItem); + + createComponent({ hasLinkedItemsEpicsFeature: false, handler: epicHandler }); + + await waitForPromises(); + + expect(findWorkItemRelationships().exists()).toBe(false); + }); + }); + describe('with parent', () => { beforeEach(async () => { const parentResponse = workItemByIidResponseFactory(mockParent); diff --git a/spec/frontend/work_items/components/work_item_drawer_spec.js b/spec/frontend/work_items/components/work_item_drawer_spec.js index ed6d0a31931..e45489ed81a 100644 --- a/spec/frontend/work_items/components/work_item_drawer_spec.js +++ b/spec/frontend/work_items/components/work_item_drawer_spec.js @@ -67,6 +67,7 @@ describe('WorkItemDrawer', () => { reportAbusePath: '', groupPath: '', hasSubepicsFeature: false, + hasLinkedItemsEpicsFeature: true, isGroup, glFeatures: { workItemsViewPreference, diff --git a/spec/frontend/work_items/router_spec.js b/spec/frontend/work_items/router_spec.js index 34a778c76ad..72663cc4bf6 100644 --- a/spec/frontend/work_items/router_spec.js +++ b/spec/frontend/work_items/router_spec.js @@ -66,6 +66,7 @@ describe('Work items router', () => { hasIterationsFeature: false, hasOkrsFeature: false, hasSubepicsFeature: false, + hasLinkedItemsEpicsFeature: false, hasIssuableHealthStatusFeature: false, labelsManagePath: 'test-project-path/labels', reportAbusePath: '/report/abuse/path', diff --git a/spec/graphql/resolvers/ci/project_pipeline_resolver_spec.rb b/spec/graphql/resolvers/ci/project_pipeline_resolver_spec.rb index 6c17f981e09..192484d5fc2 100644 --- a/spec/graphql/resolvers/ci/project_pipeline_resolver_spec.rb +++ b/spec/graphql/resolvers/ci/project_pipeline_resolver_spec.rb @@ -6,8 +6,8 @@ RSpec.describe Resolvers::Ci::ProjectPipelineResolver, feature_category: :contin include GraphqlHelpers let_it_be(:project) { create(:project) } - let_it_be(:pipeline) { create(:ci_pipeline, project: project, id: '1234', iid: '1234', sha: 'sha') } - let_it_be(:other_project_pipeline) { create(:ci_pipeline, project: project, id: '1235', iid: '1235', sha: 'sha2') } + let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: 'sha') } + let_it_be(:other_project_pipeline) { create(:ci_pipeline, project: project, sha: 'sha2') } let_it_be(:other_pipeline) { create(:ci_pipeline) } let(:current_user) { create(:user, developer_of: project) } @@ -23,11 +23,11 @@ RSpec.describe Resolvers::Ci::ProjectPipelineResolver, feature_category: :contin it 'resolves pipeline for the passed id' do expect(Ci::PipelinesFinder) .to receive(:new) - .with(project, current_user, ids: ['1234']) + .with(project, current_user, ids: [pipeline.id.to_s]) .and_call_original result = batch_sync do - resolve_pipeline(project, { id: 'gid://gitlab/Ci::Pipeline/1234' }) + resolve_pipeline(project, { id: "gid://gitlab/Ci::Pipeline/#{pipeline.id}" }) end expect(result).to eq(pipeline) @@ -36,11 +36,11 @@ RSpec.describe Resolvers::Ci::ProjectPipelineResolver, feature_category: :contin it 'resolves pipeline for the passed iid' do expect(Ci::PipelinesFinder) .to receive(:new) - .with(project, current_user, iids: ['1234']) + .with(project, current_user, iids: [pipeline.iid.to_s]) .and_call_original result = batch_sync do - resolve_pipeline(project, { iid: '1234' }) + resolve_pipeline(project, { iid: pipeline.iid.to_s }) end expect(result).to eq(pipeline) @@ -61,26 +61,26 @@ RSpec.describe Resolvers::Ci::ProjectPipelineResolver, feature_category: :contin it 'keeps the queries under the threshold for id' do control = ActiveRecord::QueryRecorder.new do - batch_sync { resolve_pipeline(project, { id: 'gid://gitlab/Ci::Pipeline/1234' }) } + batch_sync { resolve_pipeline(project, { id: "gid://gitlab/Ci::Pipeline/#{pipeline.id}" }) } end expect do batch_sync do - resolve_pipeline(project, { id: 'gid://gitlab/Ci::Pipeline/1234' }) - resolve_pipeline(project, { id: 'gid://gitlab/Ci::Pipeline/1235' }) + resolve_pipeline(project, { id: "gid://gitlab/Ci::Pipeline/#{pipeline.id}" }) + resolve_pipeline(project, { id: "gid://gitlab/Ci::Pipeline/#{other_project_pipeline.id}" }) end end.not_to exceed_query_limit(control) end it 'keeps the queries under the threshold for iid' do control = ActiveRecord::QueryRecorder.new do - batch_sync { resolve_pipeline(project, { iid: '1234' }) } + batch_sync { resolve_pipeline(project, { iid: pipeline.iid.to_s }) } end expect do batch_sync do - resolve_pipeline(project, { iid: '1234' }) - resolve_pipeline(project, { iid: '1235' }) + resolve_pipeline(project, { iid: pipeline.iid.to_s }) + resolve_pipeline(project, { iid: other_pipeline.iid.to_s }) end end.not_to exceed_query_limit(control) end @@ -100,7 +100,7 @@ RSpec.describe Resolvers::Ci::ProjectPipelineResolver, feature_category: :contin it 'does not resolve a pipeline outside the project' do result = batch_sync do - resolve_pipeline(other_pipeline.project, { iid: '1234' }) + resolve_pipeline(other_pipeline.project, { iid: pipeline.iid.to_s }) end expect(result).to be_nil @@ -108,7 +108,7 @@ RSpec.describe Resolvers::Ci::ProjectPipelineResolver, feature_category: :contin it 'does not resolve a pipeline outside the project' do result = batch_sync do - resolve_pipeline(other_pipeline.project, { id: 'gid://gitlab/Ci::Pipeline/12349' }) + resolve_pipeline(other_pipeline.project, { id: "gid://gitlab/Ci::Pipeline/#{pipeline.id}9" }) end expect(result).to be_nil @@ -122,19 +122,20 @@ RSpec.describe Resolvers::Ci::ProjectPipelineResolver, feature_category: :contin it 'errors when both iid and sha are passed' do expect_graphql_error_to_be_created(GraphQL::Schema::Validator::ValidationFailedError) do - resolve_pipeline(project, { iid: '1234', sha: 'sha' }) + resolve_pipeline(project, { iid: pipeline.iid.to_s, sha: 'sha' }) end end it 'errors when both id and iid are passed' do expect_graphql_error_to_be_created(GraphQL::Schema::Validator::ValidationFailedError) do - resolve_pipeline(project, { id: 'gid://gitlab/Ci::Pipeline/1234', iid: '1234' }) + resolve_pipeline(project, { id: "gid://gitlab/Ci::Pipeline/#{pipeline.id}", iid: pipeline.iid.to_s }) end end it 'errors when id, iid and sha are passed' do expect_graphql_error_to_be_created(GraphQL::Schema::Validator::ValidationFailedError) do - resolve_pipeline(project, { id: 'gid://gitlab/Ci::Pipeline/1234', iid: '1234', sha: '12345234' }) + resolve_pipeline(project, + { id: "gid://gitlab/Ci::Pipeline/#{pipeline.id}", iid: pipeline.iid.to_s, sha: '12345234' }) end end diff --git a/spec/lib/gitlab/background_migration/backfill_upstream_pipeline_partition_id_on_p_ci_builds_spec.rb b/spec/lib/gitlab/background_migration/backfill_upstream_pipeline_partition_id_on_p_ci_builds_spec.rb index 9298a2ab3b5..c1b313dc720 100644 --- a/spec/lib/gitlab/background_migration/backfill_upstream_pipeline_partition_id_on_p_ci_builds_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_upstream_pipeline_partition_id_on_p_ci_builds_spec.rb @@ -9,9 +9,9 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillUpstreamPipelinePartitionIdO let(:jobs_table) { partitioned_table(:p_ci_builds, database: :ci) } - let!(:pipeline_1) { pipelines_table.create!(partition_id: 100, project_id: 1) } - let!(:pipeline_2) { pipelines_table.create!(partition_id: 100, project_id: 1) } - let!(:pipeline_3) { pipelines_table.create!(partition_id: 100, project_id: 1) } + let!(:pipeline_1) { pipelines_table.create!(id: 1, partition_id: 100, project_id: 1) } + let!(:pipeline_2) { pipelines_table.create!(id: 2, partition_id: 100, project_id: 1) } + let!(:pipeline_3) { pipelines_table.create!(id: 3, partition_id: 100, project_id: 1) } let!(:job_1) { jobs_table.create!(commit_id: pipeline_1.id, partition_id: pipeline_1.partition_id, project_id: 1) } let!(:job_2) { jobs_table.create!(commit_id: pipeline_2.id, partition_id: pipeline_2.partition_id, project_id: 1) } diff --git a/spec/lib/gitlab/background_migration/delete_orphaned_build_records_spec.rb b/spec/lib/gitlab/background_migration/delete_orphaned_build_records_spec.rb index 1d1510ec7b6..0b247774f3e 100644 --- a/spec/lib/gitlab/background_migration/delete_orphaned_build_records_spec.rb +++ b/spec/lib/gitlab/background_migration/delete_orphaned_build_records_spec.rb @@ -6,9 +6,9 @@ RSpec.describe Gitlab::BackgroundMigration::DeleteOrphanedBuildRecords, feature_ let(:pipelines_table) { table(:p_ci_pipelines, database: :ci, primary_key: :id) } let(:builds_table) { table(:p_ci_builds, database: :ci, primary_key: :id) } - let!(:regular_pipeline) { pipelines_table.create!(project_id: 600, partition_id: 100) } - let!(:deleted_pipeline) { pipelines_table.create!(project_id: 600, partition_id: 100) } - let!(:other_pipeline) { pipelines_table.create!(project_id: 600, partition_id: 100) } + let!(:regular_pipeline) { pipelines_table.create!(id: 1, project_id: 600, partition_id: 100) } + let!(:deleted_pipeline) { pipelines_table.create!(id: 2, project_id: 600, partition_id: 100) } + let!(:other_pipeline) { pipelines_table.create!(id: 3, project_id: 600, partition_id: 100) } let!(:regular_build) do builds_table.create!(partition_id: 100, project_id: 600, commit_id: regular_pipeline.id) diff --git a/spec/lib/gitlab/background_migration/delete_orphaned_pipeline_variable_records_spec.rb b/spec/lib/gitlab/background_migration/delete_orphaned_pipeline_variable_records_spec.rb index 53599dc4fc3..f560c2e7086 100644 --- a/spec/lib/gitlab/background_migration/delete_orphaned_pipeline_variable_records_spec.rb +++ b/spec/lib/gitlab/background_migration/delete_orphaned_pipeline_variable_records_spec.rb @@ -8,9 +8,9 @@ RSpec.describe Gitlab::BackgroundMigration::DeleteOrphanedPipelineVariableRecord let(:variables_table) { table(:p_ci_pipeline_variables, database: :ci, primary_key: :id) } let(:default_attributes) { { project_id: 600, partition_id: 100 } } - let!(:regular_pipeline) { pipelines_table.create!(default_attributes) } - let!(:deleted_pipeline) { pipelines_table.create!(default_attributes) } - let!(:other_pipeline) { pipelines_table.create!(default_attributes) } + let!(:regular_pipeline) { pipelines_table.create!(id: 1, **default_attributes) } + let!(:deleted_pipeline) { pipelines_table.create!(id: 2, **default_attributes) } + let!(:other_pipeline) { pipelines_table.create!(id: 3, **default_attributes) } let!(:regular_variable) do variables_table.create!(pipeline_id: regular_pipeline.id, key: :key1, **default_attributes) diff --git a/spec/lib/gitlab/background_migration/delete_orphaned_stage_records_spec.rb b/spec/lib/gitlab/background_migration/delete_orphaned_stage_records_spec.rb index fc6accee021..99ae48d358e 100644 --- a/spec/lib/gitlab/background_migration/delete_orphaned_stage_records_spec.rb +++ b/spec/lib/gitlab/background_migration/delete_orphaned_stage_records_spec.rb @@ -8,9 +8,9 @@ RSpec.describe Gitlab::BackgroundMigration::DeleteOrphanedStageRecords, let(:stages_table) { table(:p_ci_stages, database: :ci, primary_key: :id) } let(:default_attributes) { { project_id: 600, partition_id: 100 } } - let!(:regular_pipeline) { pipelines_table.create!(default_attributes) } - let!(:deleted_pipeline) { pipelines_table.create!(default_attributes) } - let!(:other_pipeline) { pipelines_table.create!(default_attributes) } + let!(:regular_pipeline) { pipelines_table.create!(id: 1, **default_attributes) } + let!(:deleted_pipeline) { pipelines_table.create!(id: 2, **default_attributes) } + let!(:other_pipeline) { pipelines_table.create!(id: 3, **default_attributes) } let!(:regular_build) do stages_table.create!(pipeline_id: regular_pipeline.id, **default_attributes) diff --git a/spec/lib/gitlab/background_migration/nullify_builds_auto_canceled_by_id_spec.rb b/spec/lib/gitlab/background_migration/nullify_builds_auto_canceled_by_id_spec.rb index e3fd5b35544..650510856e7 100644 --- a/spec/lib/gitlab/background_migration/nullify_builds_auto_canceled_by_id_spec.rb +++ b/spec/lib/gitlab/background_migration/nullify_builds_auto_canceled_by_id_spec.rb @@ -8,9 +8,9 @@ RSpec.describe Gitlab::BackgroundMigration::NullifyBuildsAutoCanceledById, let(:builds_table) { table(:p_ci_builds, database: :ci, primary_key: :id) } let(:default_attributes) { { project_id: 600, partition_id: 100 } } - let!(:regular_pipeline) { pipelines_table.create!(default_attributes) } - let!(:deleted_pipeline) { pipelines_table.create!(default_attributes) } - let!(:other_pipeline) { pipelines_table.create!(default_attributes) } + let!(:regular_pipeline) { pipelines_table.create!(id: 1, **default_attributes) } + let!(:deleted_pipeline) { pipelines_table.create!(id: 2, **default_attributes) } + let!(:other_pipeline) { pipelines_table.create!(id: 3, **default_attributes) } let!(:regular_build) do builds_table.create!(commit_id: regular_pipeline.id, **default_attributes) diff --git a/spec/lib/gitlab/ci/badge/pipeline/status_spec.rb b/spec/lib/gitlab/ci/badge/pipeline/status_spec.rb index dd528029eaf..33999263c22 100644 --- a/spec/lib/gitlab/ci/badge/pipeline/status_spec.rb +++ b/spec/lib/gitlab/ci/badge/pipeline/status_spec.rb @@ -2,11 +2,13 @@ require 'spec_helper' -RSpec.describe Gitlab::Ci::Badge::Pipeline::Status do - let(:project) { create(:project, :repository) } - let(:sha) { project.commit.sha } - let(:branch) { 'master' } - let(:badge) { described_class.new(project, branch) } +RSpec.describe Gitlab::Ci::Badge::Pipeline::Status, feature_category: :continuous_integration do + let_it_be(:project) { create(:project, :repository) } + let_it_be(:sha) { project.commit.sha } + let_it_be(:ref) { 'master' } + + let(:options) { {} } + let(:badge) { described_class.new(project, ref, opts: options) } describe '#entity' do it 'always says pipeline' do @@ -26,99 +28,65 @@ RSpec.describe Gitlab::Ci::Badge::Pipeline::Status do end end - context 'pipeline exists', :sidekiq_might_not_need_inline do - let!(:build) { create_pipeline_and_build(project, sha, branch, 2) } - - context 'pipeline success' do - before do - build.success! + describe '#status' do + context 'when a pipeline exists' do + let_it_be_with_reload(:pipeline) do + create(:ci_pipeline, project: project, sha: sha, ref: ref) end - describe '#status' do - it 'is successful' do + context 'when it is successful' do + before do + pipeline.succeed! + end + + it { expect(badge.status).to eq 'success' } + end + + context 'when it is failed' do + before do + pipeline.drop! + end + + it { expect(badge.status).to eq 'failed' } + end + + context 'when multiple pipelines exist for given sha' do + let!(:new_pipeline) { create(:ci_pipeline, :success, project: project, sha: sha, ref: ref) } + + before do + pipeline.drop! + end + + it 'does not take outdated pipeline into account' do expect(badge.status).to eq 'success' end end - end - context 'pipeline failed' do - before do - build.drop! - end + context 'with skipped pipelines' do + let_it_be(:skipped_pipeline) { create(:ci_pipeline, :skipped, project: project, sha: sha, ref: ref) } - describe '#status' do - it 'failed' do - expect(badge.status).to eq 'failed' + before do + pipeline.succeed! + end + + context 'when ignored_skipped is set to true' do + let(:options) { { ignore_skipped: true } } + + it 'uses latest non-skipped status' do + expect(badge.status).to eq 'success' + end + end + + context 'when ignored_skipped is set to false' do + let(:options) { { ignore_skipped: false } } + + it { expect(badge.status).to eq 'skipped' } end end end - context 'when outdated pipeline for given ref exists' do - before do - build.success! - - old_build = create_pipeline_and_build(project, '11eeffdd', branch, 1) - old_build.drop! - end - - it 'does not take outdated pipeline into account' do - expect(badge.status).to eq 'success' - end + context 'when a pipeline does not exist' do + it { expect(badge.status).to eq 'unknown' } end - - context 'when multiple pipelines exist for given sha' do - before do - build.drop! - - new_build = create_pipeline_and_build(project, sha, branch, 3) - new_build.success! - end - - it 'does not take outdated pipeline into account' do - expect(badge.status).to eq 'success' - end - end - - context 'when ignored_skipped is set to true' do - let(:new_badge) { described_class.new(project, branch, opts: { ignore_skipped: true }) } - - before do - build.skip! - end - - describe '#status' do - it 'uses latest non-skipped status' do - expect(new_badge.status).not_to eq 'skipped' - end - end - end - - context 'when ignored_skipped is set to false' do - let(:new_badge) { described_class.new(project, branch, opts: { ignore_skipped: false }) } - - before do - build.skip! - end - - describe '#status' do - it 'uses latest status' do - expect(new_badge.status).to eq 'skipped' - end - end - end - end - - context 'build does not exist' do - describe '#status' do - it 'is unknown' do - expect(badge.status).to eq 'unknown' - end - end - end - - def create_pipeline_and_build(project, sha, branch, id) - pipeline = create(:ci_empty_pipeline, project: project, sha: sha, ref: branch, id: id) - - create(:ci_build, pipeline: pipeline, stage: 'notify') end end diff --git a/spec/lib/gitlab/tracking/event_definition_validator_spec.rb b/spec/lib/gitlab/tracking/event_definition_validator_spec.rb index 1dcbede57e3..8c91d70a326 100644 --- a/spec/lib/gitlab/tracking/event_definition_validator_spec.rb +++ b/spec/lib/gitlab/tracking/event_definition_validator_spec.rb @@ -37,6 +37,8 @@ RSpec.describe Gitlab::Tracking::EventDefinitionValidator, feature_category: :se :product_group | nil :distributions | %(be eb) :tiers | %(pro) + :product_categories | 'bad_category' + :product_categories | ['bad_category'] end with_them do diff --git a/spec/lib/gitlab/usage/metric_definition_spec.rb b/spec/lib/gitlab/usage/metric_definition_spec.rb index b4a7a179456..4b0589af0d0 100644 --- a/spec/lib/gitlab/usage/metric_definition_spec.rb +++ b/spec/lib/gitlab/usage/metric_definition_spec.rb @@ -198,6 +198,8 @@ RSpec.describe Gitlab::Usage::MetricDefinition, feature_category: :service_ping :repair_issue_url | nil :removed_by_url | 1 :another_attribute | nil + :product_categories | 'bad_category' + :product_categories | ['bad_category'] :performance_indicator_type | nil :instrumentation_class | 'Metric_Class' diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index cfcd59a5f1e..8649cfb4f3d 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -752,8 +752,13 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep, feature_category: describe '.order_id_desc' do subject(:pipelines_ordered_by_id) { described_class.order_id_desc } - let(:older_pipeline) { create(:ci_pipeline, id: 99, project: project) } - let(:newest_pipeline) { create(:ci_pipeline, id: 100, project: project) } + let_it_be(:older_pipeline) { create(:ci_pipeline, project: project) } + let_it_be(:newest_pipeline) { create(:ci_pipeline, project: project) } + + it 'only returns the pipelines ordered by id' do + expect(newest_pipeline.id).to be > older_pipeline.id + expect(pipelines_ordered_by_id).to eq([newest_pipeline, older_pipeline]) + end it 'only returns the pipelines ordered by id' do expect(pipelines_ordered_by_id).to eq([newest_pipeline, older_pipeline]) @@ -2822,16 +2827,16 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep, feature_category: let(:refs) { %w[first_ref second_ref third_ref] } before do - create(:ci_empty_pipeline, id: 1001, status: :success, ref: 'first_ref', sha: 'sha') - create(:ci_empty_pipeline, id: 1002, status: :success, ref: 'second_ref', sha: 'sha') + create(:ci_empty_pipeline, status: :success, ref: 'first_ref', sha: 'sha') + create(:ci_empty_pipeline, status: :success, ref: 'second_ref', sha: 'sha') end let!(:latest_successful_pipeline_for_first_ref) do - create(:ci_empty_pipeline, id: 2001, status: :success, ref: 'first_ref', sha: 'sha') + create(:ci_empty_pipeline, status: :success, ref: 'first_ref', sha: 'sha') end let!(:latest_successful_pipeline_for_second_ref) do - create(:ci_empty_pipeline, id: 2002, status: :success, ref: 'second_ref', sha: 'sha') + create(:ci_empty_pipeline, status: :success, ref: 'second_ref', sha: 'sha') end it 'returns the latest successful pipeline for both refs' do diff --git a/spec/models/commit_signatures/gpg_signature_spec.rb b/spec/models/commit_signatures/gpg_signature_spec.rb index 134caf0f123..41fc0bd7bc4 100644 --- a/spec/models/commit_signatures/gpg_signature_spec.rb +++ b/spec/models/commit_signatures/gpg_signature_spec.rb @@ -7,9 +7,10 @@ RSpec.describe CommitSignatures::GpgSignature do # For instructions on how to add more seed data, see the project README let_it_be(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } let_it_be(:project) { create(:project, :repository, path: 'sample-project') } - let_it_be(:commit) { create(:commit, project: project, sha: commit_sha) } let_it_be(:gpg_key) { create(:gpg_key) } let_it_be(:gpg_key_subkey) { create(:gpg_key_subkey, gpg_key: gpg_key) } + let(:commit) { create(:commit, project: project, sha: commit_sha, author: commit_author) } + let(:commit_author) { gpg_key.user } let(:signature) { create(:gpg_signature, commit_sha: commit_sha, gpg_key: gpg_key) } @@ -116,8 +117,46 @@ RSpec.describe CommitSignatures::GpgSignature do end describe '#reverified_status' do - it 'returns existing verification status' do - expect(signature.reverified_status).to eq(signature.verification_status) + let(:verification_status) { :verified } + let(:signature) do + create(:gpg_signature, commit_sha: commit_sha, gpg_key: gpg_key, project: project, + verification_status: verification_status) + end + + before do + allow(project).to receive(:commit).with(commit_sha).and_return(commit) + end + + # verified is used for user signed gpg commits. + context 'when verification_status is verified' do + it 'returns existing verification status' do + expect(signature.reverified_status).to eq('verified') + end + + context 'when commit author does not match the gpg_key author' do + let(:commit_author) { create(:user) } + + it 'returns existing verification status' do + expect(signature.reverified_status).to eq('verified') + end + end + end + + # verified_system is used for ui signed commits. + context 'when verification_status is verified_system' do + let(:verification_status) { :verified_system } + + it 'returns existing verification status' do + expect(signature.reverified_status).to eq('verified_system') + end + + context 'when commit author does not match the gpg_key author' do + let(:commit_author) { create(:user) } + + it 'returns existing verification status' do + expect(signature.reverified_status).to eq('unverified_author_email') + end + end end end end diff --git a/spec/models/commit_signatures/ssh_signature_spec.rb b/spec/models/commit_signatures/ssh_signature_spec.rb index 6ec9edce8b8..55e0ef20aee 100644 --- a/spec/models/commit_signatures/ssh_signature_spec.rb +++ b/spec/models/commit_signatures/ssh_signature_spec.rb @@ -12,8 +12,11 @@ RSpec.describe CommitSignatures::SshSignature, feature_category: :source_code_ma let_it_be(:ssh_key) { create(:ed25519_key_256, user: user) } let_it_be(:key_fingerprint) { ssh_key.fingerprint_sha256 } + let(:verification_status) { :verified } + let(:signature) do - create(:ssh_signature, commit_sha: commit_sha, key: ssh_key, key_fingerprint_sha256: key_fingerprint, user: user) + create(:ssh_signature, commit_sha: commit_sha, key: ssh_key, key_fingerprint_sha256: key_fingerprint, user: user, + verification_status: verification_status) end let(:attributes) do @@ -109,5 +112,31 @@ RSpec.describe CommitSignatures::SshSignature, feature_category: :source_code_ma expect(signature.reverified_status).to eq('unverified') end end + + context 'when verification_status is verified_system' do + let(:verification_status) { :verified_system } + + it 'returns the signature verification status' do + expect(signature.reverified_status).to eq('verified_system') + end + + context 'and the author email does not belong to the signed by user' do + let(:user) { create(:user) } + + it 'returns unverified_author_email' do + expect(signature.reverified_status).to eq('unverified_author_email') + end + + context 'when check_for_mailmapped_commit_emails feature flag is disabled' do + before do + stub_feature_flags(check_for_mailmapped_commit_emails: false) + end + + it 'verification status is unmodified' do + expect(signature.reverified_status).to eq('verified_system') + end + end + end + end end end diff --git a/spec/scripts/setup/tests-metadata_spec.rb b/spec/scripts/setup/tests-metadata_spec.rb index aa4354ad8a9..d602a9f59a1 100644 --- a/spec/scripts/setup/tests-metadata_spec.rb +++ b/spec/scripts/setup/tests-metadata_spec.rb @@ -383,7 +383,7 @@ RSpec.describe TestsMetadata, feature_category: :tooling do # rubocop:disable Ra let(:fast_quarantine_report) do <<~TEXT qa/specs/features/ee/browser_ui/3_create/remote_development/workspace_actions_spec.rb - spec/features/projects/work_items/work_item_spec.rb:67 + spec/features/work_items/work_item_spec.rb:67 TEXT end diff --git a/spec/support/helpers/user_with_namespace_shim.yml b/spec/support/helpers/user_with_namespace_shim.yml index 59fe975836b..b0145b16ed0 100644 --- a/spec/support/helpers/user_with_namespace_shim.yml +++ b/spec/support/helpers/user_with_namespace_shim.yml @@ -560,7 +560,6 @@ - spec/features/projects/user_uses_shortcuts_spec.rb - spec/features/projects/wiki/user_views_wiki_empty_spec.rb - spec/features/projects/wikis_spec.rb -- spec/features/projects/work_items/work_item_spec.rb - spec/features/projects_spec.rb - spec/features/reportable_note/merge_request_spec.rb - spec/features/search/user_searches_for_code_spec.rb @@ -601,6 +600,7 @@ - spec/features/users/user_browses_projects_on_user_page_spec.rb - spec/features/webauthn_spec.rb - spec/features/whats_new_spec.rb +- spec/features/work_items/work_item_spec.rb - spec/finders/admin/projects_finder_spec.rb - spec/finders/autocomplete/move_to_project_finder_spec.rb - spec/finders/autocomplete/routes_finder_spec.rb diff --git a/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb b/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb index 9be2a6f0ce4..7dfe2c3a1b7 100644 --- a/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb +++ b/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb @@ -2,12 +2,14 @@ require 'spec_helper' -RSpec.describe 'projects/generic_commit_statuses/_generic_commit_status.html.haml' do +RSpec.describe 'projects/generic_commit_statuses/_generic_commit_status.html.haml', feature_category: :continuous_integration do include Devise::Test::ControllerHelpers - let(:project) { create(:project, :repository) } - let(:pipeline) { create(:ci_empty_pipeline, id: 1337, project: project, sha: project.commit.id) } - let(:generic_commit_status) { create(:generic_commit_status, pipeline: pipeline, stage: 'external', name: 'jenkins', stage_idx: 3) } + let_it_be(:project) { create(:project, :repository) } + let_it_be(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) } + let_it_be(:generic_commit_status) { create(:generic_commit_status, pipeline: pipeline, stage: 'external', name: 'jenkins', stage_idx: 3) } + let(:link) { "##{pipeline.id}" } + let(:text) { "##{pipeline.id} by API" } before do controller.prepend_view_path('app/views/projects') @@ -17,14 +19,14 @@ RSpec.describe 'projects/generic_commit_statuses/_generic_commit_status.html.ham it 'won\'t include a column with a link to its pipeline by default' do render partial: 'projects/generic_commit_statuses/generic_commit_status', locals: { generic_commit_status: generic_commit_status } - expect(rendered).not_to have_link('#1337') - expect(rendered).not_to have_text('#1337 by API') + expect(rendered).not_to have_link(link) + expect(rendered).not_to have_text(text) end it 'can include a column with a link to its pipeline' do render partial: 'projects/generic_commit_statuses/generic_commit_status', locals: { generic_commit_status: generic_commit_status, pipeline_link: true } - expect(rendered).to have_link('#1337') - expect(rendered).to have_text('#1337 by API') + expect(rendered).to have_link(link) + expect(rendered).to have_text(text) end end