Add Policy DSL Validator, Schema Exporter, and Simulation Smoke tools
- Implemented PolicyDslValidator with command-line options for strict mode and JSON output. - Created PolicySchemaExporter to generate JSON schemas for policy-related models. - Developed PolicySimulationSmoke tool to validate policy simulations against expected outcomes. - Added project files and necessary dependencies for each tool. - Ensured proper error handling and usage instructions across tools.
This commit is contained in:
		@@ -16,11 +16,12 @@ using StellaOps.Concelier.Storage.Mongo.PsirtFlags;
 | 
			
		||||
using StellaOps.Concelier.Storage.Mongo.Statements;
 | 
			
		||||
using StellaOps.Concelier.Storage.Mongo.Events;
 | 
			
		||||
using StellaOps.Concelier.Core.Events;
 | 
			
		||||
using StellaOps.Concelier.Storage.Mongo.Migrations;
 | 
			
		||||
 | 
			
		||||
namespace StellaOps.Concelier.Storage.Mongo;
 | 
			
		||||
 | 
			
		||||
public static class ServiceCollectionExtensions
 | 
			
		||||
using StellaOps.Concelier.Storage.Mongo.Migrations;
 | 
			
		||||
using StellaOps.Concelier.Storage.Mongo.Observations;
 | 
			
		||||
 | 
			
		||||
namespace StellaOps.Concelier.Storage.Mongo;
 | 
			
		||||
 | 
			
		||||
public static class ServiceCollectionExtensions
 | 
			
		||||
{
 | 
			
		||||
    public static IServiceCollection AddMongoStorage(this IServiceCollection services, Action<MongoStorageOptions> configureOptions)
 | 
			
		||||
    {
 | 
			
		||||
@@ -66,15 +67,16 @@ public static class ServiceCollectionExtensions
 | 
			
		||||
        services.AddSingleton<IAdvisoryStore, AdvisoryStore>();
 | 
			
		||||
        services.AddSingleton<IAliasStore, AliasStore>();
 | 
			
		||||
        services.AddSingleton<IChangeHistoryStore, MongoChangeHistoryStore>();
 | 
			
		||||
        services.AddSingleton<IJpFlagStore, JpFlagStore>();
 | 
			
		||||
        services.AddSingleton<IPsirtFlagStore, PsirtFlagStore>();
 | 
			
		||||
        services.AddSingleton<IMergeEventStore, MergeEventStore>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryStatementStore, AdvisoryStatementStore>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryConflictStore, AdvisoryConflictStore>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryEventRepository, MongoAdvisoryEventRepository>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryEventLog, AdvisoryEventLog>();
 | 
			
		||||
        services.AddSingleton<IExportStateStore, ExportStateStore>();
 | 
			
		||||
        services.TryAddSingleton<ExportStateManager>();
 | 
			
		||||
        services.AddSingleton<IJpFlagStore, JpFlagStore>();
 | 
			
		||||
        services.AddSingleton<IPsirtFlagStore, PsirtFlagStore>();
 | 
			
		||||
        services.AddSingleton<IMergeEventStore, MergeEventStore>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryStatementStore, AdvisoryStatementStore>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryConflictStore, AdvisoryConflictStore>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryObservationStore, AdvisoryObservationStore>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryEventRepository, MongoAdvisoryEventRepository>();
 | 
			
		||||
        services.AddSingleton<IAdvisoryEventLog, AdvisoryEventLog>();
 | 
			
		||||
        services.AddSingleton<IExportStateStore, ExportStateStore>();
 | 
			
		||||
        services.TryAddSingleton<ExportStateManager>();
 | 
			
		||||
 | 
			
		||||
        services.AddSingleton<IMongoCollection<JobRunDocument>>(static sp =>
 | 
			
		||||
        {
 | 
			
		||||
@@ -82,16 +84,22 @@ public static class ServiceCollectionExtensions
 | 
			
		||||
            return database.GetCollection<JobRunDocument>(MongoStorageDefaults.Collections.Jobs);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        services.AddSingleton<IMongoCollection<JobLeaseDocument>>(static sp =>
 | 
			
		||||
        {
 | 
			
		||||
            var database = sp.GetRequiredService<IMongoDatabase>();
 | 
			
		||||
            return database.GetCollection<JobLeaseDocument>(MongoStorageDefaults.Collections.Locks);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        services.AddHostedService<RawDocumentRetentionService>();
 | 
			
		||||
 | 
			
		||||
        services.AddSingleton<MongoMigrationRunner>();
 | 
			
		||||
        services.AddSingleton<IMongoMigration, EnsureDocumentExpiryIndexesMigration>();
 | 
			
		||||
        services.AddSingleton<IMongoCollection<JobLeaseDocument>>(static sp =>
 | 
			
		||||
        {
 | 
			
		||||
            var database = sp.GetRequiredService<IMongoDatabase>();
 | 
			
		||||
            return database.GetCollection<JobLeaseDocument>(MongoStorageDefaults.Collections.Locks);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        services.AddSingleton<IMongoCollection<AdvisoryObservationDocument>>(static sp =>
 | 
			
		||||
        {
 | 
			
		||||
            var database = sp.GetRequiredService<IMongoDatabase>();
 | 
			
		||||
            return database.GetCollection<AdvisoryObservationDocument>(MongoStorageDefaults.Collections.AdvisoryObservations);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        services.AddHostedService<RawDocumentRetentionService>();
 | 
			
		||||
 | 
			
		||||
        services.AddSingleton<MongoMigrationRunner>();
 | 
			
		||||
        services.AddSingleton<IMongoMigration, EnsureDocumentExpiryIndexesMigration>();
 | 
			
		||||
        services.AddSingleton<IMongoMigration, EnsureGridFsExpiryIndexesMigration>();
 | 
			
		||||
        services.AddSingleton<IMongoMigration, EnsureAdvisoryEventCollectionsMigration>();
 | 
			
		||||
        services.AddSingleton<IMongoMigration, SemVerStyleBackfillMigration>();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user