mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Updates to Docker package tests (#7667)
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
FROM centos:7
|
FROM centos:7
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN yum install -y \
|
RUN yum install -y \
|
||||||
@@ -16,7 +17,7 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||||
|
|
||||||
RUN curl -L -o powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
RUN yum install -y powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
|
RUN yum install -y $PACKAGENAME
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM debian:jessie
|
FROM debian:jessie
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@@ -20,8 +21,8 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN locale-gen $LANG && update-locale
|
RUN locale-gen $LANG && update-locale
|
||||||
|
|
||||||
RUN curl -L -o powershell_$PSVERSIONSTUB-1.debian.8_amd64.deb $PACKAGELOCATIONSTUB/powershell_$PSVERSIONSTUB-1.debian.8_amd64.deb
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
RUN dpkg -i powershell_$PSVERSIONSTUB-1.debian.8_amd64.deb || :
|
RUN dpkg -i $PACKAGENAME || :
|
||||||
RUN apt-get install -y -f
|
RUN apt-get install -y -f
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM debian:stretch
|
FROM debian:stretch
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@@ -20,8 +21,8 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN locale-gen $LANG && update-locale
|
RUN locale-gen $LANG && update-locale
|
||||||
|
|
||||||
RUN curl -L -o powershell_$PSVERSIONSTUB-1.debian.9_amd64.deb $PACKAGELOCATIONSTUB/powershell_$PSVERSIONSTUB-1.debian.9_amd64.deb
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
RUN dpkg -i powershell_$PSVERSIONSTUB-1.debian.9_amd64.deb || :
|
RUN dpkg -i $PACKAGENAME || :
|
||||||
RUN apt-get install -y -f
|
RUN apt-get install -y -f
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM fedora:26
|
FROM fedora:26
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN dnf install -y \
|
RUN dnf install -y \
|
||||||
@@ -19,7 +20,7 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||||
|
|
||||||
RUN curl -L -o powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
RUN dnf install -y powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
|
RUN dnf install -y $PACKAGENAME
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM fedora:27
|
FROM fedora:27
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN dnf install -y \
|
RUN dnf install -y \
|
||||||
@@ -19,7 +20,7 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||||
|
|
||||||
RUN curl -L -o powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
RUN dnf install -y powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
|
RUN dnf install -y $PACKAGENAME
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
FROM fedora:28
|
||||||
|
|
||||||
|
ARG PACKAGENAME
|
||||||
|
ARG PACKAGELOCATION
|
||||||
|
ARG PREVIEWSUFFIX=
|
||||||
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN dnf install -y \
|
||||||
|
curl \
|
||||||
|
glibc-locale-source \
|
||||||
|
git \
|
||||||
|
compat-openssl10 \
|
||||||
|
&& dnf upgrade-minimal -y --security \
|
||||||
|
&& dnf clean all
|
||||||
|
|
||||||
|
# Setup the locale
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LC_ALL $LANG
|
||||||
|
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||||
|
|
||||||
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
|
RUN dnf install -y $PACKAGENAME
|
||||||
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM opensuse:42.2
|
FROM opensuse:42.2
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
ARG POWERSHELL_LINKFILE=/usr/bin/pwsh
|
ARG POWERSHELL_LINKFILE=/usr/bin/pwsh
|
||||||
|
|
||||||
@@ -24,15 +25,15 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||||
|
|
||||||
RUN curl -L -o powershell-$PSVERSIONSTUB-linux-x64.tar.gz $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUB-linux-x64.tar.gz
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
|
|
||||||
# Create the target folder where powershell will be placed
|
# Create the target folder where powershell will be placed
|
||||||
RUN mkdir -p /opt/microsoft/powershell/$PSVERSIONSTUB
|
RUN mkdir -p /opt/microsoft/powershell
|
||||||
# Expand powershell to the target folder
|
# Expand powershell to the target folder
|
||||||
RUN tar zxf powershell-$PSVERSIONSTUB-linux-x64.tar.gz -C /opt/microsoft/powershell/$PSVERSIONSTUB
|
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||||
|
|
||||||
# Create the symbolic link that points to powershell
|
# Create the symbolic link that points to powershell
|
||||||
RUN ln -s /opt/microsoft/powershell/$PSVERSIONSTUB/pwsh $POWERSHELL_LINKFILE
|
RUN ln -s /opt/microsoft/powershell/pwsh $POWERSHELL_LINKFILE
|
||||||
|
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
FROM opensuse:42.3
|
||||||
|
|
||||||
|
ARG PACKAGENAME
|
||||||
|
ARG PACKAGELOCATION
|
||||||
|
ARG PREVIEWSUFFIX=
|
||||||
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
|
ARG POWERSHELL_LINKFILE=/usr/bin/pwsh
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN zypper --non-interactive update --skip-interactive \
|
||||||
|
&& zypper --non-interactive install \
|
||||||
|
glibc-locale \
|
||||||
|
glibc-i18ndata \
|
||||||
|
tar \
|
||||||
|
curl \
|
||||||
|
libunwind \
|
||||||
|
libicu \
|
||||||
|
openssl \
|
||||||
|
git
|
||||||
|
|
||||||
|
# Setup the locale
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LC_ALL $LANG
|
||||||
|
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||||
|
|
||||||
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
|
|
||||||
|
# Create the target folder where powershell will be placed
|
||||||
|
RUN mkdir -p /opt/microsoft/powershell
|
||||||
|
# Expand powershell to the target folder
|
||||||
|
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||||
|
|
||||||
|
# Create the symbolic link that points to powershell
|
||||||
|
RUN ln -s /opt/microsoft/powershell/pwsh $POWERSHELL_LINKFILE
|
||||||
|
|
||||||
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
|
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM ubuntu:trusty
|
FROM ubuntu:trusty
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@@ -20,8 +21,8 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN locale-gen $LANG && update-locale
|
RUN locale-gen $LANG && update-locale
|
||||||
|
|
||||||
RUN curl -L -o powershell_$PSVERSIONSTUB-1.ubuntu.14.04_amd64.deb $PACKAGELOCATIONSTUB/powershell_$PSVERSIONSTUB-1.ubuntu.14.04_amd64.deb
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
RUN dpkg -i powershell_$PSVERSIONSTUB-1.ubuntu.14.04_amd64.deb || :
|
RUN dpkg -i $PACKAGENAME || :
|
||||||
RUN apt-get install -y -f
|
RUN apt-get install -y -f
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM ubuntu:xenial
|
FROM ubuntu:xenial
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
ARG PACKAGENAME
|
||||||
ARG PACKAGELOCATIONSTUB
|
ARG PACKAGELOCATION
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
ARG PREVIEWSUFFIX=
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@@ -20,8 +21,8 @@ ENV LANG en_US.UTF-8
|
|||||||
ENV LC_ALL $LANG
|
ENV LC_ALL $LANG
|
||||||
RUN locale-gen $LANG && update-locale
|
RUN locale-gen $LANG && update-locale
|
||||||
|
|
||||||
RUN curl -L -o powershell_$PSVERSIONSTUB-1.ubuntu.16.04_amd64.deb $PACKAGELOCATIONSTUB/powershell_$PSVERSIONSTUB-1.ubuntu.16.04_amd64.deb
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
RUN dpkg -i powershell_$PSVERSIONSTUB-1.ubuntu.16.04_amd64.deb || :
|
RUN dpkg -i $PACKAGENAME || :
|
||||||
RUN apt-get install -y -f
|
RUN apt-get install -y -f
|
||||||
RUN git clone --recursive $GITLOCATION
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
FROM ubuntu:artful
|
|
||||||
|
|
||||||
ARG PSVERSIONSTUB=6.0.2
|
|
||||||
ARG PACKAGELOCATIONSTUB
|
|
||||||
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
|
||||||
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
apt-utils \
|
|
||||||
ca-certificates \
|
|
||||||
curl \
|
|
||||||
apt-transport-https \
|
|
||||||
locales \
|
|
||||||
git
|
|
||||||
|
|
||||||
# Setup the locale
|
|
||||||
ENV LANG en_US.UTF-8
|
|
||||||
ENV LC_ALL $LANG
|
|
||||||
RUN locale-gen $LANG && update-locale
|
|
||||||
|
|
||||||
RUN curl -L -o powershell_$PSVERSIONSTUB-1.ubuntu.17.04_amd64.deb $PACKAGELOCATIONSTUB/powershell_$PSVERSIONSTUB-1.ubuntu.17.04_amd64.deb
|
|
||||||
RUN dpkg -i powershell_$PSVERSIONSTUB-1.ubuntu.17.04_amd64.deb || :
|
|
||||||
RUN apt-get install -y -f
|
|
||||||
RUN git clone --recursive $GITLOCATION
|
|
||||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
|
ARG PACKAGENAME
|
||||||
|
ARG PACKAGELOCATION
|
||||||
|
ARG PREVIEWSUFFIX=
|
||||||
|
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||||
|
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
apt-utils \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
apt-transport-https \
|
||||||
|
locales \
|
||||||
|
git
|
||||||
|
|
||||||
|
# Setup the locale
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LC_ALL $LANG
|
||||||
|
RUN locale-gen $LANG && update-locale
|
||||||
|
|
||||||
|
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||||
|
RUN dpkg -i $PACKAGENAME || :
|
||||||
|
RUN apt-get install -y -f
|
||||||
|
RUN $TESTDOWNLOADCOMMAND
|
||||||
|
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
||||||
@@ -213,6 +213,63 @@ function Get-ContainerPowerShellVersion
|
|||||||
return (Get-Content -Encoding Ascii $testContext.resolvedLogPath)[0]
|
return (Get-Content -Encoding Ascii $testContext.resolvedLogPath)[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function defines a config mapping for testing Preview packages.
|
||||||
|
# The list of supported OS for each release can be found here:
|
||||||
|
# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms
|
||||||
|
function Get-DefaultPreviewConfigForPackageValidation
|
||||||
|
{
|
||||||
|
# format: <DockerfileFolderName>=<PartOfPackageFilename>
|
||||||
|
@{ 'centos7'='rhel.7';
|
||||||
|
'debian.8'='debian.8';
|
||||||
|
'debian.9'='debian.9';
|
||||||
|
'fedora26'='rhel.7';
|
||||||
|
'fedora27'='rhel.7';
|
||||||
|
'fedora28'='rhel.7';
|
||||||
|
'opensuse42.2'='linux-x64.tar.gz';
|
||||||
|
'opensuse42.3'='linux-x64.tar.gz';
|
||||||
|
'ubuntu14.04'='ubuntu.14.04';
|
||||||
|
'ubuntu16.04'='ubuntu.16.04';
|
||||||
|
'ubuntu18.04'='ubuntu.18.04'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function defines a config mapping for testing Stable packages.
|
||||||
|
# The list of supported OS for each release can be found here:
|
||||||
|
# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms
|
||||||
|
function Get-DefaultStableConfigForPackageValidation
|
||||||
|
{
|
||||||
|
# format: <DockerfileFolderName>=<PartOfPackageFilename>
|
||||||
|
@{ 'centos7'='rhel.7';
|
||||||
|
'debian.8'='debian.8';
|
||||||
|
'debian.9'='debian.9';
|
||||||
|
'fedora26'='rhel.7';
|
||||||
|
'fedora27'='rhel.7';
|
||||||
|
'opensuse42.2'='linux-x64.tar.gz';
|
||||||
|
'opensuse42.3'='linux-x64.tar.gz';
|
||||||
|
'ubuntu14.04'='ubuntu.14.04';
|
||||||
|
'ubuntu16.04'='ubuntu.16.04'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Returns a list of files in a specified Azure container.
|
||||||
|
function Get-PackageNamesOnAzureBlob
|
||||||
|
{
|
||||||
|
param(
|
||||||
|
[string]
|
||||||
|
$ContainerUrl,
|
||||||
|
|
||||||
|
# $SAS (shared access signature) param should include beginning '?' and trailing '&'
|
||||||
|
[string]
|
||||||
|
$SAS
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
$response = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list')
|
||||||
|
|
||||||
|
$xmlResponce = [xml]$response.Substring($response.IndexOf('<EnumerationResults')) # remove some bad chars in the beginning that break XML parsing
|
||||||
|
($xmlResponce.EnumerationResults.Blobs.Blob).Name
|
||||||
|
}
|
||||||
|
|
||||||
# This function is used for basic validation of PS packages during a release;
|
# This function is used for basic validation of PS packages during a release;
|
||||||
# During the process Docker files are filled out and executed with Docker build;
|
# During the process Docker files are filled out and executed with Docker build;
|
||||||
# During the build PS packages are downloaded onto Docker containers, installed and selected Pester tests from PowerShell Github repo are executed.
|
# During the build PS packages are downloaded onto Docker containers, installed and selected Pester tests from PowerShell Github repo are executed.
|
||||||
@@ -222,65 +279,86 @@ function Test-PSPackage
|
|||||||
param(
|
param(
|
||||||
[string]
|
[string]
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
$PSPackageLocation, # e.g. Azure storage
|
$PSPackageLocation, # e.g. Azure container storage url
|
||||||
[string]
|
[string]
|
||||||
$PSVersion = "6.0.2", # e.g. "6.1.0~preview.2"
|
$SAS,# $SAS (shared access signature) param should include beginning '?' and trailing '&'
|
||||||
|
[Hashtable]
|
||||||
|
$Config, # hashtable that maps packages to dockerfiles; for example see Get-DefaultConfigForPackageValidation
|
||||||
[string]
|
[string]
|
||||||
$TestList = "/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module",
|
$TestList = "/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module",
|
||||||
[string]
|
[string]
|
||||||
$GitLocation = "https://github.com/PowerShell/PowerShell.git"
|
$TestDownloadCommand = "git clone --recursive https://github.com/PowerShell/PowerShell.git",
|
||||||
|
[switch]
|
||||||
|
$Preview = $false
|
||||||
)
|
)
|
||||||
|
|
||||||
$PSPackageLocation = $PSPackageLocation.TrimEnd('/','\')
|
$PSPackageLocation = $PSPackageLocation.TrimEnd('/','\') # code below assumes there is no trailing separator in PSPackageLocation url
|
||||||
Write-Verbose "Ensure that PowerShell packages of version $PSVersion exist at $PSPackageLocation" -Verbose
|
$RootFolder = Join-Path $PSScriptRoot 'Templates'
|
||||||
|
|
||||||
$tempFolder = $env:Temp
|
|
||||||
if (-not $tempFolder) {$tempFolder = "~"}
|
|
||||||
$RootFolder = Join-Path $tempFolder 'PSPackageDockerValidation'
|
|
||||||
$SourceFolder = Join-Path $PSScriptRoot 'Templates'
|
|
||||||
|
|
||||||
if (Test-Path $RootFolder)
|
$packageList = Get-PackageNamesOnAzureBlob -ContainerUrl $PSPackageLocation -SAS $SAS
|
||||||
|
if (!$Config)
|
||||||
{
|
{
|
||||||
Remove-Item $RootFolder -Recurse -Force
|
if ($Preview)
|
||||||
|
{
|
||||||
|
$Config = Get-DefaultPreviewConfigForPackageValidation
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$Config = Get-DefaultStableConfigForPackageValidation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Copy-Item -Recurse $SourceFolder $RootFolder
|
# pre-process $Config: verify build directories and packages exist
|
||||||
|
$map = @{}
|
||||||
|
foreach($kp in $Config.GetEnumerator())
|
||||||
|
{
|
||||||
|
$buildDir = Join-Path $RootFolder $kp.Key
|
||||||
|
$packageName = $packageList | Where-Object {$_ -like $('*'+$kp.Value+'*')}
|
||||||
|
|
||||||
|
if (-not (Test-Path $buildDir))
|
||||||
|
{
|
||||||
|
Write-Error "Directory does Not exist - $buildDir; Check `$Config parameter and '$RootFolder' folder"
|
||||||
|
}
|
||||||
|
elseif (-not ($packageName))
|
||||||
|
{
|
||||||
|
Write-Error "Can not find package that matches filter *$($kp.Value)*; Check `$Config parameter and '$PSPackageLocation'"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$map.Add($buildDir, $packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$versionStubName = 'PSVERSIONSTUB'
|
Write-Verbose "Using configuration:" -Verbose
|
||||||
$versionStubValue = $PSVersion
|
Write-Verbose ($map | Format-List | Out-String) -Verbose
|
||||||
$testlistStubName = 'TESTLISTSTUB'
|
|
||||||
$testlistStubValue = $TestList
|
|
||||||
$packageLocationStubName = 'PACKAGELOCATIONSTUB'
|
|
||||||
$packageLocationStubValue = $PSPackageLocation
|
|
||||||
$GitLocationStubName = 'GITLOCATION'
|
|
||||||
$GitLocationStubValue = $GitLocation
|
|
||||||
|
|
||||||
$results = @{}
|
$results = @{}
|
||||||
$returnValue = $true
|
$returnValue = $true
|
||||||
|
|
||||||
# run builds sequentially, but don't block for errors so that configs after failed one can run
|
# run builds sequentially, but don't block for errors so that configs after failed one can run
|
||||||
foreach($dir in Get-ChildItem -Path $RootFolder)
|
foreach($kp in $map.GetEnumerator())
|
||||||
{
|
{
|
||||||
|
$dockerDirPath = $kp.Key
|
||||||
|
$packageFileName = $kp.Value
|
||||||
|
|
||||||
$buildArgs = @()
|
$buildArgs = @()
|
||||||
|
|
||||||
if ($dir.Name -eq "opensuse42.2") # special cases that use dash instead of tilda as preview separator, e.g. 'powershell-6.1.0-preview.2-linux-x64.tar.gz'
|
$buildArgs += "--build-arg","PACKAGENAME=$packageFileName"
|
||||||
|
$buildArgs += "--build-arg","PACKAGELOCATION=$PSPackageLocation"
|
||||||
|
if ($Preview)
|
||||||
{
|
{
|
||||||
$versionStubDashValue = $PSVersion -replace '~','-'
|
$buildArgs += "--build-arg","PREVIEWSUFFIX=-preview"
|
||||||
$buildArgs += "--build-arg","$versionStubName=$versionStubDashValue"
|
|
||||||
}
|
}
|
||||||
else # majority of configurations - they use tilda as preview separator, e.g. 'powershell-6.1.0~preview.2-1.rhel.7.x86_64.rpm'
|
$buildArgs += "--build-arg","TESTLIST=$TestList"
|
||||||
{
|
$buildArgs += "--build-arg","TESTDOWNLOADCOMMAND=$TestDownloadCommand"
|
||||||
$buildArgs += "--build-arg","$versionStubName=$versionStubValue"
|
|
||||||
}
|
|
||||||
|
|
||||||
$buildArgs += "--build-arg","$testlistStubName=$testlistStubValue"
|
|
||||||
$buildArgs += "--build-arg","$packageLocationStubName=$packageLocationStubValue"
|
|
||||||
$buildArgs += "--build-arg","$GitLocationStubName=$GitLocationStubValue"
|
|
||||||
$buildArgs += "--no-cache"
|
$buildArgs += "--no-cache"
|
||||||
$buildArgs += $dir.FullName
|
$buildArgs += $dockerDirPath
|
||||||
|
|
||||||
$dockerResult = Invoke-Docker -Command 'build' -Params $buildArgs -FailureAction warning
|
$dockerResult = Invoke-Docker -Command 'build' -Params $buildArgs -FailureAction warning
|
||||||
$results.Add($dir.Name, $dockerResult)
|
|
||||||
|
$confName = Split-Path -Leaf $dockerDirPath
|
||||||
|
$results.Add($confName, $dockerResult)
|
||||||
if (-not $dockerResult) {$returnValue = $false}
|
if (-not $dockerResult) {$returnValue = $false}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user