diff --git a/azure-pipelines-e2e-integration-tests.yml b/azure-pipelines-e2e-integration-tests.yml index 680b2e38..4df22ec5 100644 --- a/azure-pipelines-e2e-integration-tests.yml +++ b/azure-pipelines-e2e-integration-tests.yml @@ -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: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f3ee4db4..df4ca6c9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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) diff --git a/tools/helper.psm1 b/tools/helper.psm1 index 1b07797a..e250458a 100644 --- a/tools/helper.psm1 +++ b/tools/helper.psm1 @@ -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 ', ')" @@ -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" } @@ -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