From 3010fc4f8fe1f643f52447f34f1e6e4d4758ccb4 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Mon, 22 Feb 2021 18:22:53 -0800 Subject: [PATCH 01/11] use the latest sdk --- build/config.props | 18 +----------------- eng/pipelines/templates/Initialize_Build.yml | 10 ---------- global.json | 7 ------- scripts/cibuild/ConfigureVstsBuild.ps1 | 6 ------ 4 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 global.json diff --git a/build/config.props b/build/config.props index 0e2b269b614..6b9f52d037f 100644 --- a/build/config.props +++ b/build/config.props @@ -32,17 +32,7 @@ rel/d$(VsTargetMajorVersion).$(MinorNuGetVersion) int.d$(VsTargetMajorVersion).$(MinorNuGetVersion) - - - - true - - master 5.0.100 - "master 5.0.100" - $(OverrideCliBranchForTesting) - master - $(OverrideCliTargetBranches) - master + 5.0.3xx @@ -82,13 +72,7 @@ - - - - - - diff --git a/eng/pipelines/templates/Initialize_Build.yml b/eng/pipelines/templates/Initialize_Build.yml index 72afd273de2..66af1d348f5 100644 --- a/eng/pipelines/templates/Initialize_Build.yml +++ b/eng/pipelines/templates/Initialize_Build.yml @@ -51,16 +51,6 @@ steps: exit 1 } -- task: PowerShell@1 - displayName: "Get SDK Version For Build" - name: "getSDKVersionForBuild" - inputs: - scriptType: "inlineScript" - inlineScript: | - $msbuildExe = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin\msbuild.exe' - $SDKVersionForBuild = & $msbuildExe $env:BUILD_REPOSITORY_LOCALPATH\build\config.props /v:m /nologo /t:GetCliVersionForBuilding - Write-Host "##vso[task.setvariable variable=SDKVersionForBuild;isOutput=true]$SDKVersionForBuild" - - task: PowerShell@1 displayName: "Add Build Tags" inputs: diff --git a/global.json b/global.json deleted file mode 100644 index c6b29a36977..00000000000 --- a/global.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sdk": { - "version": "5.0.100-preview", - "allowPrerelease": true, - "rollForward": "major" - } -} diff --git a/scripts/cibuild/ConfigureVstsBuild.ps1 b/scripts/cibuild/ConfigureVstsBuild.ps1 index f087f6210ae..89a910b8384 100644 --- a/scripts/cibuild/ConfigureVstsBuild.ps1 +++ b/scripts/cibuild/ConfigureVstsBuild.ps1 @@ -118,9 +118,6 @@ else { $newBuildCounter = $env:BUILD_BUILDNUMBER $VsTargetBranch = & $msbuildExe $env:BUILD_REPOSITORY_LOCALPATH\build\config.props /v:m /nologo /t:GetVsTargetBranch - $CliTargetBranches = & $msbuildExe $env:BUILD_REPOSITORY_LOCALPATH\build\config.props /v:m /nologo /t:GetCliTargetBranches - $SdkTargetBranches = & $msbuildExe $env:BUILD_REPOSITORY_LOCALPATH\build\config.props /v:m /nologo /t:GetSdkTargetBranches - $ToolsetTargetBranches = & $msbuildExe $env:BUILD_REPOSITORY_LOCALPATH\build\config.props /v:m /nologo /t:GetToolsetTargetBranches Write-Host $VsTargetBranch $jsonRepresentation = @{ BuildNumber = $newBuildCounter @@ -129,9 +126,6 @@ else LocalizationRepositoryBranch = $NuGetLocalizationRepoBranch LocalizationRepositoryCommitHash = $LocalizationRepoCommitHash VsTargetBranch = $VsTargetBranch.Trim() - CliTargetBranches = $CliTargetBranches.Trim() - SdkTargetBranches = $SdkTargetBranches.Trim() - ToolsetTargetBranches = $ToolsetTargetBranches.Trim() } # First create the file locally so that we can laster publish it as a build artifact from a local source file instead of a remote source file. From 90934be17612d2349f4d6a830cd336452d2770c1 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Mon, 22 Feb 2021 19:42:47 -0800 Subject: [PATCH 02/11] Use latest sdk --- build/common.ps1 | 21 +- build/config.props | 2 +- scripts/utils/InsertNuGetIntoSdkAndCli.ps1 | 240 --------------------- 3 files changed, 18 insertions(+), 245 deletions(-) delete mode 100644 scripts/utils/InsertNuGetIntoSdkAndCli.ps1 diff --git a/build/common.ps1 b/build/common.ps1 index e33dc49ddc3..04689d11262 100644 --- a/build/common.ps1 +++ b/build/common.ps1 @@ -160,17 +160,17 @@ Function Install-DotnetCLI { $vsMajorVersion = Get-VSMajorVersion $MSBuildExe = Get-MSBuildExe $vsMajorVersion $CliBranchListForTesting = & $msbuildExe $NuGetClientRoot\build\config.props /v:m /nologo /t:GetCliBranchForTesting - $CliBranchList = $CliBranchListForTesting.Split(';'); + $CliBranchList = $CliBranchListForTesting.Trim().Split(';'); $DotNetInstall = Join-Path $CLIRoot 'dotnet-install.ps1' #If "-force" is specified, or dotnet.exe under cli folder doesn't exist, create cli folder and download dotnet-install.ps1 into cli folder. if ($Force -or -not (Test-Path $DotNetExe)) { - Trace-Log "Downloading .NET CLI $CliBranchForTesting" + Trace-Log "Downloading .NET CLI '$CliBranchList'" New-Item -ItemType Directory -Force -Path $CLIRoot | Out-Null - Invoke-WebRequest 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1' -OutFile $DotNetInstall + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile $DotNetInstall } ForEach ($CliBranch in $CliBranchList) { @@ -205,7 +205,19 @@ Function Install-DotnetCLI { if ($Version -eq 'latest') { #Get the latest specific version number for a certain channel from url like : https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/3.0.1xx/latest.version" - $httpGetUrl = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/" + $Channel + "/latest.version" + $latestVersionLink = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/" + $Channel + "/latest.version" + $latestVersionFile = Invoke-RestMethod -Method Get -Uri $latestVersionLink + + $stringReader = New-Object -TypeName System.IO.StringReader -ArgumentList $latestVersionFile + [int]$count = 0 + while ( $line = $stringReader.ReadLine() ) { + if ($count -eq 1) { + $expectedVersion = $line.trim() + } + $count += 1 + } + + $httpGetUrl = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/" + $expectedVersion + "/productVersion.txt" $versionFile = Invoke-RestMethod -Method Get -Uri $httpGetUrl $stringReader = New-Object -TypeName System.IO.StringReader -ArgumentList $versionFile @@ -229,6 +241,7 @@ Function Install-DotnetCLI { #If "-force" is specified, or folder with specific version doesn't exist, the download command will run" if ($Force -or -not (Test-Path $probeDotnetPath)) { + Trace-Log "$DotNetInstall -Channel $($cli.Channel) -i $($cli.Root) -Version $($cli.Version) -Architecture $arch -NoPath" & $DotNetInstall -Channel $cli.Channel -i $cli.Root -Version $cli.Version -Architecture $arch -NoPath } diff --git a/build/config.props b/build/config.props index 6b9f52d037f..b34241bbadb 100644 --- a/build/config.props +++ b/build/config.props @@ -32,7 +32,7 @@ rel/d$(VsTargetMajorVersion).$(MinorNuGetVersion) int.d$(VsTargetMajorVersion).$(MinorNuGetVersion) - 5.0.3xx + release/5.0.2xx diff --git a/scripts/utils/InsertNuGetIntoSdkAndCli.ps1 b/scripts/utils/InsertNuGetIntoSdkAndCli.ps1 deleted file mode 100644 index de72d7aa65d..00000000000 --- a/scripts/utils/InsertNuGetIntoSdkAndCli.ps1 +++ /dev/null @@ -1,240 +0,0 @@ -<# -.SYNOPSIS -Script to insert NuGet into dotnet; CLI, SDK, and TOOLSET repos - -.DESCRIPTION -Uses the Personal Access Token of NuGetLurker to automate the insertion process into CLI, SDK, and TOOLSET -Note - This script can only be used from a VSTS Release Definition because of the env variables it -depends on. - -.PARAMETER PersonalAccessToken -PersonalAccessToken of the NuGetLurker account - -.PARAMETER RepositoryName -The Repository to insert into (SDK, CLI, or TOOLSET) - -.PARAMETER BranchName -Semicolon separated list of the repository's branches to insert into - -.PARAMETER NuGetTag -The xml tag in the DependencyVersions.props file that defines the NuGet version - -.PARAMETER BuildOutputPath -The output path for NuGet Build artifacts. - -#> - -[CmdletBinding()] -param -( - [Parameter(Mandatory=$True)] - [string]$PersonalAccessToken, - [Parameter(Mandatory=$True)] - [string]$RepositoryName, - [Parameter(Mandatory=$True)] - [string]$BranchName, - [Parameter(Mandatory=$True)] - [string]$FilePath, - [Parameter(Mandatory=$True)] - [string]$NuGetTag, - [Parameter(Mandatory=$True)] - [string]$BuildOutputPath -) - -Function UpdateNuGetVersionInXmlFile { - param( - [string]$XmlContents, - [string]$NuGetVersion, - [string]$NuGetTag - ) - -$xmlString = $XmlContents.Split([environment]::NewLine) | Where-Object { $_ -cmatch "<$NuGetTag>" } -Write-Host $xmlString -$newXmlString = "<$NuGetTag>$NuGetVersion" -Write-Host $newXmlString -$updatedXml = $XmlContents.Replace($xmlString.Trim(), $newXmlString) -Write-Host $updatedXml -return $updatedXml - -} - -Function GetDependencyVersionPropsFile { -param -( - [Parameter(Mandatory=$True)] - [string]$RepositoryName, - [Parameter(Mandatory=$True)] - [string]$BranchName, - [Parameter(Mandatory=$True)] - [string]$FilePath -) - -$url = "https://raw.githubusercontent.com/$repoOwner/$RepositoryName/$BranchName/$FilePath" -Write-Host $url -$xmlContent = Invoke-WebRequest -Uri $url -UseBasicParsing - -return $xmlContent - -} - -Function CreateBranchForPullRequest { -param -( - [Parameter(Mandatory=$True)] - [string]$RepositoryName, - [Parameter(Mandatory=$True)] - [System.Collections.IDictionary]$Headers, - [Parameter(Mandatory=$True)] - [string]$BranchName, - [Parameter(Mandatory=$True)] - [string]$BranchNameToCreate -) - -$commits = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$repoOwner/$RepositoryName/commits?sha=$BranchName" -$headSha = $commits[0].sha -$refName = "refs/heads/$BranchNameToCreate" - -$Body = @{ -sha = $headSha; -ref = $refName; -} | ConvertTo-Json; - -$r1 = Invoke-RestMethod -Headers $Headers -Method Post -Uri "https://api.github.com/repos/$repoOwner/$RepositoryName/git/refs" -Body $Body -Write-Host $r1 -} - -Function UpdateFileContent { -param -( - [Parameter(Mandatory=$True)] - [string]$RepositoryName, - [Parameter(Mandatory=$True)] - [System.Collections.IDictionary]$Headers, - [Parameter(Mandatory=$True)] - [string]$FilePath, - [Parameter(Mandatory=$True)] - [string]$FileContent, - [Parameter(Mandatory=$True)] - [string]$CreatedBranchName -) -$params = "?ref=$CreatedBranchName" -$httpGetUrl = "https://api.github.com/repos/$repoOwner/$RepositoryName/contents/$FilePath$Params" -$content = Invoke-RestMethod -Method Get -Uri $httpGetUrl -$shaBlob = $content.sha -$commitMessage = "Insert NuGet Build $ProductVersion into $RepositoryName" - -$base64Content = [System.Convert]::ToBase64String([char[]]$FileContent) -$Uri = "https://api.github.com/repos/$repoOwner/$RepositoryName/contents/$FilePath" - -$Body = @{ -path = $FilePath; -sha = $shaBlob; -branch = $CreatedBranchName; -message = $commitMessage; -content = $base64Content; -} | ConvertTo-Json; - -$r1 = Invoke-RestMethod -Headers $Headers -Method Put -Uri $Uri -Body $Body -Write-Host $r1 -} - -Function CreatePullRequest { -param -( - [Parameter(Mandatory=$True)] - [string]$RepositoryName, - [Parameter(Mandatory=$True)] - [System.Collections.IDictionary]$Headers, - [Parameter(Mandatory=$True)] - [string]$CreatedBranchName, - [Parameter(Mandatory=$True)] - [string]$BaseBranch - -) - -$Uri = "https://api.github.com/repos/$repoOwner/$RepositoryName/pulls" -$Title = "Insert NuGet Build $ProductVersion into $RepositoryName" -$PrMessage = "$Title $BaseBranch branch" - -$Body = @{ -title = $Title; -head = $CreatedBranchName; -base = $BaseBranch; -body = $PrMessage; -} | ConvertTo-Json; - -Write-Host $Body - -$r1 = Invoke-RestMethod -Headers $Headers -Method Post -Uri $Uri -Body $Body -Write-Host $r1.html_url -return $r1.html_url -} - -Function PrintPullRequestsUrlToVsts { -param -( - [Parameter(Mandatory=$True)] - [string]$RepositoryName, - [Parameter(Mandatory=$True)] - [string]$PullRequestsUrl - -) - -$mdFolder = Join-Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY (Join-Path 'MicroBuild' 'Output') -New-Item -ItemType Directory -Force -Path $mdFolder | Out-Null -$fileExtension = "_Url.md" -$mdFile = Join-Path $mdFolder "$RepositoryName$fileExtension" -$PullRequestsUrl | Set-Content $mdFile -Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=$RepositoryName Pull Requests Url;]$mdFile" -} - -## This is where the script logic beings. - -# Set security protocol to tls1.2 for Invoke-RestMethod powershell cmdlet -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -$repoOwner = "dotnet" -$Base64Token = [System.Convert]::ToBase64String([char[]]$PersonalAccessToken) - -$Headers= @{ - Authorization='Basic {0}' -f $Base64Token; -} - -$Build = ${env:BUILD_BUILDNUMBER} -$Branch = ${env:BUILD_SOURCEBRANCHNAME} -$AttemptNum = ${env:RELEASE_ATTEMPTNUMBER} -$Release = ${env:RELEASE_RELEASENAME} -$NuGetExePath = [System.IO.Path]::Combine($BuildOutputPath, $Branch, $Build, 'artifacts', 'VS15', "NuGet.exe") - -$ProductVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($NuGetExePath).ProductVersion -$index = $ProductVersion.LastIndexOf('+') -if($index -ne '-1') -{ - $ProductVersion = $ProductVersion.Substring(0,$index).Trim() -} - -$BranchesToInsert = $BranchName.Split(';') -$AllPullRequestsUrls = "" -ForEach ($Branch in $BranchesToInsert) { - - $VersionsFilePath = $FilePath - # Hack to allow us to specify the arcade version props location if the branch is 3.0 or later. - # We can remove this when we stop inserting into 2.x - if($Branch.StartsWith("master") -or $Branch.StartsWith("release/3")){ - $VersionsFilePath = "eng/Versions.props" - } - - $xml = GetDependencyVersionPropsFile -RepositoryName $RepositoryName -BranchName $Branch -FilePath $VersionsFilePath - Write-Host $xml - - $updatedXml = UpdateNuGetVersionInXmlFile -XmlContents $xml -NuGetVersion $ProductVersion -NuGetTag $NuGetTag - - $CreatedBranchName = "$Release-$Branch-$AttemptNum" - - CreateBranchForPullRequest -RepositoryName $RepositoryName -Headers $Headers -BranchName $Branch -BranchNameToCreate $CreatedBranchName - UpdateFileContent -RepositoryName $RepositoryName -Headers $Headers -FilePath $VersionsFilePath -FileContent $updatedXml -CreatedBranchName $CreatedBranchName - $PullRequestUrl = CreatePullRequest -RepositoryName $RepositoryName -Headers $Headers -CreatedBranchName $CreatedBranchName -BaseBranch $Branch - $AllPullRequestsUrls = $AllPullRequestsUrls + "$PullRequestUrl`n" -} - -PrintPullRequestsUrlToVsts -RepositoryName $RepositoryName -PullRequestsUrl $AllPullRequestsUrls From 0520a17f112ebf62449baffddee8f8e1c3fcd777 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Tue, 23 Feb 2021 10:33:38 -0800 Subject: [PATCH 03/11] test on the CI --- eng/pipelines/templates/Build_and_UnitTest.yml | 7 ------- eng/pipelines/templates/End_To_End_Tests_On_Windows.yml | 7 ------- eng/pipelines/templates/Functional_Tests_On_Windows.yml | 6 ------ eng/pipelines/templates/Tests_On_Linux.yml | 9 --------- eng/pipelines/templates/Tests_On_Mac.yml | 9 --------- 5 files changed, 38 deletions(-) diff --git a/eng/pipelines/templates/Build_and_UnitTest.yml b/eng/pipelines/templates/Build_and_UnitTest.yml index e90ace59d6d..7b66e06e1cd 100644 --- a/eng/pipelines/templates/Build_and_UnitTest.yml +++ b/eng/pipelines/templates/Build_and_UnitTest.yml @@ -1,10 +1,3 @@ -steps: -- task: PowerShell@1 - inputs: - scriptName: "$(Build.Repository.LocalPath)\\scripts\\utils\\InstallCLIforBuild.ps1" - arguments: '$(SDKVersionForBuild)' - displayName: "Install .NET 5.0 for build" - - task: PowerShell@1 displayName: "Update Build Number" inputs: diff --git a/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml b/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml index f22aa7aa722..eae086f5ef0 100644 --- a/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml +++ b/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml @@ -1,10 +1,3 @@ -steps: -- task: PowerShell@1 - inputs: - scriptName: "$(Build.Repository.LocalPath)\\scripts\\utils\\InstallCLIforBuild.ps1" - arguments: '$(SDKVersionForBuild)' - displayName: "Install .NET 5.0 for build" - - task: PowerShell@1 displayName: "Define variables" inputs: diff --git a/eng/pipelines/templates/Functional_Tests_On_Windows.yml b/eng/pipelines/templates/Functional_Tests_On_Windows.yml index 4c26d7eac59..e88c2597748 100644 --- a/eng/pipelines/templates/Functional_Tests_On_Windows.yml +++ b/eng/pipelines/templates/Functional_Tests_On_Windows.yml @@ -1,10 +1,4 @@ steps: -- task: PowerShell@1 - inputs: - scriptName: "$(Build.Repository.LocalPath)\\scripts\\utils\\InstallCLIforBuild.ps1" - arguments: '$(SDKVersionForBuild)' - displayName: "Install .NET 5.0 for build" - - task: PowerShell@1 displayName: "Define variables" inputs: diff --git a/eng/pipelines/templates/Tests_On_Linux.yml b/eng/pipelines/templates/Tests_On_Linux.yml index 243dd79ee8d..08dbc8a75f8 100644 --- a/eng/pipelines/templates/Tests_On_Linux.yml +++ b/eng/pipelines/templates/Tests_On_Linux.yml @@ -1,13 +1,4 @@ steps: -- task: ShellScript@2 - displayName: "Install .NET 5.0 for build" - continueOnError: "true" - inputs: - scriptPath: "scripts/utils/InstallCLIforBuild.sh" - disableAutoCwd: "true" - cwd: "$(Build.Repository.LocalPath)" - args: '$(SDKVersionForBuild)' - - task: PowerShell@2 displayName: "Define variables" inputs: diff --git a/eng/pipelines/templates/Tests_On_Mac.yml b/eng/pipelines/templates/Tests_On_Mac.yml index 5c40a6c659f..93448d5e15b 100644 --- a/eng/pipelines/templates/Tests_On_Mac.yml +++ b/eng/pipelines/templates/Tests_On_Mac.yml @@ -1,13 +1,4 @@ steps: -- task: ShellScript@2 - displayName: "Install .NET 5.0 for build" - continueOnError: "true" - inputs: - scriptPath: "scripts/utils/InstallCLIforBuild.sh" - disableAutoCwd: "true" - cwd: "$(Build.Repository.LocalPath)" - args: '$(SDKVersionForBuild)' - - task: PowerShell@2 displayName: "Update Build Number" inputs: From e89cbd7e358c61cc5d32be0ec9c9358d32f62e88 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Tue, 23 Feb 2021 10:38:13 -0800 Subject: [PATCH 04/11] test --- eng/pipelines/templates/Build_and_UnitTest.yml | 1 + eng/pipelines/templates/End_To_End_Tests_On_Windows.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/eng/pipelines/templates/Build_and_UnitTest.yml b/eng/pipelines/templates/Build_and_UnitTest.yml index 7b66e06e1cd..e783f812a5a 100644 --- a/eng/pipelines/templates/Build_and_UnitTest.yml +++ b/eng/pipelines/templates/Build_and_UnitTest.yml @@ -1,3 +1,4 @@ +steps: - task: PowerShell@1 displayName: "Update Build Number" inputs: diff --git a/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml b/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml index eae086f5ef0..b50537c3d48 100644 --- a/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml +++ b/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml @@ -1,3 +1,4 @@ +steps: - task: PowerShell@1 displayName: "Define variables" inputs: From c68ab37510b4f40f7651e21a61dc9c937febf91d Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Tue, 23 Feb 2021 10:46:48 -0800 Subject: [PATCH 05/11] work --- build/common.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/common.ps1 b/build/common.ps1 index 04689d11262..2bc9a2a7d48 100644 --- a/build/common.ps1 +++ b/build/common.ps1 @@ -257,8 +257,8 @@ Function Install-DotnetCLI { } # Install the 2.x runtime because our tests target netcoreapp2x - Trace-Log "$DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath" - & $DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath + # Trace-Log "$DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath" + # & $DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath # Display build info & $DotNetExe --info } From cea415fe874c63da3550c402fe184b6a6ef9b875 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Tue, 23 Feb 2021 13:41:15 -0800 Subject: [PATCH 06/11] work --- build/common.ps1 | 10 ++++------ eng/pipelines/templates/Apex_Tests_On_Windows.yml | 6 ------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/build/common.ps1 b/build/common.ps1 index 2bc9a2a7d48..7465fce5b0d 100644 --- a/build/common.ps1 +++ b/build/common.ps1 @@ -121,10 +121,6 @@ Function Invoke-BuildStep { else { Error-Log "[FAILED +$(Format-ElapsedTime $sw.Elapsed)] $BuildStep" } - - if ($env:TEAMCITY_VERSION) { - Write-Output "##teamcity[blockClosed name='$BuildStep']" - } } } else { @@ -257,8 +253,10 @@ Function Install-DotnetCLI { } # Install the 2.x runtime because our tests target netcoreapp2x - # Trace-Log "$DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath" - # & $DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath + Trace-Log "$DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath" + # Work around the following install script bug https://github.com/dotnet/install-scripts/issues/152. + # Start a new process to avoid the ev getting populated. + & powershell $DotNetInstall -Runtime dotnet -Channel 2.2 -i $CLIRoot -NoPath # Display build info & $DotNetExe --info } diff --git a/eng/pipelines/templates/Apex_Tests_On_Windows.yml b/eng/pipelines/templates/Apex_Tests_On_Windows.yml index 8337a155a88..0c6bb2f34c0 100644 --- a/eng/pipelines/templates/Apex_Tests_On_Windows.yml +++ b/eng/pipelines/templates/Apex_Tests_On_Windows.yml @@ -22,12 +22,6 @@ steps: inputs: versionSpec: "4.5.0" -- task: PowerShell@1 - inputs: - scriptName: "$(Build.Repository.LocalPath)\\scripts\\utils\\InstallCLIforBuild.ps1" - arguments: '$(SDKVersionForBuild)' - displayName: "Install .NET 5.0 for build" - - task: PowerShell@1 displayName: "Define variables" inputs: From eb4a6cf859de9173c30eab5bf1f44d5e674b0f3d Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 24 Feb 2021 11:46:40 -0800 Subject: [PATCH 07/11] Pin to an exact SDK version --- build/config.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/config.props b/build/config.props index b34241bbadb..88e03dcc70c 100644 --- a/build/config.props +++ b/build/config.props @@ -32,7 +32,7 @@ rel/d$(VsTargetMajorVersion).$(MinorNuGetVersion) int.d$(VsTargetMajorVersion).$(MinorNuGetVersion) - release/5.0.2xx + release/5.0.2xx 5.0.200-servicing.21120.4 From 02f984dee4174232d6bea366a626fc4c1aeace4e Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 24 Feb 2021 17:41:11 -0800 Subject: [PATCH 08/11] Fix the test case to match the dotnet.exe message --- .../ListPackage/ListPackageCommand.cs | 16 +--------------- .../NuGet.CommandLine.XPlat/Strings.Designer.cs | 2 +- .../NuGet.CommandLine.XPlat/Strings.resx | 4 ++-- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/NuGet.Core/NuGet.CommandLine.XPlat/Commands/PackageReferenceCommands/ListPackage/ListPackageCommand.cs b/src/NuGet.Core/NuGet.CommandLine.XPlat/Commands/PackageReferenceCommands/ListPackage/ListPackageCommand.cs index 47c74768824..d8a2ecb137b 100644 --- a/src/NuGet.Core/NuGet.CommandLine.XPlat/Commands/PackageReferenceCommands/ListPackage/ListPackageCommand.cs +++ b/src/NuGet.Core/NuGet.CommandLine.XPlat/Commands/PackageReferenceCommands/ListPackage/ListPackageCommand.cs @@ -154,21 +154,7 @@ private static ReportType GetReportType(bool isDeprecated, bool isOutdated, bool return isDeprecated ? ReportType.Deprecated : isOutdated ? ReportType.Outdated : ReportType.Vulnerable; } - // We have a conflict - throw with appropriate message - var firstOption = string.Empty; - var incompatibleOption = string.Empty; - if (isOutdated) - { - firstOption = "--outdated"; - incompatibleOption = isDeprecated ? "--deprecated" : "--vulnerable"; - } - else if (isDeprecated) - { - firstOption = "--deprecated"; - incompatibleOption = "--vulnerable"; - } - - throw new ArgumentException(string.Format(Strings.ListPkg_InvalidOptions, firstOption, incompatibleOption)); + throw new ArgumentException(string.Format(Strings.ListPkg_InvalidOptions)); } private static void DisplayMessages(ListPackageArgs packageRefArgs) diff --git a/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.Designer.cs b/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.Designer.cs index c045389924b..f36ac633190 100644 --- a/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.Designer.cs +++ b/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.Designer.cs @@ -718,7 +718,7 @@ internal static string ListPkg_InvalidFramework { } /// - /// Looks up a localized string similar to Option '{0}' and '{1}' cannot be combined.. + /// Looks up a localized string similar to Options '--outdated', '--deprecated' and '--vulnerable' cannot be combined.. /// internal static string ListPkg_InvalidOptions { get { diff --git a/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.resx b/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.resx index beef2f6e263..80d16086207 100644 --- a/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.resx +++ b/src/NuGet.Core/NuGet.CommandLine.XPlat/Strings.resx @@ -583,7 +583,7 @@ For more information, visit https://docs.nuget.org/docs/reference/command-line-r The following sources were used: - Option '{0}' and '{1}' cannot be combined. + Options '--outdated', '--deprecated' and '--vulnerable' cannot be combined. The given project `{0}` has no deprecated packages given the current sources. @@ -770,4 +770,4 @@ For more information, visit https://docs.nuget.org/docs/reference/command-line-r Specify the path to the package - + \ No newline at end of file From d4a0aa3624db39306eda073b9b741470650b8fdb Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Thu, 25 Feb 2021 11:03:02 -0800 Subject: [PATCH 09/11] Address feedback --- build/config.props | 2 +- eng/pipelines/templates/Apex_Tests_On_Windows.yml | 12 ------------ eng/pipelines/templates/Build_and_UnitTest.yml | 12 ------------ .../templates/End_To_End_Tests_On_Windows.yml | 1 - .../templates/Functional_Tests_On_Windows.yml | 7 ------- eng/pipelines/templates/Tests_On_Linux.yml | 7 ------- eng/pipelines/templates/Tests_On_Mac.yml | 7 ------- 7 files changed, 1 insertion(+), 47 deletions(-) diff --git a/build/config.props b/build/config.props index 88e03dcc70c..0a310425ee6 100644 --- a/build/config.props +++ b/build/config.props @@ -31,7 +31,7 @@ rel/d$(VsTargetMajorVersion).$(MinorNuGetVersion) int.d$(VsTargetMajorVersion).$(MinorNuGetVersion) - + release/5.0.2xx 5.0.200-servicing.21120.4 diff --git a/eng/pipelines/templates/Apex_Tests_On_Windows.yml b/eng/pipelines/templates/Apex_Tests_On_Windows.yml index 0c6bb2f34c0..66c3d55e817 100644 --- a/eng/pipelines/templates/Apex_Tests_On_Windows.yml +++ b/eng/pipelines/templates/Apex_Tests_On_Windows.yml @@ -17,18 +17,6 @@ steps: artifactName: "$(VsixPublishDir)" downloadPath: "$(Build.Repository.LocalPath)/artifacts" -- task: NuGetToolInstaller@0 - displayName: "Use NuGet 4.5.0" - inputs: - versionSpec: "4.5.0" - -- task: PowerShell@1 - displayName: "Define variables" - inputs: - scriptType: "inlineScript" - inlineScript: | - Write-Host "##vso[task.setvariable variable=Path]${env:AGENT_TEMPDIRECTORY}\dotnet\;${env:Path}" - - task: MSBuild@1 displayName: "Bootstrap NuGet packages" inputs: diff --git a/eng/pipelines/templates/Build_and_UnitTest.yml b/eng/pipelines/templates/Build_and_UnitTest.yml index e783f812a5a..94da98731d5 100644 --- a/eng/pipelines/templates/Build_and_UnitTest.yml +++ b/eng/pipelines/templates/Build_and_UnitTest.yml @@ -7,18 +7,6 @@ steps: Write-Host "##vso[build.updatebuildnumber]$env:FullVstsBuildNumber" Get-ChildItem Env: | Sort-Object Name | Format-Table -Wrap -AutoSize -- task: PowerShell@1 - displayName: "Define variables" - inputs: - scriptType: "inlineScript" - inlineScript: | - Write-Host "##vso[task.setvariable variable=Path]${env:AGENT_TEMPDIRECTORY}\dotnet\;${env:Path}" - -- task: NuGetToolInstaller@0 - displayName: "Use NuGet 5.0.0" - inputs: - versionSpec: "5.0.0" - - task: PowerShell@1 inputs: scriptName: "$(Build.Repository.LocalPath)\\configure.ps1" diff --git a/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml b/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml index b50537c3d48..cb1abc63a38 100644 --- a/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml +++ b/eng/pipelines/templates/End_To_End_Tests_On_Windows.yml @@ -4,7 +4,6 @@ steps: inputs: scriptType: "inlineScript" inlineScript: | - Write-Host "##vso[task.setvariable variable=Path]${env:AGENT_TEMPDIRECTORY}\dotnet\;${env:Path}" $EndToEndTestCommandToRunPart = '"' + "Run-Test -Exclude '${env:PART}' -Verbose *>&1 | Tee-Object $(System.DefaultWorkingDirectory)\artifacts\EndToEnd\FullLog_$(Build.BuildNumber).txt" +'"' Write-Host "##vso[task.setvariable variable=EndToEndTestCommandToRunPart]$EndToEndTestCommandToRunPart" diff --git a/eng/pipelines/templates/Functional_Tests_On_Windows.yml b/eng/pipelines/templates/Functional_Tests_On_Windows.yml index e88c2597748..2d2e7ad1828 100644 --- a/eng/pipelines/templates/Functional_Tests_On_Windows.yml +++ b/eng/pipelines/templates/Functional_Tests_On_Windows.yml @@ -1,11 +1,4 @@ steps: -- task: PowerShell@1 - displayName: "Define variables" - inputs: - scriptType: "inlineScript" - inlineScript: | - Write-Host "##vso[task.setvariable variable=Path]${env:AGENT_TEMPDIRECTORY}\dotnet\;${env:Path}" - - task: PowerShell@1 displayName: "Print Environment Variables" inputs: diff --git a/eng/pipelines/templates/Tests_On_Linux.yml b/eng/pipelines/templates/Tests_On_Linux.yml index 08dbc8a75f8..db7f48120dd 100644 --- a/eng/pipelines/templates/Tests_On_Linux.yml +++ b/eng/pipelines/templates/Tests_On_Linux.yml @@ -1,11 +1,4 @@ steps: -- task: PowerShell@2 - displayName: "Define variables" - inputs: - targetType: "inline" - script: | - Write-Host "##vso[task.setvariable variable=PATH]${env:AGENT_TEMPDIRECTORY}/dotnet/:${env:PATH}" - - task: PowerShell@2 displayName: "Update Build Number" inputs: diff --git a/eng/pipelines/templates/Tests_On_Mac.yml b/eng/pipelines/templates/Tests_On_Mac.yml index 93448d5e15b..b32079eaaed 100644 --- a/eng/pipelines/templates/Tests_On_Mac.yml +++ b/eng/pipelines/templates/Tests_On_Mac.yml @@ -8,13 +8,6 @@ steps: failOnStderr: "true" condition: "always()" -- task: PowerShell@2 - displayName: "Define variables" - inputs: - targetType: "inline" - script: | - Write-Host "##vso[task.setvariable variable=PATH]${env:AGENT_TEMPDIRECTORY}/dotnet/:${env:PATH}" - - task: DownloadBuildArtifacts@0 displayName: "Download NuGet.CommandLine.Test artifacts" inputs: From a43dcfe2f0281cf1722b200d0af45af9c2e2fab5 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Mon, 1 Mar 2021 11:02:13 -0800 Subject: [PATCH 10/11] address feedback, add clarifications --- build/common.ps1 | 4 +++- build/config.props | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build/common.ps1 b/build/common.ps1 index 7465fce5b0d..62857e890eb 100644 --- a/build/common.ps1 +++ b/build/common.ps1 @@ -200,7 +200,9 @@ Function Install-DotnetCLI { $env:DOTNET_INSTALL_DIR = $NuGetClientRoot if ($Version -eq 'latest') { - #Get the latest specific version number for a certain channel from url like : https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/3.0.1xx/latest.version" + + # When installing latest, we firstly check the latest version from the server against what we have installed locally. This also allows us to check the SDK was correctly installed. + # Get the latest specific version number for a certain channel from url like : https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/3.0.1xx/latest.version $latestVersionLink = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/" + $Channel + "/latest.version" $latestVersionFile = Invoke-RestMethod -Method Get -Uri $latestVersionLink diff --git a/build/config.props b/build/config.props index 0a310425ee6..887049fd577 100644 --- a/build/config.props +++ b/build/config.props @@ -31,7 +31,9 @@ rel/d$(VsTargetMajorVersion).$(MinorNuGetVersion) int.d$(VsTargetMajorVersion).$(MinorNuGetVersion) - + release/5.0.2xx 5.0.200-servicing.21120.4 From 80f33f03c63fcb16c9e0efe56a98970d4a7d6097 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Mon, 1 Mar 2021 11:21:10 -0800 Subject: [PATCH 11/11] Remove dead files --- scripts/utils/InstallCLIforBuild.ps1 | 48 ------------------ scripts/utils/InstallCLIforBuild.sh | 55 --------------------- scripts/utils/LockNuGetCoreVersion.ps1 | 68 -------------------------- 3 files changed, 171 deletions(-) delete mode 100644 scripts/utils/InstallCLIforBuild.ps1 delete mode 100644 scripts/utils/InstallCLIforBuild.sh delete mode 100644 scripts/utils/LockNuGetCoreVersion.ps1 diff --git a/scripts/utils/InstallCLIforBuild.ps1 b/scripts/utils/InstallCLIforBuild.ps1 deleted file mode 100644 index c59900e911d..00000000000 --- a/scripts/utils/InstallCLIforBuild.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -# Download the CLI install script to Agent.TempDirectory - -#Write-Host "Installing dotnet CLI into $Env:AGENT_TEMPDIRECTORY folder for building" - -[CmdletBinding(SupportsShouldProcess=$True)] -Param ( - [string]$SDKVersionForBuild -) - -# Get version from SDKVersionForBuild, if only branch name specified, use the latest version for this branch -$CliBranch = $SDKVersionForBuild.trim() -$CliChannelAndVersion = $CliBranch -split "\s+" - -$Channel = $CliChannelAndVersion[0].trim() -if ($CliChannelAndVersion.count -eq 1) { - $Version = 'latest' -}else { - $Version = $CliChannelAndVersion[1].trim() -} - -Write-Host "Channel is : $Channel Version is : $Version" -ForegroundColor Cyan - -$InstallDir = Join-Path $Env:AGENT_TEMPDIRECTORY 'dotnet' - -New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null - -$DotNetInstall = Join-Path $InstallDir 'dotnet-install.ps1' - -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile $DotNetInstall - - -if ([Environment]::Is64BitOperatingSystem) -{ - $arch = "x64"; -} -else -{ - $arch = "x86"; -} - -& $DotNetInstall -Channel $Channel -Version $Version -i $InstallDir -Architecture $arch - -$Env:PATH - -# Display build info -& dotnet --info \ No newline at end of file diff --git a/scripts/utils/InstallCLIforBuild.sh b/scripts/utils/InstallCLIforBuild.sh deleted file mode 100644 index cfa5c2c78ed..00000000000 --- a/scripts/utils/InstallCLIforBuild.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -# Download the CLI install script to Agent.TempDirectory - -env - -installVersion=$1 - -echo $installVersion -ChannelAndVersion=($installVersion) -Channel=${ChannelAndVersion[0]} -if [ ${#ChannelAndVersion[@]} -eq 1 ] -then - Version="latest" -else - Version=${ChannelAndVersion[1]} -fi -echo "Channel is: $Channel Version is: $Version" - -echo "Installing dotnet CLI into ${AGENT_TEMPDIRECTORY} folder for building" - -installDir="${AGENT_TEMPDIRECTORY}/dotnet" - -mkdir -p $installDir - -curl -o $installDir/dotnet-install.sh -L https://dot.net/v1/dotnet-install.sh - -# Run install.sh for cli - -chmod +x $installDir/dotnet-install.sh - - -# install master channel to get latest .NET 5 sdks - -# Issue 8936 - DISABLED TEMPORARILY $installDir/dotnet-install.sh -i $installDir -c $Channel -v $Version -chmod +x scripts/funcTests/dotnet-install.sh -scripts/funcTests/dotnet-install.sh -i $installDir -c $Channel -v $Version - -echo "Add ${installDir} to PATH" -PATH=$PATH:${installDir} - -echo $PATH - -echo "Deleting .NET Core temporary files" -rm -rf "/tmp/"dotnet.* - - -# Display current version - -dotnet --info - - - -echo "=================" - diff --git a/scripts/utils/LockNuGetCoreVersion.ps1 b/scripts/utils/LockNuGetCoreVersion.ps1 deleted file mode 100644 index 47a7afdede7..00000000000 --- a/scripts/utils/LockNuGetCoreVersion.ps1 +++ /dev/null @@ -1,68 +0,0 @@ -<# -.SYNOPSIS -Replaces floating version of NuGet core dependencies in NuGet clients projects to "{semver}-{label}-*". -Mostly needed for release branches when dev builds in myget feed have more advanced version. - -.PARAMETER LockVersion -Optional. New version of NuGet core packages. -Defaults to current "{semver}-{labe}-*" from .teamcity.properties - -.PARAMETER OldVersion -Optional. Old version string to look for when scanning project.json's. -Will use default version "{semver}-*" from .teamcity.properties file if not specified. - -.PARAMETER NuGetRoot -Optional. NuGet client repository root. - -.PARAMETER Force -Optional switch to force replacing text when new and old versions are the same -#> -[CmdletBinding(SupportsShouldProcess=$True)] -Param ( - [Parameter(Mandatory=$false, Position=0)] - [Alias('version')] - [string]$LockVersion, - [Parameter(Mandatory=$false, Position=1)] - [string]$OldVersion, - [Parameter(Mandatory=$false, Position=2)] - [string]$NuGetRoot, - [switch]$Force) - -. "$PSScriptRoot\..\common.ps1" - -if (-not $NuGetRoot -and (Test-Path Env:\NuGetRoot)) { - $NuGetRoot = $env:NuGetRoot -} - -if (-not $NuGetRoot) { - $NuGetRoot = Join-Path $PSScriptRoot '..\..\' -Resolve -} - -if (Test-Path "$NuGetRoot\.teamcity.properties") { - $properties = ReadPropertiesFile "$NuGetRoot\.teamcity.properties" -} - -if (-not $LockVersion -and $properties) { - $LockVersion = "$($properties['ReleaseProductVersion'])-$($properties['ReleaseLabel'])-*" -} - -if (-not $LockVersion) { - throw "LOCK version string can't be found" -} - -if (-not $OldVersion -and $properties) { - $OldVersion = "$($properties['ReleaseProductVersion'])-*" -} - -if (-not $OldVersion) { - throw "OLD version string can't be found" -} - -if ($OldVersion -eq $LockVersion -and -not $Force) { - Write-Output "NO-OP [$OldVersion == $LockVersion]" - exit 0 -} - -Write-Output "Locking NuGet core projects version [$OldVersion => $LockVersion]" - -gci "$NuGetRoot\src\NuGet.Clients" -include project.json -r | %{ $_.FullName } | ReplaceTextInFiles -old $OldVersion -new $LockVersion