PowerShell/.vsts-ci/install-ps.yml
2023-08-21 10:04:50 -07:00

162 lines
5.5 KiB
YAML

name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
# Batch merge builds together while a merge build is running
batch: true
branches:
include:
- master
- release*
- feature*
paths:
include:
- /tools/install-powershell.*
- /tools/installpsh-*.sh
- /.vsts-ci/install-ps.yml
pr:
branches:
include:
- master
- release*
- feature*
paths:
include:
- /tools/install-powershell.sh
- /tools/installpsh-*.sh
- /tools/install-powershell.ps1
- /.vsts-ci/install-ps.yml
variables:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1
resources:
- repo: self
clean: true
phases:
- template: templates/install-ps-phase.yml
parameters:
scriptName: sudo ./tools/install-powershell.sh
jobName: InstallPowerShellUbuntu
pool: ubuntu-latest
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.3.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
- template: templates/install-ps-phase.yml
parameters:
scriptName: sudo ./tools/install-powershell.sh
jobName: InstallPowerShellMariner2
pool: ubuntu-latest
container: mcr.microsoft.com/powershell/test-deps:mariner-2.0
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.3.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
- template: templates/install-ps-phase.yml
parameters:
scriptName: sudo ./tools/install-powershell.sh
jobName: InstallPowerShellAmazonLinux
pool: ubuntu-latest
container: pshorg/powershellcommunity-test-deps:amazonlinux-2.0
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.3.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
- template: templates/install-ps-phase.yml
parameters:
scriptName: sudo ./tools/installpsh-amazonlinux.sh
jobName: InstallPSHAmazonLinux
pool: ubuntu-latest
container: pshorg/powershellcommunity-test-deps:amazonlinux-2.0
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.3.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
continueOnError: false
# TODO: add sudo to script and use image with sudo
- template: templates/install-ps-phase.yml
parameters:
scriptName: ./tools/install-powershell.sh
jobName: InstallPowerShellCentOS
pool: ubuntu-latest
container: mcr.microsoft.com/powershell/test-deps:centos-7
- template: templates/install-ps-phase.yml
parameters:
scriptName: ./tools/install-powershell.sh
jobName: InstallPowerShellDebian9
pool: ubuntu-latest
container: mcr.microsoft.com/powershell/test-deps:debian-9
# VSTS could not find pwsh in:
# mcr.microsoft.com/powershell:opensuse-42.3
# could not repo locally
# sudo is not needed on macOS
- template: templates/install-ps-phase.yml
parameters:
scriptName: ./tools/install-powershell.sh
jobName: InstallPowerShellMacOS
pool: macOS-latest
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.3.0")
{
# The script does not upgrade on mac os https://github.com/PowerShell/PowerShell/issues/9322
Write-Warning "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
- template: templates/install-ps-phase.yml
parameters:
scriptName: pwsh -c ./tools/install-powershell.ps1 -AddToPath
jobName: InstallPowerShellPS1Ubuntu
pool: ubuntu-latest
- template: templates/install-ps-phase.yml
parameters:
scriptName: pwsh -c ./tools/install-powershell.ps1 -AddToPath -Daily
jobName: InstallPowerShellPS1UbuntuDaily
pool: ubuntu-latest
verification: |
Write-Verbose $PSVersionTable.PSVersion -verbose
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.3.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
- template: templates/install-ps-phase.yml
parameters:
scriptName: pwsh -c ./tools/install-powershell.ps1 -AddToPath -Daily
jobName: InstallPowerShellMacOSDaily
pool: macOS-latest
verification: |
Write-Verbose $PSVersionTable.PSVersion -verbose
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.0.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
- template: templates/install-ps-phase.yml
parameters:
scriptName: |
pwsh -c ./tools/install-powershell.ps1 -AddToPath -Daily
jobName: InstallPowerShellWindowsDaily
pool: windows-latest
verification: |
$newVersion = &$env:LOCALAPPDATA\Microsoft\powershell-daily\pwsh -v
$newVersion -match '^PowerShell ((\d*\.\d*\.\d*)(-\w*(\.\d*)?)?){1}'
$versionOnly = $Matches[2]
Write-verbose "$newVersion; versionOnly: $versionOnly" -verbose
if ([Version]$versionOnly -lt [version]"7.0.0")
{
throw "powershell was not upgraded: $newVersion"
}