Skip to content

Commit 2d782a3

Browse files
Francisco-Gaminodavidmrdavid
authored andcommitted
Update PowerShell language worker pipelines (#750)
* Install .Net to a global location * Remove .Net installation tasks * Update install .Net 6 task * Update Windows image to use windows-latest
1 parent 60e65d4 commit 2d782a3

File tree

3 files changed

+7
-34
lines changed

3 files changed

+7
-34
lines changed

azure-pipelines-e2e-integration-tests.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,16 @@ strategy:
1111
linux:
1212
imageName: 'ubuntu-latest'
1313
windows:
14-
imageName: 'vs2017-win2016'
14+
imageName: 'windows-latest'
1515

1616
pool:
1717
vmImage: $(imageName)
1818

1919
steps:
2020
- pwsh: |
21-
Invoke-WebRequest 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
22-
./dotnet-install.ps1 -InstallDir "$env:ProgramFiles/dotnet" -Version "6.0.100" -Channel 'release'
23-
displayName: 'Install the .Net version used by the Core Tools for Windows'
24-
condition: eq( variables['Agent.OS'], 'Windows_NT' )
25-
26-
- bash: |
27-
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
28-
displayName: 'Install the .Net version used by the Core Tools for Linux'
29-
condition: eq( variables['Agent.OS'], 'Linux' )
21+
Import-Module "./tools/helper.psm1" -Force
22+
Install-Dotnet
23+
displayName: 'Install .NET 6.0'
3024

3125
- pwsh: ./test/E2E/Start-E2ETest.ps1 -UseCoreToolsBuildFromIntegrationTests
3226
env:

azure-pipelines.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,6 @@ steps:
5858
- pwsh: ./build.ps1 -NoBuild -Test
5959
displayName: 'Running UnitTest'
6060

61-
- pwsh: |
62-
Invoke-WebRequest 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
63-
./dotnet-install.ps1 -InstallDir "$env:ProgramFiles/dotnet" -Version "6.0.100" -Channel 'release'
64-
displayName: 'Install the .Net version used by the Core Tools for Windows'
65-
condition: eq( variables['Agent.OS'], 'Windows_NT' )
66-
67-
- bash: |
68-
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
69-
displayName: 'Install the .Net version used by the Core Tools for Linux'
70-
condition: eq( variables['Agent.OS'], 'Linux' )
71-
7261
- pwsh: ./test/E2E/Start-E2ETest.ps1
7362
env:
7463
AzureWebJobsStorage: $(AzureWebJobsStorage)

tools/helper.psm1

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,8 @@ $DotnetSDKVersionRequirements = @{
2525
$GrpcToolsVersion = '2.27.0' # grpc.tools
2626
$GoogleProtobufToolsVersion = '3.11.4' # google.protobuf.tools
2727

28-
function AddLocalDotnetDirPath {
29-
$LocalDotnetDirPath = if ($IsWindowsEnv) { "$env:LocalAppData\Microsoft\dotnet" } else { "$env:HOME/.dotnet" }
30-
if (($env:PATH -split [IO.Path]::PathSeparator) -notcontains $LocalDotnetDirPath) {
31-
$env:PATH = $LocalDotnetDirPath + [IO.Path]::PathSeparator + $env:PATH
32-
}
33-
}
34-
3528
function Find-Dotnet
3629
{
37-
AddLocalDotnetDirPath
38-
3930
$listSdksOutput = dotnet --list-sdks
4031
$installedDotnetSdks = $listSdksOutput | ForEach-Object { $_.Split(" ")[0] }
4132
Write-Log "Detected dotnet SDKs: $($installedDotnetSdks -join ', ')"
@@ -65,7 +56,7 @@ function Install-Dotnet {
6556
return # Simply return if we find dotnet SDk with the correct version
6657
} catch { }
6758

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

7061
try {
7162
$installScript = if ($IsWindowsEnv) { "dotnet-install.ps1" } else { "dotnet-install.sh" }
@@ -75,13 +66,12 @@ function Install-Dotnet {
7566
$version = "$majorMinorVersion.$($DotnetSDKVersionRequirements[$majorMinorVersion].DefaultPatch)"
7667
Write-Log "Installing dotnet SDK version $version" -Warning
7768
if ($IsWindowsEnv) {
78-
& .\$installScript -Channel $Channel -Version $Version
69+
& .\$installScript -Channel $Channel -Version $Version -InstallDir "$env:ProgramFiles/dotnet"
7970
} else {
80-
bash ./$installScript -c $Channel -v $Version
71+
bash ./$installScript -c $Channel -v $Version --install-dir /usr/share/dotnet
8172
}
8273
}
8374

84-
AddLocalDotnetDirPath
8575
}
8676
finally {
8777
Remove-Item $installScript -Force -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)