From c3989f8477bef6e918d6cfe351254ae4c80fc0d3 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 12 Jun 2018 15:29:54 -0700 Subject: [PATCH 1/5] Update to .NET Core App 2.0.9-servicing-26612-03 --- build/dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index 2f7c7bc9d6..9be003b2a1 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -31,7 +31,7 @@ 5.2.0 1.0.11 1.1.8 - 2.0.8-servicing-26407-02 + 2.0.9-servicing-26612-03 1.0.1 15.3.0 3.0.1 From aa91b802f9cc2b4f2cf98a78065bdbe663cd2963 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 13 Jun 2018 12:22:20 -0700 Subject: [PATCH 2/5] Add script used to deploy blobs to Azure storage --- .gitignore | 2 + build/RuntimeStoreInstaller.targets | 6 +- scripts/UploadBlobs.ps1 | 142 ++++++++++++++++++++++++++++ scripts/common.psm1 | 5 +- 4 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 scripts/UploadBlobs.ps1 diff --git a/.gitignore b/.gitignore index aa0331923d..20b8ed6e52 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ node_modules .deps global.json msbuild.ProjectImports.zip +.dotnet/ +.tools/ diff --git a/build/RuntimeStoreInstaller.targets b/build/RuntimeStoreInstaller.targets index eaece814e9..6c23daf81c 100644 --- a/build/RuntimeStoreInstaller.targets +++ b/build/RuntimeStoreInstaller.targets @@ -31,7 +31,11 @@ $(TimestampFreeRSArchivePrefix)linux-x64.patch.tar.gz - + + + + + diff --git a/scripts/UploadBlobs.ps1 b/scripts/UploadBlobs.ps1 new file mode 100644 index 0000000000..b60d4886ca --- /dev/null +++ b/scripts/UploadBlobs.ps1 @@ -0,0 +1,142 @@ +<# +.SYNOPSIS +Deploys a build to an Azure blob store + +.PARAMETER AccountName +The account name for the Azure account + +.PARAMETER AccountKey +The account key for the Azure account + +.PARAMETER BuildNumber +The build number of the current build + +.PARAMETER BaseFeedUrl +The base URI of the package feed (may be different than blobBaseUrl for private-only blobs) + +.PARAMETER ContainerName +The container name. Defaults to 'dotnet' + +.PARAMETER ArtifactsPath +The path to the build outputs +#> +[CmdletBinding(SupportsShouldProcess = $true)] +param( + [Parameter(Mandatory = $true)] + $AccountName, + [Parameter(Mandatory = $true)] + $AccountKey, + [Parameter(Mandatory = $true)] + $BuildNumber, + [Parameter(Mandatory = $true)] + $ArtifactsPath, + $BaseBlobFeedUrl, + $ContainerName = 'dotnet' +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 1 + +Import-Module -Scope Local "$PSScriptRoot/common.psm1" + +if (!(Get-Command 'az' -ErrorAction Ignore)) { + Write-Error 'Missing required command: az. Please install the Azure CLI and ensure it is available on PATH.' +} + +$repoRoot = Resolve-Path "$PSScriptRoot/.." + +$sleetVersion = '2.3.25' +$sleet = "$repoRoot/.tools/sleet.$sleetVersion/tools/sleet.exe" + +if (-not (Test-Path $sleet)) { + mkdir "$repoRoot/.tools/sleet.$sleetVersion" -ErrorAction Ignore | Out-Null + $installScriptPath = "$repoRoot/.dotnet/dotnet-install.ps1" + Invoke-WebRequest -UseBasicParsing -OutFile "$repoRoot/.tools/sleet.$sleetVersion.zip" https://www.nuget.org/api/v2/package/Sleet/$sleetVersion + Expand-Archive "$repoRoot/.tools/sleet.$sleetVersion.zip" -DestinationPath "$repoRoot/.tools/sleet.$sleetVersion" +} + +[xml] $versionProps = Get-Content "$repoRoot/version.props" +$props = $versionProps.Project.PropertyGroup +$VersionPrefix = "$($props.AspNetCoreMajorVersion).$($props.AspNetCoreMinorVersion).$($props.AspNetCorePatchVersion)" + +$blobFolder = "$ContainerName/aspnetcore/store/$VersionPrefix-$BuildNumber" +$packagesFolder = "$blobFolder/packages/" + +$blobBaseUrl = "https://$AccountName.blob.core.windows.net/$blobFolder" +$packageBlobUrl = "https://$AccountName.blob.core.windows.net/$packagesFolder" + +if (-not $BaseBlobFeedUrl) { + $BaseBlobFeedUrl = "https://$AccountName.blob.core.windows.net/$packagesFolder" +} + +$packageGlobPath = "$ArtifactsPath/packages/**/*.nupkg" +$globs = ( + @{ + basePath = "$ArtifactsPath/lzma" + pattern = "*" + destination = $blobFolder + }, + @{ + basePath = "$ArtifactsPath/installers" + pattern = "*" + destination = $blobFolder + }) + +$sleetConfigObj = @{ + sources = @( + @{ + name = "feed" + type = "azure" + path = $packageBlobUrl + baseURI = $BaseBlobFeedUrl + container = $ContainerName + connectionString = "DefaultEndpointsProtocol=https;AccountName=$AccountName;AccountKey=$AccountKey" + }) +} + +$sleetConfig = "$repoRoot/.tools/sleet.json" +$sleetConfigObj | ConvertTo-Json | Set-Content -Path $sleetConfig -Encoding Ascii +if ($PSCmdlet.ShouldProcess("Initialize remote feed in $packageBlobUrl")) { + Invoke-Block { & $sleet init --config $sleetConfig --verbose } +} + +Get-ChildItem -Recurse $packageGlobPath ` + | split-path -parent ` + | select -Unique ` + | % { + if ($PSCmdlet.ShouldProcess("Push packages in $_ to $packageBlobUrl")) { + Invoke-Block { & $sleet push --verbose --config $sleetConfig --source feed --force $_ } + } +} + +[string[]] $otherArgs = @() + +if ($VerbosePreference) { + $otherArgs += '--verbose' +} + +if ($WhatIfPreference) { + $otherArgs += '--dryrun' +} + +$globs | ForEach-Object { + $pattern = $_.pattern + $basePath = $_.basePath + $destination = $_.destination + if (!(Get-ChildItem -Recurse "$basePath/$pattern" -ErrorAction Ignore)) { + Write-Warning "Expected files in $basePath/$pattern but found none" + } + + Invoke-Block { & az storage blob upload-batch ` + --account-name $AccountName ` + --account-key $AccountKey ` + --verbose ` + --pattern $pattern ` + --destination $destination.TrimEnd('/') ` + --source $basePath ` + --no-progress ` + @otherArgs + } +} + +Write-Host -f green "Done!" diff --git a/scripts/common.psm1 b/scripts/common.psm1 index b621d48193..a6f8e19e40 100644 --- a/scripts/common.psm1 +++ b/scripts/common.psm1 @@ -15,7 +15,10 @@ function Invoke-Block([scriptblock]$cmd) { # - $?: did the powershell script block throw an error # - $lastexitcode: did a windows command executed by the script block end in error if ((-not $?) -or ($lastexitcode -ne 0)) { - Write-Warning $error[0] + if ($error -ne $null) + { + Write-Warning $error[0] + } throw "Command failed to execute: $cmd" } } From 93f2e99d401cc4a9b3deeca1d569ee986c70e8cc Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 14 Jun 2018 09:34:07 -0700 Subject: [PATCH 3/5] Fix for uploading blobs to private Azure blob containers --- scripts/UploadBlobs.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/UploadBlobs.ps1 b/scripts/UploadBlobs.ps1 index b60d4886ca..be0bdab8d3 100644 --- a/scripts/UploadBlobs.ps1 +++ b/scripts/UploadBlobs.ps1 @@ -68,6 +68,9 @@ $packageBlobUrl = "https://$AccountName.blob.core.windows.net/$packagesFolder" if (-not $BaseBlobFeedUrl) { $BaseBlobFeedUrl = "https://$AccountName.blob.core.windows.net/$packagesFolder" } +else { + $BaseBlobFeedUrl = "$BaseBlobFeedUrl/$packagesFolder" +} $packageGlobPath = "$ArtifactsPath/packages/**/*.nupkg" $globs = ( From 1895502c4876384a10c73519ece033dd0722cf26 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 2 Jul 2018 16:45:20 -0700 Subject: [PATCH 4/5] Update the LZMA to include NETStandard.Library 2.0.3 --- build/PackageArchive.targets | 6 ++++++ build/dependencies.props | 2 +- .../templates/Archive/Archive.Library.csproj | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 build/tools/templates/Archive/Archive.Library.csproj diff --git a/build/PackageArchive.targets b/build/PackageArchive.targets index 6cf6f3ad83..2c6c13298b 100644 --- a/build/PackageArchive.targets +++ b/build/PackageArchive.targets @@ -73,6 +73,12 @@ Targets="Restore" Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp20PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" /> + + + diff --git a/build/dependencies.props b/build/dependencies.props index 9be003b2a1..dd9c568763 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -49,7 +49,7 @@ 1.4.0 4.4.0 4.7.49 - 2.0.1 + 2.0.3 1.0.1 10.0.1 4.0.0 diff --git a/build/tools/templates/Archive/Archive.Library.csproj b/build/tools/templates/Archive/Archive.Library.csproj new file mode 100644 index 0000000000..20e1d88940 --- /dev/null +++ b/build/tools/templates/Archive/Archive.Library.csproj @@ -0,0 +1,17 @@ + + + + + + netstandard2.0 + false + true + true + $(RestoreSources);$(DotNetRestoreSources); + + + + + + + From cc0e0394acd1d13fb5769c3c8f8ec895893b39c4 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Mon, 2 Jul 2018 18:09:28 -0700 Subject: [PATCH 5/5] Add required infrastructure improvements to submodules to support NETStandard.Library 2.0.3 --- modules/Common | 2 +- modules/DependencyInjection | 2 +- modules/JsonPatch | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Common b/modules/Common index 007f386436..02961cb7ab 160000 --- a/modules/Common +++ b/modules/Common @@ -1 +1 @@ -Subproject commit 007f3864365947058b7ab95d605a44892b06eed9 +Subproject commit 02961cb7ab403d79eda23c28c5ddf9b37df9e845 diff --git a/modules/DependencyInjection b/modules/DependencyInjection index cd2269792e..9597260380 160000 --- a/modules/DependencyInjection +++ b/modules/DependencyInjection @@ -1 +1 @@ -Subproject commit cd2269792e5ec2ced8a7fe475236fde836663aa1 +Subproject commit 959726038020685ca6bb646d6f99c1051ea70e8a diff --git a/modules/JsonPatch b/modules/JsonPatch index 8580d8beb5..a5253a577b 160000 --- a/modules/JsonPatch +++ b/modules/JsonPatch @@ -1 +1 @@ -Subproject commit 8580d8beb5c9ca94e09455f2dac1d1587767478e +Subproject commit a5253a577b4cdf5daa1250f0b4d06b083d36679a