Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

Commit

Permalink
Orchestrator extracts license file to flatcontainer (#687)
Browse files Browse the repository at this point in the history
* Added PackageStatusProcessor for package-specific code.
* Added optional OnBeforeUpdateDatabaseToMakePackageAvailable to EntityStatusProcessor.
* Added telemetry for license file operations.
* ServerCommon version upgrade.
  • Loading branch information
agr authored Dec 6, 2018
1 parent ea7d93c commit 9fb5653
Show file tree
Hide file tree
Showing 19 changed files with 533 additions and 277 deletions.
6 changes: 3 additions & 3 deletions src/NuGet.Jobs.Common/NuGet.Jobs.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Services.Configuration">
<Version>2.39.0</Version>
<Version>2.40.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Logging">
<Version>2.39.0</Version>
<Version>2.40.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Sql">
<Version>2.39.0</Version>
<Version>2.40.0</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.3</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Services.Status">
<Version>2.39.0</Version>
<Version>2.40.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace NuGet.Services.Validation.Orchestrator
{
public class FlatContainerConfiguration
{
public string ConnectionString { get; set; }
}
}
315 changes: 315 additions & 0 deletions src/NuGet.Services.Validation.Orchestrator/EntityStatusProcessor.cs

Large diffs are not rendered by default.

34 changes: 32 additions & 2 deletions src/NuGet.Services.Validation.Orchestrator/Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public class Job : JobBase
private const string GalleryDbConfigurationSectionName = "GalleryDb";
private const string ValidationDbConfigurationSectionName = "ValidationDb";
private const string ServiceBusConfigurationSectionName = "ServiceBus";
private const string SmtpConfigurationSectionName = "Smtp";
private const string EmailConfigurationSectionName = "Email";
private const string PackageDownloadTimeoutName = "PackageDownloadTimeout";
private const string FlatContainerConfigurationSectionName = "FlatContainer";

private const string EmailBindingKey = EmailConfigurationSectionName;
private const string PackageVerificationTopicClientBindingKey = "PackageVerificationTopicClient";
Expand All @@ -74,6 +74,7 @@ public class Job : JobBase
private const string ScanBindingKey = "Scan";
private const string ValidationStorageBindingKey = "ValidationStorage";
private const string OrchestratorBindingKey = "Orchestrator";
private const string CoreLicenseFileServiceBindingKey = "CoreLicenseFileService";

private const string SymbolsValidatorSectionName = "SymbolsValidator";
private const string SymbolsValidationBindingKey = SymbolsValidatorSectionName;
Expand Down Expand Up @@ -193,6 +194,7 @@ private void ConfigureJobServices(IServiceCollection services, IConfigurationRoo
services.Configure<ScanAndSignConfiguration>(configurationRoot.GetSection(ScanAndSignSectionName));
services.Configure<SymbolScanOnlyConfiguration>(configurationRoot.GetSection(SymbolScanOnlySectionName));
services.Configure<ScanAndSignEnqueuerConfiguration>(configurationRoot.GetSection(ScanAndSignSectionName));
services.Configure<FlatContainerConfiguration>(configurationRoot.GetSection(FlatContainerConfigurationSectionName));

services.Configure<SymbolsValidationConfiguration>(configurationRoot.GetSection(SymbolsValidatorSectionName));
services.Configure<SymbolsIngesterConfiguration>(configurationRoot.GetSection(SymbolsIngesterSectionName));
Expand Down Expand Up @@ -243,7 +245,7 @@ private void ConfigureJobServices(IServiceCollection services, IConfigurationRoo
});
services.AddTransient<ICoreFileStorageService, CloudBlobCoreFileStorageService>();
services.AddTransient<IFileDownloader, PackageDownloader>();
services.AddTransient<IStatusProcessor<Package>, EntityStatusProcessor<Package>>();
services.AddTransient<IStatusProcessor<Package>, PackageStatusProcessor>();
services.AddTransient<IValidationSetProvider<Package>, ValidationSetProvider<Package>>();
services.AddTransient<IValidationSetProcessor, ValidationSetProcessor>();
services.AddTransient<IBrokeredMessageSerializer<SignatureValidationMessage>, SignatureValidationMessageSerializer>();
Expand Down Expand Up @@ -349,6 +351,7 @@ private static IServiceProvider CreateProvider(IServiceCollection services, ICon
ConfigurePackageCertificatesValidator(containerBuilder);
ConfigureScanAndSignProcessor(containerBuilder);
ConfigureScanValidator(containerBuilder);
ConfigureFlatContainer(containerBuilder);
break;
case ValidatingType.SymbolPackage:
ConfigureSymbolScanValidator(containerBuilder);
Expand Down Expand Up @@ -507,6 +510,33 @@ private static void ConfigureScanValidator(ContainerBuilder builder)
.AsSelf();
}

private static void ConfigureFlatContainer(ContainerBuilder builder)
{
builder
.Register<CloudBlobClientWrapper>(c =>
{
var configurationAccessor = c.Resolve<IOptionsSnapshot<FlatContainerConfiguration>>();
return new CloudBlobClientWrapper(
configurationAccessor.Value.ConnectionString,
readAccessGeoRedundant: false);
})
.Keyed<ICloudBlobClient>(CoreLicenseFileServiceBindingKey);

builder
.RegisterType<CloudBlobCoreFileStorageService>()
.WithKeyedParameter(typeof(ICloudBlobClient), CoreLicenseFileServiceBindingKey)
.Keyed<ICoreFileStorageService>(CoreLicenseFileServiceBindingKey);

builder
.RegisterType<OrchestratorContentFileMetadataService>()
.As<IContentFileMetadataService>();

builder
.RegisterType<CoreLicenseFileService>()
.WithKeyedParameter(typeof(ICoreFileStorageService), CoreLicenseFileServiceBindingKey)
.As<ICoreLicenseFileService>();
}

private static void ConfigureOrchestratorMessageHandler(IServiceCollection services, IConfigurationRoot configurationRoot)
{
var validatingType = configurationRoot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@
<ItemGroup>
<Compile Include="BaseValidator.cs" />
<Compile Include="Configuration\ConfigurationValidator.cs" />
<Compile Include="Configuration\FlatContainerConfiguration.cs" />
<Compile Include="Configuration\TopologicalSort.cs" />
<Compile Include="ContainerBuilderExtensions.cs" />
<Compile Include="Configuration\CoreMessageServiceConfiguration.cs" />
<Compile Include="Configuration\EmailConfiguration.cs" />
<Compile Include="EntityStatusProcessor.cs" />
<Compile Include="Error.cs" />
<Compile Include="PackageStatusProcessor.cs" />
<Compile Include="Services\MessageServiceConfiguration.cs" />
<Compile Include="Services\OrchestratorContentFileMetadataService.cs" />
<Compile Include="Services\SymbolsMessageService.cs" />
<Compile Include="SymbolsStatusProcessor.cs" />
<Compile Include="Symbols\ISymbolsIngesterMessageEnqueuer.cs" />
Expand Down Expand Up @@ -92,7 +96,6 @@
<Compile Include="PackageSigning\ValidateCertificate\ValidateCertificateConfiguration.cs" />
<Compile Include="PackageSigning\ValidateCertificate\ValidateCertificateEnqueuer.cs" />
<Compile Include="PackageSigning\ProcessSignature\PackageSignatureValidator.cs" />
<Compile Include="PackageStatusProcessor.cs" />
<Compile Include="PackageValidationMessageDataSerializer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down Expand Up @@ -160,7 +163,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Services.Messaging.Email">
<Version>2.39.0</Version>
<Version>2.40.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
Loading

0 comments on commit 9fb5653

Please sign in to comment.