diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index 81096db09dcd64073f47f91d82801a961b5fcaa7..5e3125dab491cad5e63b8445084d377ad70372f2 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -1346,4 +1346,4 @@ <BaselinePackageReference Include="Microsoft.AspNetCore.DataProtection.Extensions" Version="[2.2.0, )" /> <BaselinePackageReference Include="Microsoft.Owin.Security" Version="[3.0.1, )" /> </ItemGroup> -</Project> \ No newline at end of file +</Project> diff --git a/eng/Baseline.xml b/eng/Baseline.xml index 07e02653d472f7d2a3df98e33e3319964a68f314..2e4369b27264f0bc8b28ebc3e14215a3d32bf95b 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -1,4 +1,4 @@ -<!-- +<!-- This file contains a list of all the packages and their versions which were released in the last servicing build of ASP.NET Core 2.2.x. Update this list when preparing for a new patch. diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index 8dab2675a7a4ea3254be4950a609c5a40ffd8f6e..e10a485b9909a336b5b291ac208342bfd9ccb820 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -71,5 +71,4 @@ Later on, this will be checked using this condition: Microsoft.AspNetCore.Mvc.Api.Analyzers; </PackagesInPatch> </PropertyGroup> - </Project> diff --git a/eng/tools/BaselineGenerator/Program.cs b/eng/tools/BaselineGenerator/Program.cs index b8089832f08b07cfea890f7261d75589a6587821..f8ea164d53ee1112a780f43170337583dcf19040 100644 --- a/eng/tools/BaselineGenerator/Program.cs +++ b/eng/tools/BaselineGenerator/Program.cs @@ -61,7 +61,11 @@ namespace PackageBaselineGenerator var sourceRepository = new SourceRepository(packageSource, providers); if (_update.HasValue()) { - return await RunUpdateAsync(inputPath, input, sourceRepository); + var updateResult = await RunUpdateAsync(inputPath, input, sourceRepository); + if (updateResult != 0) + { + return updateResult; + } } var feedType = await sourceRepository.GetFeedType(CancellationToken.None); diff --git a/eng/tools/BaselineGenerator/README.md b/eng/tools/BaselineGenerator/README.md index fa3e4e0bda317c1bcb95ea3ac488884ff03dbd44..4a77247a38429db3bb9b977059c8ca1147fc73fc 100644 --- a/eng/tools/BaselineGenerator/README.md +++ b/eng/tools/BaselineGenerator/README.md @@ -8,8 +8,8 @@ Add `--package-source {source}` to the commands below if the packages of interes ### Auto-update -1. Run `dotnet run --update` in this project folder. -2. Run `dotnet run` in this project. +Run `dotnet run --update` in this project folder. This will attempt to find the latest patch version of packages and +update the baseline file. ### Manual update diff --git a/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.11.txt b/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.11.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.11.txt @@ -0,0 +1 @@ + diff --git a/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.11.txt b/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.11.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.11.txt @@ -0,0 +1 @@ + diff --git a/src/PackageArchive/ZipManifestGenerator/Program.cs b/src/PackageArchive/ZipManifestGenerator/Program.cs index 883d21b7c4923514be3cc657cfe03077495e1186..649a2631dbb8528620b9a9c4207576ebe7f759fb 100644 --- a/src/PackageArchive/ZipManifestGenerator/Program.cs +++ b/src/PackageArchive/ZipManifestGenerator/Program.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.IO.Compression; using System.Linq; +using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -21,6 +22,8 @@ Usage: <ZIP> <OUTPUT> <OUTPUT> The output file path for the ZIP manifest file."); } + private const int ZipDoesNotExist = 404; + public static async Task<int> Main(string[] args) { if (args.Length != 2) @@ -42,6 +45,13 @@ Usage: <ZIP> <OUTPUT> Console.WriteLine($"log: Downloading {url}"); zipPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".zip"); var response = await new HttpClient().GetAsync(url); + + if (response.StatusCode == HttpStatusCode.NotFound) + { + Console.Error.WriteLine($"Could not find {url}."); + return ZipDoesNotExist; + } + response.EnsureSuccessStatusCode(); using (var outStream = File.Create(zipPath)) diff --git a/src/PackageArchive/ZipManifestGenerator/README.md b/src/PackageArchive/ZipManifestGenerator/README.md index f5bbe7d3b2f8a4ba0e196bafdef6cf1c21265511..441b96ebba76c1e5c839a39015855baad3e2efc8 100644 --- a/src/PackageArchive/ZipManifestGenerator/README.md +++ b/src/PackageArchive/ZipManifestGenerator/README.md @@ -13,21 +13,10 @@ Usage: <ZIP> <OUTPUT> Example: dotnet run ./archive.zip files.txt ``` -## Example for servicing updates +## Servicing updates -To generate a new manifest for the incremental CI server package caches, you would run +For convenience, this folder contains [./UpdateBaselines.ps1](./UpdateBaselines.ps1) to update +the baselines from the last patch release. -```ps1 -$ProdConBuild='20180919-01' -$Version='2.2.1' - -$patchUrl = "https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-2/${ProdconBuild}/final/assets/aspnetcore/Runtime/${Version}/nuGetPackagesArchive-ci-server-${Version}.patch.zip" - -dotnet run $patchUrl "../Archive.CiServer.Patch/ArchiveBaseline.${Version}.txt" - -$compatPatchUrl = "https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-2/${ProdconBuild}/final/assets/aspnetcore/Runtime/${Version}/nuGetPackagesArchive-ci-server-compat-${Version}.patch.zip" - -dotnet run $compatPatchUrl "../Archive.CiServer.Patch.Compat/ArchiveBaseline.${Version}.txt" -``` - -For convenience, this folder contains [./UpdateBaselines.ps1](./UpdateBaselines.ps1) to run these steps. +Using version.props to figure out the last version, this script reads the build manifests from https://github.com/dotnet/versions/tree/master/build-info/dotnet/product/cli/release and +invokes the manifest generator diff --git a/src/PackageArchive/ZipManifestGenerator/UpdateBaselines.ps1 b/src/PackageArchive/ZipManifestGenerator/UpdateBaselines.ps1 index d129443473b63865cfea25295dfc277c2a6849ee..9e0481e40e18559a5dbe5b19ca9e0cc2d49566ed 100644 --- a/src/PackageArchive/ZipManifestGenerator/UpdateBaselines.ps1 +++ b/src/PackageArchive/ZipManifestGenerator/UpdateBaselines.ps1 @@ -1,15 +1,40 @@ -param( - [Parameter(Mandatory = $true)] - $ProdConBuildId, - [Parameter(Mandatory = $true)] - $ProductVersion, - $FeedContainer = 'orchestrated-release-2-2' -) +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' -$patchUrl = "https://dotnetfeed.blob.core.windows.net/${FeedContainer}/${ProdconBuildId}/final/assets/aspnetcore/Runtime/${ProductVersion}/nuGetPackagesArchive-ci-server-${ProductVersion}.patch.zip" +Push-Location $PSScriptRoot +try { -dotnet run $patchUrl "../Archive.CiServer.Patch/ArchiveBaseline.${ProductVersion}.txt" + [xml]$versionProps = Get-Content "$PSScriptRoot/../../../version.props" + $LastVersion = "$($versionProps.Project.PropertyGroup.AspNetCoreMajorVersion).$($versionProps.Project.PropertyGroup.AspNetCoreMinorVersion).$($versionProps.Project.PropertyGroup.AspNetCorePatchVersion - 1)" + $manifestUrl = "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/product/cli/release/$LastVersion/build.xml" + $buildXml = Invoke-RestMethod -Method GET $manifestUrl + $feedUrl = $buildXml.OrchestratedBuild.Endpoint.Url + $baseFeedUrl = $feedUrl -replace 'final/index.json','' -$compatPatchUrl = "https://dotnetfeed.blob.core.windows.net/${FeedContainer}/${ProdconBuildId}/final/assets/aspnetcore/Runtime/${ProductVersion}/nuGetPackagesArchive-ci-server-compat-${ProductVersion}.patch.zip" + Write-Host "Last patch version = $LastVersion" + Write-Host "BaseURL = $baseFeedUrl" -dotnet run $compatPatchUrl "../Archive.CiServer.Patch.Compat/ArchiveBaseline.${ProductVersion}.txt" + function CreateBaseLineFromZip($url, $filePath) { + dotnet run $url $filePath + + if ($lastexitcode -eq 404) { + Write-Host -f Yellow "It appears there was no patch zip in the last release, so creating an empty baseline file in $filePath." + Set-Content -path $filePath '' + } + elseif($lastexitcode -ne 0) { + Write-Error "ZipGenerator failed" + exit 1 + } + } + + CreateBaseLineFromZip ` + "$baseFeedUrl/final/assets/aspnetcore/Runtime/${LastVersion}/nuGetPackagesArchive-ci-server-${LastVersion}.patch.zip" ` + "../Archive.CiServer.Patch/ArchiveBaseline.${LastVersion}.txt" + + CreateBaseLineFromZip ` + "$baseFeedUrl/final/assets/aspnetcore/Runtime/${LastVersion}/nuGetPackagesArchive-ci-server-compat-${LastVersion}.patch.zip" ` + "../Archive.CiServer.Patch.Compat/ArchiveBaseline.${LastVersion}.txt" +} +finally { + Pop-Location +}