Merge branch 'ci-platform-metrics-worker' into 'master'

Adds CI Platform Metrics bookkeeping worker

See merge request gitlab-org/gitlab!40327
parents d900a29c 9ff77fce
...@@ -131,6 +131,14 @@ ...@@ -131,6 +131,14 @@
:weight: 1 :weight: 1
:idempotent: :idempotent:
:tags: [] :tags: []
- :name: cronjob:ci_platform_metrics_update_cron
:feature_category: :continuous_integration
:has_external_dependencies:
:urgency: :low
:resource_boundary: :cpu
:weight: 1
:idempotent:
:tags: []
- :name: cronjob:container_expiration_policy - :name: cronjob:container_expiration_policy
:feature_category: :container_registry :feature_category: :container_registry
:has_external_dependencies: :has_external_dependencies:
......
# frozen_string_literal: true
class CiPlatformMetricsUpdateCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# This worker does not perform work scoped to a context
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
feature_category :continuous_integration
urgency :low
worker_resource_boundary :cpu
def perform
CiPlatformMetric.insert_auto_devops_platform_targets!
end
end
...@@ -456,6 +456,10 @@ production: &base ...@@ -456,6 +456,10 @@ production: &base
schedule_migrate_external_diffs_worker: schedule_migrate_external_diffs_worker:
cron: "15 * * * *" cron: "15 * * * *"
# Update CI Platform Metrics daily
ci_platform_metrics_update_cron_worker:
cron: "47 9 * * *"
# GitLab EE only jobs. These jobs are automatically enabled for an EE # GitLab EE only jobs. These jobs are automatically enabled for an EE
# installation, and ignored for a CE installation. # installation, and ignored for a CE installation.
ee_cron_jobs: ee_cron_jobs:
......
...@@ -511,6 +511,9 @@ Settings.cron_jobs['update_container_registry_info_worker']['job_class'] = 'Upda ...@@ -511,6 +511,9 @@ Settings.cron_jobs['update_container_registry_info_worker']['job_class'] = 'Upda
Settings.cron_jobs['postgres_dynamic_partitions_creator'] ||= Settingslogic.new({}) Settings.cron_jobs['postgres_dynamic_partitions_creator'] ||= Settingslogic.new({})
Settings.cron_jobs['postgres_dynamic_partitions_creator']['cron'] ||= '21 */6 * * *' Settings.cron_jobs['postgres_dynamic_partitions_creator']['cron'] ||= '21 */6 * * *'
Settings.cron_jobs['postgres_dynamic_partitions_creator']['job_class'] ||= 'PartitionCreationWorker' Settings.cron_jobs['postgres_dynamic_partitions_creator']['job_class'] ||= 'PartitionCreationWorker'
Settings.cron_jobs['ci_platform_metrics_update_cron_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['ci_platform_metrics_update_cron_worker']['cron'] ||= '47 9 * * *'
Settings.cron_jobs['ci_platform_metrics_update_cron_worker']['job_class'] = 'CiPlatformMetricsUpdateCronWorker'
Gitlab.ee do Gitlab.ee do
Settings.cron_jobs['adjourned_group_deletion_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['adjourned_group_deletion_worker'] ||= Settingslogic.new({})
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe CiPlatformMetricsUpdateCronWorker, type: :worker do
describe '#perform' do
subject { described_class.new.perform }
it 'inserts new platform metrics' do
expect(CiPlatformMetric).to receive(:insert_auto_devops_platform_targets!).and_call_original
subject
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment