Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 245aa36

Browse files
authored
Merge pull request #395 from NuGet/dev
[ReleasePrep][2018.04.02]RI of dev into master
2 parents f24a663 + 0102560 commit 245aa36

92 files changed

Lines changed: 3673 additions & 793 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NuGet.Jobs.sln

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnapshotAzureBlob", "src\Sn
115115
EndProject
116116
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validation.PackageSigning.ProcessSignature.Tests", "tests\Validation.PackageSigning.ProcessSignature.Tests\Validation.PackageSigning.ProcessSignature.Tests.csproj", "{26435822-8938-48C9-96FD-0DCCF8F7CE00}"
117117
EndProject
118+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validation.PackageSigning.RevalidateCertificate", "src\Validation.PackageSigning.RevalidateCertificate\Validation.PackageSigning.RevalidateCertificate.csproj", "{EA32E1E5-7E7D-44E6-B496-43E1FEDE9400}"
119+
EndProject
120+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validation.PackageSigning.RevalidateCertificate.Tests", "tests\Validation.PackageSigning.RevalidateCertificate.Tests\Validation.PackageSigning.RevalidateCertificate.Tests.csproj", "{64095857-E9E3-4D9C-8769-7E558CD757CB}"
121+
EndProject
122+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Stats.AggregateCdnDownloadsInGallery", "tests\Tests.Stats.AggregateCdnDownloadsInGallery\Tests.Stats.AggregateCdnDownloadsInGallery.csproj", "{136411AF-B9FA-438D-B790-9FB78A5F7F54}"
123+
EndProject
118124
Global
119125
GlobalSection(SolutionConfigurationPlatforms) = preSolution
120126
Debug|Any CPU = Debug|Any CPU
@@ -295,6 +301,18 @@ Global
295301
{26435822-8938-48C9-96FD-0DCCF8F7CE00}.Debug|Any CPU.Build.0 = Debug|Any CPU
296302
{26435822-8938-48C9-96FD-0DCCF8F7CE00}.Release|Any CPU.ActiveCfg = Release|Any CPU
297303
{26435822-8938-48C9-96FD-0DCCF8F7CE00}.Release|Any CPU.Build.0 = Release|Any CPU
304+
{EA32E1E5-7E7D-44E6-B496-43E1FEDE9400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
305+
{EA32E1E5-7E7D-44E6-B496-43E1FEDE9400}.Debug|Any CPU.Build.0 = Debug|Any CPU
306+
{EA32E1E5-7E7D-44E6-B496-43E1FEDE9400}.Release|Any CPU.ActiveCfg = Release|Any CPU
307+
{EA32E1E5-7E7D-44E6-B496-43E1FEDE9400}.Release|Any CPU.Build.0 = Release|Any CPU
308+
{64095857-E9E3-4D9C-8769-7E558CD757CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
309+
{64095857-E9E3-4D9C-8769-7E558CD757CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
310+
{64095857-E9E3-4D9C-8769-7E558CD757CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
311+
{64095857-E9E3-4D9C-8769-7E558CD757CB}.Release|Any CPU.Build.0 = Release|Any CPU
312+
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
313+
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Debug|Any CPU.Build.0 = Debug|Any CPU
314+
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Release|Any CPU.ActiveCfg = Release|Any CPU
315+
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Release|Any CPU.Build.0 = Release|Any CPU
298316
EndGlobalSection
299317
GlobalSection(SolutionProperties) = preSolution
300318
HideSolutionNode = FALSE
@@ -343,6 +361,9 @@ Global
343361
{DD043977-6BCD-475A-BEE2-8C34309EC622} = {678D7B14-F8BC-4193-99AF-2EE8AA390A02}
344362
{ED2D370C-D921-433A-A0B9-A601F936EDD3} = {FA5644B5-4F08-43F6-86B3-039374312A47}
345363
{26435822-8938-48C9-96FD-0DCCF8F7CE00} = {6A776396-02B1-475D-A104-26940ADB04AB}
364+
{EA32E1E5-7E7D-44E6-B496-43E1FEDE9400} = {678D7B14-F8BC-4193-99AF-2EE8AA390A02}
365+
{64095857-E9E3-4D9C-8769-7E558CD757CB} = {6A776396-02B1-475D-A104-26940ADB04AB}
366+
{136411AF-B9FA-438D-B790-9FB78A5F7F54} = {6A776396-02B1-475D-A104-26940ADB04AB}
346367
EndGlobalSection
347368
GlobalSection(ExtensibilityGlobals) = postSolution
348369
SolutionGuid = {284A7AC3-FB43-4F1F-9C9C-2AF0E1F46C2B}

build.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Invoke-BuildStep 'Set version metadata in AssemblyInfo.cs' { `
109109
"$PSScriptRoot\src\Stats.CollectAzureChinaCDNLogs\Properties\AssemblyInfo.g.cs",
110110
"$PSScriptRoot\src\Validation.PackageSigning.ProcessSignature\Properties\AssemblyInfo.g.cs",
111111
"$PSScriptRoot\src\Validation.PackageSigning.ValidateCertificate\Properties\AssemblyInfo.g.cs",
112+
"$PSScriptRoot\src\Validation.PackageSigning.RevalidateCertificate\Properties\AssemblyInfo.g.cs",
112113
"$PSScriptRoot\src\NuGet.Jobs.Common\Properties\AssemblyInfo.g.cs",
113114
"$PSScriptRoot\src\Validation.Common.Job\Properties\AssemblyInfo.g.cs"
114115

@@ -137,6 +138,13 @@ Invoke-BuildStep 'Prepare NuGetCDNRedirect Package' { Prepare-NuGetCDNRedirect }
137138
-ev +BuildErrors
138139

139140
Invoke-BuildStep 'Creating artifacts' {
141+
# We need a few projects to be published for sharing the common bits with other repos.
142+
# We need symbols published for those, too. All other packages are deployment ones and
143+
# don't need to be shared, hence no need for symbols for them
144+
$ProjectsWithSymbols =
145+
"src/NuGet.Jobs.Common/NuGet.Jobs.Common.csproj",
146+
"src/Validation.Common.Job/Validation.Common.Job.csproj"
147+
140148
$Projects = `
141149
"src/Stats.CollectAzureCdnLogs/Stats.CollectAzureCdnLogs.csproj", `
142150
"src/Stats.AggregateCdnDownloadsInGallery/Stats.AggregateCdnDownloadsInGallery.csproj", `
@@ -159,11 +167,12 @@ Invoke-BuildStep 'Creating artifacts' {
159167
"src/Stats.CollectAzureChinaCDNLogs/Stats.CollectAzureChinaCDNLogs.csproj", `
160168
"src/Validation.PackageSigning.ProcessSignature/Validation.PackageSigning.ProcessSignature.csproj", `
161169
"src/Validation.PackageSigning.ValidateCertificate/Validation.PackageSigning.ValidateCertificate.csproj", `
162-
"src/NuGet.Jobs.Common/NuGet.Jobs.Common.csproj", `
163-
"src/Validation.Common.Job/Validation.Common.Job.csproj"
170+
"src/Validation.PackageSigning.RevalidateCertificate/Validation.PackageSigning.RevalidateCertificate.csproj" `
171+
+ $ProjectsWithSymbols
164172

165173
Foreach ($Project in $Projects) {
166-
New-Package (Join-Path $PSScriptRoot "$Project") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch -MSBuildVersion "$msBuildVersion"
174+
$Symbols = $ProjectsWithSymbols -contains $Project;
175+
New-Package (Join-Path $PSScriptRoot "$Project") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch -MSBuildVersion "$msBuildVersion" -Symbols:$Symbols
167176
}
168177
} `
169178
-ev +BuildErrors

src/NuGet.Jobs.Common/Configuration/JobArgumentNames.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,7 @@ public static class JobArgumentNames
117117
public const string MailFrom = "MailFrom";
118118
public const string SmtpUri = "SmtpUri";
119119

120+
// Arguments specific to Stats.AggregateCdnDownloadsInGallery
121+
public static string BatchSleepSeconds = "BatchSleepSeconds";
120122
}
121123
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
namespace NuGet.Jobs.Configuration
5+
{
6+
public class ValidationStorageConfiguration
7+
{
8+
public string ConnectionString { get; set; }
9+
}
10+
}

src/NuGet.Jobs.Common/NuGet.Jobs.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
<Compile Include="Configuration\JobArgumentNames.cs" />
192192
<Compile Include="Configuration\ServiceBusConfiguration.cs" />
193193
<Compile Include="Configuration\ValidationDbConfiguration.cs" />
194+
<Compile Include="Configuration\ValidationStorageConfiguration.cs" />
194195
<Compile Include="Extensions\SqlConnectionStringBuilderExtensions.cs" />
195196
<Compile Include="Extensions\XElementExtensions.cs" />
196197
<Compile Include="SecretReader\ISecretReaderFactory.cs" />

src/NuGet.Services.Validation.Orchestrator/Job.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using NuGet.Jobs.Validation.Common;
2424
using NuGet.Jobs.Validation.PackageSigning.Messages;
2525
using NuGet.Jobs.Validation.PackageSigning.Storage;
26+
using NuGet.Jobs.Validation.Storage;
2627
using NuGet.Services.Configuration;
2728
using NuGet.Services.KeyVault;
2829
using NuGet.Services.Logging;
@@ -203,6 +204,7 @@ private void ConfigureJobServices(IServiceCollection services, IConfigurationRoo
203204
services.AddTransient<IBrokeredMessageSerializer<SignatureValidationMessage>, SignatureValidationMessageSerializer>();
204205
services.AddTransient<IBrokeredMessageSerializer<CertificateValidationMessage>, CertificateValidationMessageSerializer>();
205206
services.AddTransient<IValidatorStateService, ValidatorStateService>();
207+
services.AddTransient<ISimpleCloudBlobProvider, SimpleCloudBlobProvider>();
206208
services.AddTransient<PackageSigningValidator>();
207209
services.AddTransient<MailSenderConfiguration>(serviceProvider =>
208210
{

src/NuGet.Services.Validation.Orchestrator/NuGet.Services.Validation.Orchestrator.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
</ItemGroup>
109109
<ItemGroup>
110110
<PackageReference Include="NuGet.Services.Validation.Issues">
111-
<Version>2.19.1</Version>
111+
<Version>2.22.0</Version>
112112
</PackageReference>
113113
</ItemGroup>
114114
<ItemGroup>
@@ -136,4 +136,4 @@
136136
<SignPath Condition="'$(NuGetBuildPath)' != ''">$(NuGetBuildPath)</SignPath>
137137
</PropertyGroup>
138138
<Import Project="$(SignPath)\sign.targets" Condition="Exists('$(SignPath)\sign.targets')" />
139-
</Project>
139+
</Project>

src/NuGet.Services.Validation.Orchestrator/PackageSigning/ProcessSignature/PackageSigningValidator.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,29 @@
66
using System.Threading.Tasks;
77
using Microsoft.Extensions.Logging;
88
using NuGet.Jobs.Validation.PackageSigning.Storage;
9-
using NuGet.Services.Validation.Orchestrator;
9+
using NuGet.Jobs.Validation.Storage;
1010
using NuGet.Services.Validation.Orchestrator.Telemetry;
1111

1212
namespace NuGet.Services.Validation.PackageSigning.ProcessSignature
1313
{
14-
public class PackageSigningValidator : BaseValidator, IValidator
14+
public class PackageSigningValidator : IProcessor
1515
{
1616
private readonly IValidatorStateService _validatorStateService;
1717
private readonly IProcessSignatureEnqueuer _signatureVerificationEnqueuer;
18+
private readonly ISimpleCloudBlobProvider _blobProvider;
1819
private readonly ITelemetryService _telemetryService;
1920
private readonly ILogger<PackageSigningValidator> _logger;
2021

2122
public PackageSigningValidator(
2223
IValidatorStateService validatorStateService,
2324
IProcessSignatureEnqueuer signatureVerificationEnqueuer,
25+
ISimpleCloudBlobProvider blobProvider,
2426
ITelemetryService telemetryService,
2527
ILogger<PackageSigningValidator> logger)
2628
{
2729
_validatorStateService = validatorStateService ?? throw new ArgumentNullException(nameof(validatorStateService));
2830
_signatureVerificationEnqueuer = signatureVerificationEnqueuer ?? throw new ArgumentNullException(nameof(signatureVerificationEnqueuer));
31+
_blobProvider = blobProvider ?? throw new ArgumentNullException(nameof(blobProvider));
2932
_telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
3033
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
3134
}
@@ -44,6 +47,25 @@ public async Task<IValidationResult> StartAsync(IValidationRequest request)
4447
return validatorStatus.ToValidationResult();
4548
}
4649

50+
public async Task CleanUpAsync(IValidationRequest request)
51+
{
52+
var validatorStatus = await _validatorStateService.GetStatusAsync(request);
53+
54+
if (validatorStatus.NupkgUrl == null)
55+
{
56+
return;
57+
}
58+
59+
_logger.LogInformation(
60+
"Cleaning up the .nupkg URL for validation ID {ValidationId} ({PackageId} {PackageVersion}).",
61+
request.ValidationId,
62+
request.PackageId,
63+
request.PackageVersion);
64+
65+
var blob = _blobProvider.GetBlobFromUrl(validatorStatus.NupkgUrl);
66+
await blob.DeleteIfExistsAsync();
67+
}
68+
4769
private async Task<ValidatorStatus> StartInternalAsync(IValidationRequest request)
4870
{
4971
// Check that this is the first validation for this specific request.

src/NuGet.Services.Validation.Orchestrator/PackageSigning/ValidateCertificate/PackageCertificatesValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ private Task<PackageSignature> FindSignatureAsync(IValidationRequest request)
244244
private void PromoteSignature(IValidationRequest request, PackageSignature signature)
245245
{
246246

247-
var newSignatureStatus = (IsValidSignatureOutOfGracePeriod(request, signature))
247+
var newSignatureStatus = signature.IsPromotable()
248248
? PackageSignatureStatus.Valid
249249
: PackageSignatureStatus.InGracePeriod;
250250

src/NuGet.Services.Validation.Orchestrator/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "VcsValidator",
66
"TrackAfter": "1:00:00:00",
7-
"requiredValidations": [],
7+
"requiredValidations": [ "PackageSigningValidator" ],
88
"ShouldStart": true,
99
"FailureBehavior": "MustSucceed"
1010
},

0 commit comments

Comments
 (0)