Skip to content

Commit

Permalink
Update PowerShell language worker pipelines (#750)
Browse files Browse the repository at this point in the history
* Install .Net to a global location

* Remove .Net installation tasks

* Update install .Net 6 task

* Update Windows image to use windows-latest
  • Loading branch information
Francisco-Gamino authored and ejizba committed Feb 4, 2022
1 parent b9f008e commit 1c55db1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 34 deletions.
14 changes: 4 additions & 10 deletions azure-pipelines-e2e-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,16 @@ strategy:
linux:
imageName: 'ubuntu-latest'
windows:
imageName: 'vs2017-win2016'
imageName: 'windows-latest'

pool:
vmImage: $(imageName)

steps:
- pwsh: |
Invoke-WebRequest 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
./dotnet-install.ps1 -InstallDir "$env:ProgramFiles/dotnet" -Version "6.0.100" -Channel 'release'
displayName: 'Install the .Net version used by the Core Tools for Windows'
condition: eq( variables['Agent.OS'], 'Windows_NT' )

- bash: |
curl -sSL https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh | bash /dev/stdin -v '6.0.100' -c 'release' --install-dir /usr/share/dotnet
displayName: 'Install the .Net version used by the Core Tools for Linux'
condition: eq( variables['Agent.OS'], 'Linux' )
Import-Module "./tools/helper.psm1" -Force
Install-Dotnet
displayName: 'Install .NET 6.0'

- pwsh: ./test/E2E/Start-E2ETest.ps1 -UseCoreToolsBuildFromIntegrationTests
env:
Expand Down
11 changes: 0 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ steps:
- pwsh: ./build.ps1 -NoBuild -Test
displayName: 'Running UnitTest'

- pwsh: |
Invoke-WebRequest 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
./dotnet-install.ps1 -InstallDir "$env:ProgramFiles/dotnet" -Version "6.0.100" -Channel 'release'
displayName: 'Install the .Net version used by the Core Tools for Windows'
condition: eq( variables['Agent.OS'], 'Windows_NT' )

- bash: |
curl -sSL https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh | bash /dev/stdin -v '6.0.100' -c 'release' --install-dir /usr/share/dotnet
displayName: 'Install the .Net version used by the Core Tools for Linux'
condition: eq( variables['Agent.OS'], 'Linux' )

- pwsh: ./test/E2E/Start-E2ETest.ps1
env:
AzureWebJobsStorage: $(AzureWebJobsStorage)
Expand Down
16 changes: 3 additions & 13 deletions tools/helper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,8 @@ $DotnetSDKVersionRequirements = @{
$GrpcToolsVersion = '2.27.0' # grpc.tools
$GoogleProtobufToolsVersion = '3.11.4' # google.protobuf.tools

function AddLocalDotnetDirPath {
$LocalDotnetDirPath = if ($IsWindowsEnv) { "$env:LocalAppData\Microsoft\dotnet" } else { "$env:HOME/.dotnet" }
if (($env:PATH -split [IO.Path]::PathSeparator) -notcontains $LocalDotnetDirPath) {
$env:PATH = $LocalDotnetDirPath + [IO.Path]::PathSeparator + $env:PATH
}
}

function Find-Dotnet
{
AddLocalDotnetDirPath

$listSdksOutput = dotnet --list-sdks
$installedDotnetSdks = $listSdksOutput | ForEach-Object { $_.Split(" ")[0] }
Write-Log "Detected dotnet SDKs: $($installedDotnetSdks -join ', ')"
Expand Down Expand Up @@ -65,7 +56,7 @@ function Install-Dotnet {
return # Simply return if we find dotnet SDk with the correct version
} catch { }

$obtainUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain"
$obtainUrl = "https://raw.githubusercontent.com/dotnet/install-scripts/main/src"

try {
$installScript = if ($IsWindowsEnv) { "dotnet-install.ps1" } else { "dotnet-install.sh" }
Expand All @@ -75,13 +66,12 @@ function Install-Dotnet {
$version = "$majorMinorVersion.$($DotnetSDKVersionRequirements[$majorMinorVersion].DefaultPatch)"
Write-Log "Installing dotnet SDK version $version" -Warning
if ($IsWindowsEnv) {
& .\$installScript -Channel $Channel -Version $Version
& .\$installScript -Channel $Channel -Version $Version -InstallDir "$env:ProgramFiles/dotnet"
} else {
bash ./$installScript -c $Channel -v $Version
bash ./$installScript -c $Channel -v $Version --install-dir /usr/share/dotnet
}
}

AddLocalDotnetDirPath
}
finally {
Remove-Item $installScript -Force -ErrorAction SilentlyContinue
Expand Down

0 comments on commit 1c55db1

Please sign in to comment.