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

Commit e8d3b10

Browse files
authored
Merge pull request #448 from NuGet/dev
[ReleasePrep][2018.05.14]RI of dev into master
2 parents ac0e8b6 + ec58a5b commit e8d3b10

175 files changed

Lines changed: 3729 additions & 2427 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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validation.PackageSigning.R
119119
EndProject
120120
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}"
121121
EndProject
122+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validation.ScanAndSign.Core", "src\Validation.ScanAndSign.Core\Validation.ScanAndSign.Core.csproj", "{DFAC2769-4B67-4FBC-AD60-D93A39DD45AE}"
123+
EndProject
122124
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Stats.AggregateCdnDownloadsInGallery", "tests\Tests.Stats.AggregateCdnDownloadsInGallery\Tests.Stats.AggregateCdnDownloadsInGallery.csproj", "{136411AF-B9FA-438D-B790-9FB78A5F7F54}"
123125
EndProject
126+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validation.PackageSigning.ScanAndSign.Tests", "tests\Validation.PackageSigning.ScanAndSign.Tests\Validation.PackageSigning.ScanAndSign.Tests.csproj", "{CAE45AC9-F11B-4215-9D1A-C98BC0F1F687}"
127+
EndProject
128+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Monitoring", "Monitoring", "{814F9B31-4AF3-46CC-AD61-CEB40F47083A}"
129+
EndProject
130+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monitoring.PackageLag", "src\PackageLagMonitor\Monitoring.PackageLag.csproj", "{B5147169-E941-4CF8-9FCD-1C123ACD3149}"
131+
EndProject
124132
Global
125133
GlobalSection(SolutionConfigurationPlatforms) = preSolution
126134
Debug|Any CPU = Debug|Any CPU
@@ -309,10 +317,22 @@ Global
309317
{64095857-E9E3-4D9C-8769-7E558CD757CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
310318
{64095857-E9E3-4D9C-8769-7E558CD757CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
311319
{64095857-E9E3-4D9C-8769-7E558CD757CB}.Release|Any CPU.Build.0 = Release|Any CPU
320+
{DFAC2769-4B67-4FBC-AD60-D93A39DD45AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
321+
{DFAC2769-4B67-4FBC-AD60-D93A39DD45AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
322+
{DFAC2769-4B67-4FBC-AD60-D93A39DD45AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
323+
{DFAC2769-4B67-4FBC-AD60-D93A39DD45AE}.Release|Any CPU.Build.0 = Release|Any CPU
312324
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
313325
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Debug|Any CPU.Build.0 = Debug|Any CPU
314326
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Release|Any CPU.ActiveCfg = Release|Any CPU
315327
{136411AF-B9FA-438D-B790-9FB78A5F7F54}.Release|Any CPU.Build.0 = Release|Any CPU
328+
{CAE45AC9-F11B-4215-9D1A-C98BC0F1F687}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
329+
{CAE45AC9-F11B-4215-9D1A-C98BC0F1F687}.Debug|Any CPU.Build.0 = Debug|Any CPU
330+
{CAE45AC9-F11B-4215-9D1A-C98BC0F1F687}.Release|Any CPU.ActiveCfg = Release|Any CPU
331+
{CAE45AC9-F11B-4215-9D1A-C98BC0F1F687}.Release|Any CPU.Build.0 = Release|Any CPU
332+
{B5147169-E941-4CF8-9FCD-1C123ACD3149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
333+
{B5147169-E941-4CF8-9FCD-1C123ACD3149}.Debug|Any CPU.Build.0 = Debug|Any CPU
334+
{B5147169-E941-4CF8-9FCD-1C123ACD3149}.Release|Any CPU.ActiveCfg = Release|Any CPU
335+
{B5147169-E941-4CF8-9FCD-1C123ACD3149}.Release|Any CPU.Build.0 = Release|Any CPU
316336
EndGlobalSection
317337
GlobalSection(SolutionProperties) = preSolution
318338
HideSolutionNode = FALSE
@@ -363,7 +383,10 @@ Global
363383
{26435822-8938-48C9-96FD-0DCCF8F7CE00} = {6A776396-02B1-475D-A104-26940ADB04AB}
364384
{EA32E1E5-7E7D-44E6-B496-43E1FEDE9400} = {678D7B14-F8BC-4193-99AF-2EE8AA390A02}
365385
{64095857-E9E3-4D9C-8769-7E558CD757CB} = {6A776396-02B1-475D-A104-26940ADB04AB}
386+
{DFAC2769-4B67-4FBC-AD60-D93A39DD45AE} = {678D7B14-F8BC-4193-99AF-2EE8AA390A02}
366387
{136411AF-B9FA-438D-B790-9FB78A5F7F54} = {6A776396-02B1-475D-A104-26940ADB04AB}
388+
{CAE45AC9-F11B-4215-9D1A-C98BC0F1F687} = {6A776396-02B1-475D-A104-26940ADB04AB}
389+
{B5147169-E941-4CF8-9FCD-1C123ACD3149} = {814F9B31-4AF3-46CC-AD61-CEB40F47083A}
367390
EndGlobalSection
368391
GlobalSection(ExtensibilityGlobals) = postSolution
369392
SolutionGuid = {284A7AC3-FB43-4F1F-9C9C-2AF0E1F46C2B}

build.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ Invoke-BuildStep 'Set version metadata in AssemblyInfo.cs' { `
111111
"$PSScriptRoot\src\Validation.PackageSigning.ValidateCertificate\Properties\AssemblyInfo.g.cs",
112112
"$PSScriptRoot\src\Validation.PackageSigning.RevalidateCertificate\Properties\AssemblyInfo.g.cs",
113113
"$PSScriptRoot\src\NuGet.Jobs.Common\Properties\AssemblyInfo.g.cs",
114-
"$PSScriptRoot\src\Validation.Common.Job\Properties\AssemblyInfo.g.cs"
114+
"$PSScriptRoot\src\Validation.Common.Job\Properties\AssemblyInfo.g.cs",
115+
"$PSScriptRoot\src\Validation.ScanAndSign.Core\Properties\AssemblyInfo.g.cs",
116+
"$PSScriptRoot\src\PackageLagMonitor\Properties\AssemblyInfo.g.cs"
115117

116118
$versionMetadata | ForEach-Object {
117119
Set-VersionInfo -Path $_ -Version $SimpleVersion -Branch $Branch -Commit $CommitSHA
@@ -143,7 +145,8 @@ Invoke-BuildStep 'Creating artifacts' {
143145
# don't need to be shared, hence no need for symbols for them
144146
$ProjectsWithSymbols =
145147
"src/NuGet.Jobs.Common/NuGet.Jobs.Common.csproj",
146-
"src/Validation.Common.Job/Validation.Common.Job.csproj"
148+
"src/Validation.Common.Job/Validation.Common.Job.csproj",
149+
"src/Validation.ScanAndSign.Core/Validation.ScanAndSign.Core.csproj"
147150

148151
$Projects = `
149152
"src/Stats.CollectAzureCdnLogs/Stats.CollectAzureCdnLogs.csproj", `
@@ -167,7 +170,8 @@ Invoke-BuildStep 'Creating artifacts' {
167170
"src/Stats.CollectAzureChinaCDNLogs/Stats.CollectAzureChinaCDNLogs.csproj", `
168171
"src/Validation.PackageSigning.ProcessSignature/Validation.PackageSigning.ProcessSignature.csproj", `
169172
"src/Validation.PackageSigning.ValidateCertificate/Validation.PackageSigning.ValidateCertificate.csproj", `
170-
"src/Validation.PackageSigning.RevalidateCertificate/Validation.PackageSigning.RevalidateCertificate.csproj" `
173+
"src/Validation.PackageSigning.RevalidateCertificate/Validation.PackageSigning.RevalidateCertificate.csproj", `
174+
"src/PackageLagMonitor/Monitoring.PackageLag.csproj" `
171175
+ $ProjectsWithSymbols
172176

173177
Foreach ($Project in $Projects) {

src/Stats.CollectAzureCdnLogs/References/ICSharpCode.SharpZipLib.0.86.0/ICSharpCode.SharpZipLib.dll renamed to external/ICSharpCode.SharpZipLib.0.86.0/ICSharpCode.SharpZipLib.dll

File renamed without changes.

src/Stats.CollectAzureCdnLogs/References/ICSharpCode.SharpZipLib.0.86.0/license.md renamed to external/ICSharpCode.SharpZipLib.0.86.0/license.md

File renamed without changes.

src/Stats.CollectAzureCdnLogs/References/Readme.txt renamed to external/Readme.txt

File renamed without changes.

src/ArchivePackages/App.config

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,33 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
55
</startup>
66
<runtime>
77
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
88
<dependentAssembly>
9-
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
10-
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
9+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
10+
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
1111
</dependentAssembly>
1212
<dependentAssembly>
13-
<assemblyIdentity name="Microsoft.Azure.KeyVault" publicKeyToken="31bf3856ad364e35" culture="neutral" />
14-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
13+
<assemblyIdentity name="Microsoft.Azure.KeyVault" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
14+
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0"/>
1515
</dependentAssembly>
1616
<dependentAssembly>
17-
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform" publicKeyToken="31bf3856ad364e35" culture="neutral" />
18-
<bindingRedirect oldVersion="0.0.0.0-3.13.4.878" newVersion="3.13.4.878" />
17+
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
18+
<bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0"/>
1919
</dependentAssembly>
2020
<dependentAssembly>
21-
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
22-
<bindingRedirect oldVersion="0.0.0.0-3.13.4.878" newVersion="3.13.4.878" />
21+
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
22+
<bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0"/>
2323
</dependentAssembly>
2424
<dependentAssembly>
25-
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
26-
<bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
25+
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
26+
<bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0"/>
2727
</dependentAssembly>
2828
<dependentAssembly>
29-
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
30-
<bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
31-
</dependentAssembly>
32-
<dependentAssembly>
33-
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
34-
<bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
35-
</dependentAssembly>
36-
<dependentAssembly>
37-
<assemblyIdentity name="NuGet.Services.KeyVault" publicKeyToken="31bf3856ad364e35" culture="neutral" />
38-
<bindingRedirect oldVersion="0.0.0.0-2.2.3.0" newVersion="2.2.3.0" />
39-
</dependentAssembly>
40-
<dependentAssembly>
41-
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral" />
42-
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
29+
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
30+
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0"/>
4331
</dependentAssembly>
4432
</assemblyBinding>
4533
</runtime>

src/ArchivePackages/ArchivePackages.Job.cs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using Dapper;
5-
using Microsoft.WindowsAzure.Storage;
6-
using Microsoft.WindowsAzure.Storage.Blob;
7-
using Newtonsoft.Json.Linq;
84
using System;
95
using System.Collections.Generic;
10-
using System.Data.SqlClient;
11-
using System.Diagnostics;
6+
using System.ComponentModel.Design;
127
using System.Diagnostics.Tracing;
138
using System.Linq;
149
using System.Threading.Tasks;
10+
using Dapper;
11+
using Microsoft.WindowsAzure.Storage;
12+
using Microsoft.WindowsAzure.Storage.Blob;
13+
using Newtonsoft.Json.Linq;
1514
using NuGet.Jobs;
16-
using Microsoft.Extensions.Logging;
15+
using NuGet.Services.KeyVault;
16+
using NuGet.Services.Sql;
1717

1818
namespace ArchivePackages
1919
{
@@ -31,6 +31,7 @@ public class Job : JobBase
3131
/// Gets or sets an Azure Storage Uri referring to a container to use as the source for package blobs
3232
/// </summary>
3333
public CloudStorageAccount Source { get; set; }
34+
3435
public string SourceContainerName { get; set; }
3536

3637
/// <summary>
@@ -52,22 +53,22 @@ public class Job : JobBase
5253
/// Blob containing the cursor data. Cursor data comprises of cursorDateTime
5354
/// </summary>
5455
public string CursorBlobName { get; set; }
55-
56-
/// <summary>
57-
/// Gets or sets a connection string to the database containing package data.
58-
/// </summary>
59-
public SqlConnectionStringBuilder PackageDatabase { get; set; }
56+
57+
private ISqlConnectionFactory _packageDbConnectionFactory;
6058

6159
protected CloudBlobContainer SourceContainer { get; private set; }
60+
6261
protected CloudBlobContainer PrimaryDestinationContainer { get; private set; }
62+
6363
protected CloudBlobContainer SecondaryDestinationContainer { get; private set; }
6464

6565
public Job() : base(JobEventSource.Log) { }
6666

67-
public override void Init(IDictionary<string, string> jobArgsDictionary)
67+
public override void Init(IServiceContainer serviceContainer, IDictionary<string, string> jobArgsDictionary)
6868
{
69-
PackageDatabase = new SqlConnectionStringBuilder(
70-
JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.PackageDatabase));
69+
var secretInjector = (ISecretInjector)serviceContainer.GetService(typeof(ISecretInjector));
70+
var packageDbConnectionString = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.PackageDatabase);
71+
_packageDbConnectionFactory = new AzureSqlConnectionFactory(packageDbConnectionString, secretInjector);
7172

7273
Source = CloudStorageAccount.Parse(
7374
JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.Source));
@@ -91,9 +92,10 @@ public override void Init(IDictionary<string, string> jobArgsDictionary)
9192

9293
public override async Task Run()
9394
{
94-
JobEventSourceLog.PreparingToArchive(Source.Credentials.AccountName, SourceContainer.Name, PrimaryDestination.Credentials.AccountName, PrimaryDestinationContainer.Name, PackageDatabase.DataSource, PackageDatabase.InitialCatalog);
95+
JobEventSourceLog.PreparingToArchive(Source.Credentials.AccountName, SourceContainer.Name, PrimaryDestination.Credentials.AccountName, PrimaryDestinationContainer.Name, _packageDbConnectionFactory.DataSource, _packageDbConnectionFactory.InitialCatalog);
9596
await Archive(PrimaryDestinationContainer);
9697

98+
// todo: consider reusing package query for primary and secondary archives
9799
if (SecondaryDestinationContainer != null)
98100
{
99101
JobEventSourceLog.PreparingToArchive2(SecondaryDestination.Credentials.AccountName, SecondaryDestinationContainer.Name);
@@ -122,9 +124,9 @@ private async Task Archive(CloudBlobContainer destinationContainer)
122124

123125
JobEventSourceLog.CursorData(cursorDateTime.ToString(DateTimeFormatSpecifier));
124126

125-
JobEventSourceLog.GatheringPackagesToArchiveFromDb(PackageDatabase.DataSource, PackageDatabase.InitialCatalog);
127+
JobEventSourceLog.GatheringPackagesToArchiveFromDb(_packageDbConnectionFactory.DataSource, _packageDbConnectionFactory.InitialCatalog);
126128
List<PackageRef> packages;
127-
using (var connection = await PackageDatabase.ConnectTo())
129+
using (var connection = await _packageDbConnectionFactory.CreateAsync())
128130
{
129131
packages = (await connection.QueryAsync<PackageRef>(@"
130132
SELECT pr.Id, p.NormalizedVersion AS Version, p.Hash, p.LastEdited, p.Published
@@ -133,7 +135,7 @@ FROM Packages p
133135
WHERE Published > @cursorDateTime OR LastEdited > @cursorDateTime", new { cursorDateTime = cursorDateTime }))
134136
.ToList();
135137
}
136-
JobEventSourceLog.GatheredPackagesToArchiveFromDb(packages.Count, PackageDatabase.DataSource, PackageDatabase.InitialCatalog);
138+
JobEventSourceLog.GatheredPackagesToArchiveFromDb(packages.Count, _packageDbConnectionFactory.DataSource, _packageDbConnectionFactory.InitialCatalog);
137139

138140
var archiveSet = packages
139141
.AsParallel()

0 commit comments

Comments
 (0)