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
54 lines
2.0 KiB
C#
54 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.Suse.Configuration;
|
|
|
|
namespace StellaOps.Concelier.Connector.Distro.Suse;
|
|
|
|
public sealed class SuseDependencyInjectionRoutine : IDependencyInjectionRoutine
|
|
{
|
|
private const string ConfigurationSection = "concelier:sources:suse";
|
|
private const string FetchCron = "*/30 * * * *";
|
|
private const string ParseCron = "5,35 * * * *";
|
|
private const string MapCron = "10,40 * * * *";
|
|
|
|
private static readonly TimeSpan FetchTimeout = TimeSpan.FromMinutes(6);
|
|
private static readonly TimeSpan ParseTimeout = TimeSpan.FromMinutes(10);
|
|
private static readonly TimeSpan MapTimeout = TimeSpan.FromMinutes(10);
|
|
private static readonly TimeSpan LeaseDuration = TimeSpan.FromMinutes(5);
|
|
|
|
public IServiceCollection Register(IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(services);
|
|
ArgumentNullException.ThrowIfNull(configuration);
|
|
|
|
services.AddSuseConnector(options =>
|
|
{
|
|
configuration.GetSection(ConfigurationSection).Bind(options);
|
|
options.Validate();
|
|
});
|
|
|
|
var scheduler = new JobSchedulerBuilder(services);
|
|
scheduler
|
|
.AddJob<SuseFetchJob>(
|
|
SuseJobKinds.Fetch,
|
|
cronExpression: FetchCron,
|
|
timeout: FetchTimeout,
|
|
leaseDuration: LeaseDuration)
|
|
.AddJob<SuseParseJob>(
|
|
SuseJobKinds.Parse,
|
|
cronExpression: ParseCron,
|
|
timeout: ParseTimeout,
|
|
leaseDuration: LeaseDuration)
|
|
.AddJob<SuseMapJob>(
|
|
SuseJobKinds.Map,
|
|
cronExpression: MapCron,
|
|
timeout: MapTimeout,
|
|
leaseDuration: LeaseDuration);
|
|
|
|
return services;
|
|
}
|
|
}
|