Skip to content

Commit

Permalink
Add CI for install-powershell.sh and amazon linux (PowerShell#9314)
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisEz13 committed Apr 8, 2019
1 parent e299a30 commit b990c76
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
44 changes: 42 additions & 2 deletions .vsts-ci/install-ps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ trigger:
- /tools/installpsh-redhat.sh
- /tools/installpsh-suse.sh
- /tools/install-powershell.ps1
- /.vsts-ci/install-ps.yml
pr:
branches:
include:
Expand All @@ -29,6 +30,7 @@ pr:
- /tools/installpsh-redhat.sh
- /tools/installpsh-suse.sh
- /tools/install-powershell.ps1
- /.vsts-ci/install-ps.yml

variables:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
Expand All @@ -40,28 +42,66 @@ resources:
phases:
- template: templates/install-ps-phase.yml
parameters:
scriptName: ./tools/install-powershell.sh
scriptName: sudo ./tools/install-powershell.sh
jobName: InstallPowerShellUbuntu
pool: Hosted Ubuntu 1604
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
# amazonlinux was missing adduser
- template: templates/install-ps-phase.yml
parameters:
scriptName: sudo ./tools/install-powershell.sh
jobName: InstallPowerShellAmazonLinux
pool: Hosted Ubuntu 1604
container: pshorg/powershellcommunity-test-deps:amazonlinux-2.0
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
- template: templates/install-ps-phase.yml
parameters:
scriptName: sudo ./tools/installpsh-amazonlinux.sh
jobName: InstallPSHAmazonLinux
pool: Hosted Ubuntu 1604
container: pshorg/powershellcommunity-test-deps:amazonlinux-2.0
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.0")
{
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
}
# ignoring this due to https://github.com/PowerShell/PowerShell/issues/9285
continueOnError: true

# 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: Hosted Ubuntu 1604
container: mcr.microsoft.com/powershell:centos-7


# 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: Hosted macOS
verification: |
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.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:
Expand Down
11 changes: 10 additions & 1 deletion .vsts-ci/templates/install-ps-phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ parameters:
jobName: 'none'
scriptName: ''
container: ''
verification: ''
continueOnError: false

jobs:

Expand All @@ -13,7 +15,8 @@ jobs:
${{ if ne(parameters.container, '') }}:
container: ${{ parameters.container }}

pool: ${{ parameters.pool }}
pool:
name: ${{ parameters.pool }}

displayName: ${{ parameters.jobName }}

Expand All @@ -31,3 +34,9 @@ jobs:
$(scriptName)
displayName: Run Script - $(scriptName)
condition: succeededOrFailed()
continueOnError: ${{ parameters.continueOnError }}
- ${{ if ne(parameters.verification, '') }}:
- powershell: ${{ parameters.verification }}
displayName: Verification
continueOnError: ${{ parameters.continueOnError }}
Empty file modified tools/installpsh-amazonlinux.sh
100644 → 100755
Empty file.

0 comments on commit b990c76

Please sign in to comment.