Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
55 lines
2.0 KiB
C#
55 lines
2.0 KiB
C#
using System;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using StellaOps.DependencyInjection;
|
|
using StellaOps.Concelier.Core.Jobs;
|
|
using StellaOps.Concelier.Connector.Distro.RedHat.Configuration;
|
|
|
|
namespace StellaOps.Concelier.Connector.Distro.RedHat;
|
|
|
|
public sealed class RedHatDependencyInjectionRoutine : IDependencyInjectionRoutine
|
|
{
|
|
private const string ConfigurationSection = "concelier:sources:redhat";
|
|
private const string FetchCron = "0,15,30,45 * * * *";
|
|
private const string ParseCron = "5,20,35,50 * * * *";
|
|
private const string MapCron = "10,25,40,55 * * * *";
|
|
|
|
private static readonly TimeSpan FetchTimeout = TimeSpan.FromMinutes(12);
|
|
private static readonly TimeSpan ParseTimeout = TimeSpan.FromMinutes(15);
|
|
private static readonly TimeSpan MapTimeout = TimeSpan.FromMinutes(20);
|
|
private static readonly TimeSpan LeaseDuration = TimeSpan.FromMinutes(6);
|
|
|
|
public IServiceCollection Register(IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(services);
|
|
ArgumentNullException.ThrowIfNull(configuration);
|
|
|
|
services.AddRedHatConnector(options =>
|
|
{
|
|
configuration.GetSection(ConfigurationSection).Bind(options);
|
|
options.Validate();
|
|
});
|
|
|
|
var schedulerBuilder = new JobSchedulerBuilder(services);
|
|
|
|
schedulerBuilder
|
|
.AddJob<RedHatFetchJob>(
|
|
RedHatJobKinds.Fetch,
|
|
cronExpression: FetchCron,
|
|
timeout: FetchTimeout,
|
|
leaseDuration: LeaseDuration)
|
|
.AddJob<RedHatParseJob>(
|
|
RedHatJobKinds.Parse,
|
|
cronExpression: ParseCron,
|
|
timeout: ParseTimeout,
|
|
leaseDuration: LeaseDuration)
|
|
.AddJob<RedHatMapJob>(
|
|
RedHatJobKinds.Map,
|
|
cronExpression: MapCron,
|
|
timeout: MapTimeout,
|
|
leaseDuration: LeaseDuration);
|
|
|
|
return services;
|
|
}
|
|
}
|