Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #376 from NuGet/dev
Browse files Browse the repository at this point in the history
[ReleasePrep][2018.10.22]FI of master into dev
  • Loading branch information
loic-sharma authored Oct 23, 2018
2 parents d8cb87d + 9148c77 commit 747b0aa
Show file tree
Hide file tree
Showing 29 changed files with 595 additions and 45 deletions.
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ param (
[string]$SemanticVersion = '1.0.0-zlocal',
[string]$Branch,
[string]$CommitSHA,
[string]$BuildBranch = 'cb604c2cd1b2f7f71fb574cdda4c83ddb1464cc7'
[string]$BuildBranch = '8864814f1b128b6fd621e9a73430b71dc2c62e38'
)

# For TeamCity - If any issue occurs, this script fails the build. - By default, TeamCity returns an exit code of 0 for all powershell scripts, even if they fail
Expand Down
2 changes: 1 addition & 1 deletion src/Catalog/NuGet.Services.Metadata.Catalog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Packaging.Core">
<Version>4.3.0</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Logging">
<Version>2.25.0-master-30088</Version>
Expand Down
9 changes: 7 additions & 2 deletions src/Ng/Jobs/MonitoringProcessorJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ protected override void Init(IDictionary<string, string> arguments, Cancellation
{
var gallery = arguments.GetOrThrow<string>(Arguments.Gallery);
var index = arguments.GetOrThrow<string>(Arguments.Index);
var packageBaseAddress = arguments.GetOrThrow<string>(Arguments.ContentBaseAddress);
var source = arguments.GetOrThrow<string>(Arguments.Source);
var requireSignature = arguments.GetOrDefault(Arguments.RequireSignature, false);
var verbose = arguments.GetOrDefault(Arguments.Verbose, false);
Expand All @@ -59,7 +60,7 @@ protected override void Init(IDictionary<string, string> arguments, Cancellation
gallery, index, monitoringStorageFactory, auditingStorageFactory, string.Join(", ", endpointInputs.Select(e => e.Name)));

_packageValidator = new PackageValidatorFactory(LoggerFactory)
.Create(gallery, index, auditingStorageFactory, endpointInputs, messageHandlerFactory, requireSignature, verbose);
.Create(gallery, index, packageBaseAddress, auditingStorageFactory, endpointInputs, messageHandlerFactory, requireSignature, verbose);

_queue = CommandHelpers.CreateStorageQueue<PackageValidatorContext>(arguments, PackageValidatorContext.Version);

Expand Down Expand Up @@ -174,7 +175,11 @@ private async Task<IEnumerable<CatalogIndexEntry>> FetchCatalogIndexEntriesFromR
{
var id = feedPackage.Id;
var version = NuGetVersion.Parse(feedPackage.Version);
var leafBlob = await _regResource.GetPackageMetadata(new PackageIdentity(id, version), Logger.AsCommon(), token);
var leafBlob = await _regResource.GetPackageMetadata(
new PackageIdentity(id, version),
NullSourceCacheContext.Instance,
Logger.AsCommon(),
token);

if (leafBlob == null)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Ng/Ng.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Security" />
Expand Down Expand Up @@ -169,7 +168,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Protocol">
<Version>4.3.0</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Configuration">
<Version>2.2.2</Version>
Expand Down
1 change: 1 addition & 0 deletions src/Ng/Scripts/MonitoringProcessor.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ start /w .\Ng.exe monitoringprocessor ^
-requireSignature #{Jobs.endpointmonitoring.RequireSignature} ^
-index #{Jobs.common.v3.index} ^
-gallery #{Jobs.common.v3.f2c.Gallery} ^
-contentBaseAddress #{Jobs.endpointmonitoring.ContentBaseAddress} ^
-endpointsToTest "#{Jobs.endpointmonitoring.EndpointsToTest}" ^
-statusFolder #{Jobs.endpointmonitoring.StatusFolder} ^
-storageType azure ^
Expand Down
23 changes: 23 additions & 0 deletions src/NuGet.Indexing/Extraction/CatalogPackageReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using NuGet.Common;
using NuGet.Frameworks;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Packaging.Signing;

namespace NuGet.Indexing
{
Expand Down Expand Up @@ -64,5 +67,25 @@ protected override void Dispose(bool disposing)
_catalogNuspecReader.Dispose();
}
}

public override Task<PrimarySignature> GetPrimarySignatureAsync(CancellationToken token)
{
throw new NotImplementedException();
}

public override Task<bool> IsSignedAsync(CancellationToken token)
{
throw new NotImplementedException();
}

public override Task ValidateIntegrityAsync(SignatureContent signatureContent, CancellationToken token)
{
throw new NotImplementedException();
}

public override Task<byte[]> GetArchiveHashAsync(HashAlgorithmName hashAlgorithm, CancellationToken token)
{
throw new NotImplementedException();
}
}
}
7 changes: 3 additions & 4 deletions src/NuGet.Indexing/NuGet.Indexing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Services.Client" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Xml.Linq" />
Expand Down Expand Up @@ -177,21 +176,21 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging">
<Version>1.0.0</Version>
<Version>1.1.2</Version>
</PackageReference>
<PackageReference Include="NuGet.Build.Tasks.Pack">
<Version>4.8.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Packaging">
<Version>4.3.0</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Configuration">
<Version>2.2.2</Version>
</PackageReference>
<PackageReference Include="NuGetGallery.Core">
<Version>2.1.1</Version>
<Version>4.4.4-master-41290</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.3</Version>
Expand Down
32 changes: 24 additions & 8 deletions src/NuGet.Services.BasicSearch/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="ADB9793829DDAE60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.1.2.0" newVersion="1.1.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="B77A5C561934E089" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="ADB9793829DDAE60" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.1.2.0" newVersion="1.1.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-8.2.1.0" newVersion="8.2.1.0"/>
Expand All @@ -85,43 +101,43 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Serilog" publicKeyToken="24C2F752A8E58A10" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NuGet.Versioning" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.5" newVersion="4.3.0.5"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NuGet.Packaging.Core" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.5" newVersion="4.3.0.5"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NuGet.Packaging" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.5" newVersion="4.3.0.5"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NuGet.Frameworks" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.5" newVersion="4.3.0.5"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<Compile Include="Model\PackageRegistrationLeafMetadata.cs" />
<Compile Include="Model\PackageTimestampMetadata.cs" />
<Compile Include="Notification\IMonitoringNotificationService.cs" />
<Compile Include="Providers\PackageBaseAddressResourceProvider.cs" />
<Compile Include="Resources\PackageBaseAddressResource.cs" />
<Compile Include="Status\IPackageMonitoringStatusService.cs" />
<Compile Include="Notification\LoggerMonitoringNotificationService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down Expand Up @@ -100,6 +102,9 @@
<Compile Include="Validation\Test\Exceptions\MissingPackageSignatureFileException.cs" />
<Compile Include="Validation\Test\Exceptions\TimestampComparisonException.cs" />
<Compile Include="Validation\Test\Exceptions\ValidationException.cs" />
<Compile Include="Validation\Test\FlatContainer\FlatContainerValidator.cs" />
<Compile Include="Validation\Test\FlatContainer\PackageIsRepositorySignedValidator.cs" />
<Compile Include="Validation\Test\Exceptions\MissingRepositorySignatureException.cs" />
<Compile Include="Validation\Test\IAggregateValidator.cs" />
<Compile Include="Validation\Test\IValidator.cs" />
<Compile Include="Validation\Test\IValidatorIdentity.cs" />
Expand Down Expand Up @@ -135,7 +140,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Protocol">
<Version>4.3.0</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Storage">
<Version>2.25.0-sb-queuesize-32353</Version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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.

using System;
using System.Threading;
using System.Threading.Tasks;
using NuGet.Protocol.Core.Types;

namespace NuGet.Services.Metadata.Catalog.Monitoring
{
/// <summary>
/// The resource provider that creates instances of <see cref="PackageBaseAddressResource"/>.
/// </summary>
public class PackageBaseAddressResourceProvider : ResourceProvider
{
private readonly string _packageBaseAddress;

public PackageBaseAddressResourceProvider(string packageBaseAddress) :
base(typeof(PackageBaseAddressResource))
{
if (string.IsNullOrEmpty(packageBaseAddress))
{
throw new ArgumentException("Package base address is required", nameof(packageBaseAddress));
}

_packageBaseAddress = packageBaseAddress;
}

public override Task<Tuple<bool, INuGetResource>> TryCreate(SourceRepository source, CancellationToken token)
{
return Task.FromResult(new Tuple<bool, INuGetResource>(true, new PackageBaseAddressResource(_packageBaseAddress)));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.

using System;
using NuGet.Protocol.Core.Types;

namespace NuGet.Services.Metadata.Catalog.Monitoring
{
/// <summary>
/// Gets the base URL for the Package Content resource. For more information,
/// see: https://docs.microsoft.com/en-us/nuget/api/package-base-address-resource
/// </summary>
public class PackageBaseAddressResource : INuGetResource
{
public PackageBaseAddressResource(string packageBaseAddress)
{
if (string.IsNullOrEmpty(packageBaseAddress))
{
throw new ArgumentException("Package base address is required", nameof(packageBaseAddress));
}

PackageBaseAddress = packageBaseAddress.TrimEnd('/');
}

/// <summary>
/// The base URL for the Package Content resource.
/// </summary>
public string PackageBaseAddress { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using NuGet.Common;
using NuGet.Packaging.Core;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;

namespace NuGet.Services.Metadata.Catalog.Monitoring
{
Expand Down Expand Up @@ -56,14 +57,14 @@ public async Task<PackageRegistrationLeafMetadata> GetLeafAsync(PackageIdentity
private async Task<V2FeedPackageInfo> GetPackageFromIndexAsync(PackageIdentity package, ILogger log, CancellationToken token)
{
// If the package is missing from FindPackagesById, this will return null.
var feedPackages = await _feedParser.FindPackagesByIdAsync(package.Id, log, token);
var feedPackages = await _feedParser.FindPackagesByIdAsync(package.Id, NullSourceCacheContext.Instance, log, token);
return feedPackages.FirstOrDefault(p => p.Version == package.Version);
}

private Task<V2FeedPackageInfo> GetPackageFromLeafAsync(PackageIdentity package, ILogger log, CancellationToken token)
{
// If the package is missing from Packages(Id='...',Version='...'), this will return null.
return _feedParser.GetPackage(package, log, token);
return _feedParser.GetPackage(package, NullSourceCacheContext.Instance, log, token);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using NuGet.Common;
using NuGet.Packaging.Core;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;

namespace NuGet.Services.Metadata.Catalog.Monitoring
{
Expand Down Expand Up @@ -58,7 +59,7 @@ public async Task<PackageRegistrationLeafMetadata> GetLeafAsync(PackageIdentity
private Task<JObject> GetPackageFromIndexAsync(PackageIdentity package, ILogger log, CancellationToken token)
{
// If the registration index is missing, this will return null.
return _registration.GetPackageMetadata(package, log, token);
return _registration.GetPackageMetadata(package, NullSourceCacheContext.Instance, log, token);
}

private async Task<JObject> GetPackageFromLeafAsync(PackageIdentity package, ILogger log, CancellationToken token)
Expand Down
Loading

0 comments on commit 747b0aa

Please sign in to comment.