diff --git a/.dependabot/config.yml b/.dependabot/config.yml index 9861b2e29..59116a1eb 100644 --- a/.dependabot/config.yml +++ b/.dependabot/config.yml @@ -34,3 +34,7 @@ update_configs: - package_manager: "docker" directory: "/release/preview/windowsservercore/dependabot" update_schedule: "daily" + + - package_manager: "docker" + directory: "/release/preview/alpine38/dependabot" + update_schedule: "daily" diff --git a/release/preview/alpine38/dependabot/Dockerfile b/release/preview/alpine38/dependabot/Dockerfile new file mode 100644 index 000000000..1c8c3ded3 --- /dev/null +++ b/release/preview/alpine38/dependabot/Dockerfile @@ -0,0 +1 @@ +FROM node:10.15.3-alpine diff --git a/release/preview/alpine38/docker/Dockerfile b/release/preview/alpine38/docker/Dockerfile index bae951ceb..3d7106c1c 100644 --- a/release/preview/alpine38/docker/Dockerfile +++ b/release/preview/alpine38/docker/Dockerfile @@ -42,7 +42,8 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Alpine-3.8 # Install dotnet dependencies and ca-certificates RUN apk add --no-cache \ diff --git a/release/preview/alpine38/test-deps/docker/Dockerfile b/release/preview/alpine38/test-deps/docker/Dockerfile index 8443b6d24..6ac5177d3 100644 --- a/release/preview/alpine38/test-deps/docker/Dockerfile +++ b/release/preview/alpine38/test-deps/docker/Dockerfile @@ -8,9 +8,10 @@ FROM node:10.15.3-alpine as node FROM ${BaseImage} -ENV NODE_VERSION 10.15.3 -ENV YARN_VERSION=1.13.0 -ENV NVM_DIR="/root/.nvm" +ENV NODE_VERSION=10.15.3 \ + YARN_VERSION=1.13.0 \ + NVM_DIR="/root/.nvm" \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Alpine-3.8 # workaround for Alpine to run in Azure DevOps ENV NODE_NO_WARNINGS=1 diff --git a/release/preview/alpine39/docker/Dockerfile b/release/preview/alpine39/docker/Dockerfile index b4ac0c81d..45f1a1b20 100644 --- a/release/preview/alpine39/docker/Dockerfile +++ b/release/preview/alpine39/docker/Dockerfile @@ -30,6 +30,8 @@ RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER} -v # Start a new stage so we lose all the tar.gz layers from the final image FROM ${imageRepo}:${fromTag} +ARG fromTag=3.9 + # Copy only the files we need from the previous stage COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"] @@ -42,7 +44,8 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Alpine-${fromTag} # Install dotnet dependencies and ca-certificates RUN apk add --no-cache \ diff --git a/release/preview/alpine39/test-deps/docker/Dockerfile b/release/preview/alpine39/test-deps/docker/Dockerfile index f7bb8a2d4..daf67b708 100644 --- a/release/preview/alpine39/test-deps/docker/Dockerfile +++ b/release/preview/alpine39/test-deps/docker/Dockerfile @@ -8,9 +8,12 @@ FROM node:10.15.3-alpine as node FROM ${BaseImage} -ENV NODE_VERSION 10.15.3 -ENV YARN_VERSION=1.13.0 -ENV NVM_DIR="/root/.nvm" +ARG fromTag=3.9 + +ENV NODE_VERSION=10.15.3 \ + YARN_VERSION=1.13.0 \ + NVM_DIR="/root/.nvm" \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Alpine-${fromTag} # workaround for Alpine to run in Azure DevOps ENV NODE_NO_WARNINGS=1 diff --git a/release/preview/centos7/docker/Dockerfile b/release/preview/centos7/docker/Dockerfile index 3f4dda521..cea777d5b 100644 --- a/release/preview/centos7/docker/Dockerfile +++ b/release/preview/centos7/docker/Dockerfile @@ -9,12 +9,16 @@ ARG PACKAGE_VERSION=6.2.0_preview.2 ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.rhel.7.x86_64.rpm ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} +ARG fromTag=7 +ARG imageRepo=centos + # Define ENVs for Localization/Globalization ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-CentOS-${fromTag} # Install dependencies and clean up RUN curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.rpm \ diff --git a/release/preview/centos7/test-deps/docker/Dockerfile b/release/preview/centos7/test-deps/docker/Dockerfile index b44beb0a8..d343eca55 100644 --- a/release/preview/centos7/test-deps/docker/Dockerfile +++ b/release/preview/centos7/test-deps/docker/Dockerfile @@ -10,6 +10,8 @@ RUN yum install -y \ openssl \ && yum clean all +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-CentOS-7 + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:centos-7 diff --git a/release/preview/debian10/docker/Dockerfile b/release/preview/debian10/docker/Dockerfile index aecd890b0..44ee55727 100644 --- a/release/preview/debian10/docker/Dockerfile +++ b/release/preview/debian10/docker/Dockerfile @@ -40,7 +40,8 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Debian-10 # Install dependencies and clean up RUN apt-get update \ diff --git a/release/preview/debian10/test-deps/docker/Dockerfile b/release/preview/debian10/test-deps/docker/Dockerfile index 48e428d63..d309f3fda 100644 --- a/release/preview/debian10/test-deps/docker/Dockerfile +++ b/release/preview/debian10/test-deps/docker/Dockerfile @@ -15,6 +15,8 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Debian-10 + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:debian-9 diff --git a/release/preview/debian9/docker/Dockerfile b/release/preview/debian9/docker/Dockerfile index 24c15542c..93a95ae1b 100644 --- a/release/preview/debian9/docker/Dockerfile +++ b/release/preview/debian9/docker/Dockerfile @@ -17,7 +17,8 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Debian-9 # Install dependencies and clean up RUN apt-get update \ diff --git a/release/preview/debian9/test-deps/docker/Dockerfile b/release/preview/debian9/test-deps/docker/Dockerfile index 33ce0f7d3..7f399e1c9 100644 --- a/release/preview/debian9/test-deps/docker/Dockerfile +++ b/release/preview/debian9/test-deps/docker/Dockerfile @@ -15,6 +15,8 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Debian-9 + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:debian-9 diff --git a/release/preview/fedora/docker/Dockerfile b/release/preview/fedora/docker/Dockerfile index aba9d61b9..8da7253a8 100644 --- a/release/preview/fedora/docker/Dockerfile +++ b/release/preview/fedora/docker/Dockerfile @@ -9,12 +9,15 @@ ARG PACKAGE_VERSION=6.2.0_preview.2 ARG PS_PACKAGE=powershell-preview-${PACKAGE_VERSION}-1.rhel.7.x86_64.rpm ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} +ARG fromTag=28 + # Define ENVs for Localization/Globalization ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Fedora-${fromTag} # Install dependencies and clean up RUN curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.rpm \ diff --git a/release/preview/fedora/test-deps/docker/Dockerfile b/release/preview/fedora/test-deps/docker/Dockerfile index d5a9153ec..e6b972d79 100644 --- a/release/preview/fedora/test-deps/docker/Dockerfile +++ b/release/preview/fedora/test-deps/docker/Dockerfile @@ -3,6 +3,8 @@ ARG BaseImage=mcr.microsoft.com/powershell:fedora-28 FROM ${BaseImage} +ARG fromTag=28 + # Install dependencies and clean up RUN dnf install -y \ sudo \ @@ -13,6 +15,8 @@ RUN dnf install -y \ procps-ng \ && dnf clean all +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Fedora-${fromTag} + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:fedora-28 diff --git a/release/preview/nanoserver/docker/Dockerfile b/release/preview/nanoserver/docker/Dockerfile index 50496e558..99da43a46 100755 --- a/release/preview/nanoserver/docker/Dockerfile +++ b/release/preview/nanoserver/docker/Dockerfile @@ -39,6 +39,8 @@ RUN Write-host "Verifying valid Version..."; ` # Install PowerShell into NanoServer FROM ${NanoServerRepo}:${fromTag} +ARG fromTag=1709 + ARG VCS_REF="none" ARG PS_VERSION=6.1.0-rc.1 ARG IMAGE_NAME=mcr.microsoft.com/powershell @@ -65,7 +67,8 @@ ENV ProgramFiles="C:\Program Files" ` LOCALAPPDATA="C:\Users\ContainerAdministrator\AppData\Local" ` PSModuleAnalysisCachePath="$LOCALAPPDATA\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" ` # Persist %PSCORE% ENV variable for user convenience - PSCORE="$ProgramFiles\PowerShell\pwsh.exe" + PSCORE="$ProgramFiles\PowerShell\pwsh.exe" ` + POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-NanoServer-${fromTag}" COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] diff --git a/release/preview/nanoserver1809/docker/Dockerfile b/release/preview/nanoserver1809/docker/Dockerfile index 1b379bc2e..919fc5eee 100755 --- a/release/preview/nanoserver1809/docker/Dockerfile +++ b/release/preview/nanoserver1809/docker/Dockerfile @@ -39,6 +39,8 @@ RUN Write-host "Verifying valid Version..."; ` # Install PowerShell into NanoServer FROM ${NanoServerRepo}:${fromTag} +ARG fromTag=1709 + ARG VCS_REF="none" ARG PS_VERSION=6.2.0-rc.1 ARG IMAGE_NAME=mcr.microsoft.com/powershell @@ -67,7 +69,8 @@ ENV ProgramFiles="C:\Program Files" ` # Persist %PSCORE% ENV variable for user convenience PSCORE="$ProgramFiles\PowerShell\pwsh.exe" ` # Set the default windows path so we can use it - WindowsPATH="C:\Windows\system32;C:\Windows" + WindowsPATH="C:\Windows\system32;C:\Windows" ` + POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-NanoServer-${fromTag}" # Set the path ENV PATH="$WindowsPATH;${ProgramFiles}\PowerShell;" diff --git a/release/preview/opensuse423/docker/Dockerfile b/release/preview/opensuse423/docker/Dockerfile index caa6e0aa6..5b9326bc1 100644 --- a/release/preview/opensuse423/docker/Dockerfile +++ b/release/preview/opensuse423/docker/Dockerfile @@ -37,6 +37,8 @@ RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER} -v # Start a new stage so we lose all the tar.gz layers from the final image FROM ${imageRepo}:${fromTag} +ARG fromTag=42.3 + # Copy only the files we need from the previous stage COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"] @@ -49,8 +51,8 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache - + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-OpenSUSE-${fromTag} # Install dependencies RUN zypper --non-interactive update --skip-interactive \ diff --git a/release/preview/opensuse423/test-deps/docker/Dockerfile b/release/preview/opensuse423/test-deps/docker/Dockerfile index 66b31a398..fd2167edf 100644 --- a/release/preview/opensuse423/test-deps/docker/Dockerfile +++ b/release/preview/opensuse423/test-deps/docker/Dockerfile @@ -3,6 +3,8 @@ ARG BaseImage=mcr.microsoft.com/powershell:opensuse-42.3 FROM ${BaseImage} +ARG fromTag=42.3 + # Install dependencies and clean up RUN zypper --non-interactive update --skip-interactive \ && zypper --non-interactive install \ @@ -16,6 +18,8 @@ RUN zypper --non-interactive update --skip-interactive \ # remove package manager log file && rm -f /var/log/zypp/history /var/log/zypper.log +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-OpenSUSE-${fromTag} + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:centos7 diff --git a/release/preview/ubuntu16.04/docker/Dockerfile b/release/preview/ubuntu16.04/docker/Dockerfile index 52e3b1fc2..2e4beeca6 100644 --- a/release/preview/ubuntu16.04/docker/Dockerfile +++ b/release/preview/ubuntu16.04/docker/Dockerfile @@ -17,7 +17,8 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Ubuntu-16.04 # Install dependencies and clean up RUN apt-get update \ diff --git a/release/preview/ubuntu16.04/test-deps/docker/Dockerfile b/release/preview/ubuntu16.04/test-deps/docker/Dockerfile index d279be2b2..0ffdc1003 100644 --- a/release/preview/ubuntu16.04/test-deps/docker/Dockerfile +++ b/release/preview/ubuntu16.04/test-deps/docker/Dockerfile @@ -14,6 +14,8 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Ubuntu-16.04 + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:ubuntu-16.04 diff --git a/release/preview/ubuntu18.04/docker/Dockerfile b/release/preview/ubuntu18.04/docker/Dockerfile index f3947c1d5..295c1eb45 100644 --- a/release/preview/ubuntu18.04/docker/Dockerfile +++ b/release/preview/ubuntu18.04/docker/Dockerfile @@ -17,7 +17,8 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # set a fixed location for the Module analysis cache - PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Ubuntu-18.04 # Install dependencies and clean up RUN apt-get update \ diff --git a/release/preview/ubuntu18.04/test-deps/docker/Dockerfile b/release/preview/ubuntu18.04/test-deps/docker/Dockerfile index e899e02eb..6668471c6 100644 --- a/release/preview/ubuntu18.04/test-deps/docker/Dockerfile +++ b/release/preview/ubuntu18.04/test-deps/docker/Dockerfile @@ -14,6 +14,8 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Ubuntu-18.04 + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:ubuntu-18.04 diff --git a/release/preview/windowsservercore/docker/Dockerfile b/release/preview/windowsservercore/docker/Dockerfile index 49297cc9c..e25dcf8c4 100755 --- a/release/preview/windowsservercore/docker/Dockerfile +++ b/release/preview/windowsservercore/docker/Dockerfile @@ -39,7 +39,8 @@ ENV ProgramFiles="C:\Program Files" ` LOCALAPPDATA="C:\Users\ContainerAdministrator\AppData\Local" ` PSModuleAnalysisCachePath="$LOCALAPPDATA\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" ` # Persist %PSCORE% ENV variable for user convenience - PSCORE="$ProgramFiles\PowerShell\pwsh.exe" + PSCORE="$ProgramFiles\PowerShell\pwsh.exe" ` + POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-WindowsServerCore-${fromTag}" # Copy PowerShell Core from the installer container COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell\\latest"] diff --git a/tests/container.tests.ps1 b/tests/container.tests.ps1 index 679932452..9fabc8a56 100644 --- a/tests/container.tests.ps1 +++ b/tests/container.tests.ps1 @@ -159,6 +159,7 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { $runTestCases += @{ Name = $_.Name ExpectedVersion = $_.ExpectedVersion + Channel = $_.Channel } } @@ -186,6 +187,7 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { } Context "Run Powershell" { + it "Get PSVersion table from should be " -TestCases $runTestCases -Skip:$script:skipLinuxRun { param( [Parameter(Mandatory=$true)] @@ -194,7 +196,11 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { [Parameter(Mandatory=$true)] [string] - $ExpectedVersion + $ExpectedVersion, + + [Parameter(Mandatory=$true)] + [string] + $Channel ) $actualVersion = Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name @@ -222,7 +228,11 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { [Parameter(Mandatory=$true)] [string] - $ExpectedVersion + $ExpectedVersion, + + [Parameter(Mandatory=$true)] + [string] + $Channel ) $culture = Get-UICultureUsingContainer -Name $Name @@ -240,6 +250,29 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { $gssNtlmSspPath = Get-LinuxGssNtlmSsp -Name $Name $gssNtlmSspPath | Should -Not -BeNullOrEmpty } + + it "Has POWERSHELL_DISTRIBUTION_CHANNEL environment variable defined" -TestCases $runTestCases -Skip:$script:skipLinuxRun { + param( + [Parameter(Mandatory=$true)] + [string] + $name, + + [Parameter(Mandatory=$true)] + [string] + $ExpectedVersion, + + [Parameter(Mandatory=$true)] + [string] + $Channel + ) + + if ($Channel -ne 'preview') { + Set-ItResult -Skipped -Because "Test is not applicable to $Channel" + } + + $psDistChannel = Get-PowerShellDistibutionChannel -TestContext $testContext -Name $Name + $psDistChannel | Should -BeLike "PSDocker-*" + } } Context "Labels" { @@ -535,6 +568,7 @@ Describe "Windows Containers" -Tags 'Behavior', 'Windows' { $runTestCases += @{ Name = $_.Name ExpectedVersion = $_.ExpectedVersion + Channel = $_.Channel } } @@ -559,7 +593,11 @@ Describe "Windows Containers" -Tags 'Behavior', 'Windows' { [Parameter(Mandatory=$true)] [string] - $ExpectedVersion + $ExpectedVersion, + + [Parameter(Mandatory=$true)] + [string] + $Channel ) Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name | should -be $ExpectedVersion @@ -591,6 +629,29 @@ Describe "Windows Containers" -Tags 'Behavior', 'Windows' { $path | should -Match ([System.Text.RegularExpressions.Regex]::Escape("C:\Windows\system32")) } + + it "Has POWERSHELL_DISTRIBUTION_CHANNEL environment variable defined" -TestCases $runTestCases -Skip:$script:skipWindowsRun { + param( + [Parameter(Mandatory=$true)] + [string] + $name, + + [Parameter(Mandatory=$true)] + [string] + $ExpectedVersion, + + [Parameter(Mandatory=$true)] + [string] + $Channel + ) + + if ($Channel -ne 'preview') { + Set-ItResult -Skipped -Because "Test is not applicable to $Channel" + } + + $psDistChannel = Get-PowerShellDistibutionChannel -TestContext $testContext -Name $Name + $psDistChannel | Should -BeLike "PSDocker-*" + } } Context "Labels" { diff --git a/tests/containerTestCommon.psm1 b/tests/containerTestCommon.psm1 index acef6dc10..631800ef7 100644 --- a/tests/containerTestCommon.psm1 +++ b/tests/containerTestCommon.psm1 @@ -226,6 +226,9 @@ function Test-SkipLinux 'Windows*' { return $true } + 'Docker Desktop' { + return $false + } default { throw "Unknown Docker os '$os'" } @@ -308,6 +311,28 @@ function Get-ContainerPath return (Invoke-Docker -Command run -Params $runParams -SuppressHostOutput -PassThru) } +function Get-PowerShellDistibutionChannel +{ + param( + [HashTable] $TestContext, + [string] $Name + ) + + $imageTag = ${Name} + + $runParams = @() + $runParams += '--rm' + + $runParams += $imageTag + $runParams += 'pwsh' + $runParams += '-nologo' + $runParams += '-noprofile' + $runParams += '-c' + $runParams += '$env:POWERSHELL_DISTRIBUTION_CHANNEL' + + return (Invoke-Docker -Command run -Params $runParams -SuppressHostOutput -PassThru) +} + function Get-MetadataUsingContainer { param( diff --git a/vsts-ci.yml b/vsts-ci.yml index 0f8c32919..c4f9098ae 100644 --- a/vsts-ci.yml +++ b/vsts-ci.yml @@ -119,7 +119,7 @@ jobs: stable: false preview: false communityStable: true - continueonerror: false + continueonerror: true - template: .vsts-ci/phase.yml