Commit 9ff77fce authored by Amy Troschinetz's avatar Amy Troschinetz

Adds CI Platform Metrics bookkeeping worker

**app/workers/all_queues.yml:**

- Automatically updated.

**app/workers/ci_platform_metrics_update_cron_worker.rb:**

- Adds a cron worker to update the CI Platform Metrics.

**config/initializers/1_settings.rb:**

- Cron settings for the new worker.

**spec/workers/ci_platform_metrics_update_cron_worker_spec.rb:**

- Spec tests for the new cron worker.

**config/gitlab.yml.example:**

- Adds cron settings to example config.
parent cf5ef696
......@@ -131,6 +131,14 @@
:weight: 1
:idempotent:
: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
:feature_category: :container_registry
: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
schedule_migrate_external_diffs_worker:
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
# installation, and ignored for a CE installation.
ee_cron_jobs:
......
......@@ -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']['cron'] ||= '21 */6 * * *'
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
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