Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the custom SDK download on the CI, use a later version of dotnet.exe in our testing #3924

Merged
merged 11 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions build/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -160,17 +156,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) {
Expand Down Expand Up @@ -204,8 +200,22 @@ 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"
$httpGetUrl = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/" + $Channel + "/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

$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
Expand All @@ -229,6 +239,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
}

Expand All @@ -245,7 +256,9 @@ 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
# 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
nkolev92 marked this conversation as resolved.
Show resolved Hide resolved
# Display build info
& $DotNetExe --info
}
Expand Down
22 changes: 4 additions & 18 deletions build/config.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,10 @@
<!-- This branches are used for creating insertion PRs -->
<VsTargetBranch Condition="'$(IsEscrowMode)' == 'true'">rel/d$(VsTargetMajorVersion).$(MinorNuGetVersion)</VsTargetBranch>
<VsTargetChannel Condition="'$(IsEscrowMode)' == 'true'">int.d$(VsTargetMajorVersion).$(MinorNuGetVersion)</VsTargetChannel>

<!-- .NET Core SDK Insertion Logic -->
<!--We don't have .NET5 installed on CI, so we need to get version from CliVersionForBuilding and install it-->
<!--TODO: remove temporary workaround of using LockSDKVersion. Tracking issue: https://github.com/NuGet/Home/issues/9712 -->
<LockSDKVersion>true</LockSDKVersion>
<OverrideCliBranchForTesting Condition="'$(LockSDKVersion)' == 'false'"></OverrideCliBranchForTesting>
<OverrideCliBranchForTesting Condition="'$(LockSDKVersion)' == 'true'">master 5.0.100</OverrideCliBranchForTesting>
<CliVersionForBuilding>"master 5.0.100"</CliVersionForBuilding>
<CliBranchForTesting Condition="'$(OverrideCliBranchForTesting)' != ''">$(OverrideCliBranchForTesting)</CliBranchForTesting>
<CliBranchForTesting Condition="'$(OverrideCliBranchForTesting)' == ''">master</CliBranchForTesting>
<CliTargetBranches Condition="'$(OverrideCliTargetBranches)' != ''">$(OverrideCliTargetBranches)</CliTargetBranches>
<CliTargetBranches Condition="'$(OverrideCliTargetBranches)' == ''">master</CliTargetBranches>
<!-- Specifies the SDK version to download to use for testing. The first value represents the channel, the second value represents the exact SDK version to be download. If a version is not specified, the latest version from the channel will be downloaded.
Note that multiple SDKs can be downloaded by using `;` as a separator.
-->
<CliBranchForTesting Condition="'$(CliBranchForTesting)' == ''">release/5.0.2xx 5.0.200-servicing.21120.4</CliBranchForTesting>
nkolev92 marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<!-- Config -->
Expand Down Expand Up @@ -82,13 +74,7 @@
<Target Name="GetVsTargetChannel">
<Message Text="$(VsTargetChannel)" Importance="High"/>
</Target>
<Target Name="GetCliTargetBranches">
<Message Text="$(CliTargetBranches)" Importance="High"/>
</Target>
<Target Name="GetCliBranchForTesting">
<Message Text="$(CliBranchForTesting)" Importance="High"/>
</Target>
<Target Name="GetCliVersionForBuilding">
<Message Text="$(CliVersionForBuilding)" Importance="High"/>
</Target>
</Project>
18 changes: 0 additions & 18 deletions eng/pipelines/templates/Apex_Tests_On_Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +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
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:
scriptType: "inlineScript"
inlineScript: |
Write-Host "##vso[task.setvariable variable=Path]${env:AGENT_TEMPDIRECTORY}\dotnet\;${env:Path}"

- task: MSBuild@1
displayName: "Bootstrap NuGet packages"
inputs:
Expand Down
18 changes: 0 additions & 18 deletions eng/pipelines/templates/Build_and_UnitTest.yml
Original file line number Diff line number Diff line change
@@ -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: "Update Build Number"
inputs:
Expand All @@ -13,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"
Expand Down
7 changes: 0 additions & 7 deletions eng/pipelines/templates/End_To_End_Tests_On_Windows.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
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:
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"

Expand Down
13 changes: 0 additions & 13 deletions eng/pipelines/templates/Functional_Tests_On_Windows.yml
Original file line number Diff line number Diff line change
@@ -1,17 +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:
scriptType: "inlineScript"
inlineScript: |
Write-Host "##vso[task.setvariable variable=Path]${env:AGENT_TEMPDIRECTORY}\dotnet\;${env:Path}"

- task: PowerShell@1
displayName: "Print Environment Variables"
inputs:
Expand Down
10 changes: 0 additions & 10 deletions eng/pipelines/templates/Initialize_Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 0 additions & 16 deletions eng/pipelines/templates/Tests_On_Linux.yml
Original file line number Diff line number Diff line change
@@ -1,20 +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:
targetType: "inline"
script: |
Write-Host "##vso[task.setvariable variable=PATH]${env:AGENT_TEMPDIRECTORY}/dotnet/:${env:PATH}"

- task: PowerShell@2
displayName: "Update Build Number"
inputs:
Expand Down
16 changes: 0 additions & 16 deletions eng/pipelines/templates/Tests_On_Mac.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -17,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:
Expand Down
7 changes: 0 additions & 7 deletions global.json

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/cibuild/ConfigureVstsBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Loading