From 9e4a74af92dbc8fb330974c4da9afa983cba0438 Mon Sep 17 00:00:00 2001 From: Andrew Menagarishvili Date: Fri, 16 Feb 2018 13:28:23 -0800 Subject: [PATCH] Docker package test fix and updates --- docker/tests/Templates/centos7/Dockerfile | 11 ++++++----- docker/tests/Templates/debian.8/Dockerfile | 11 ++++++----- docker/tests/Templates/debian.9/Dockerfile | 11 ++++++----- docker/tests/Templates/fedora26/Dockerfile | 11 ++++++----- docker/tests/Templates/fedora27/Dockerfile | 11 ++++++----- docker/tests/Templates/kalilinux/Dockerfile | 11 ++++++----- docker/tests/Templates/opensuse42.2/Dockerfile | 11 ++++++----- docker/tests/Templates/ubuntu14.04/Dockerfile | 11 ++++++----- docker/tests/Templates/ubuntu16.04/Dockerfile | 11 ++++++----- docker/tests/Templates/ubuntu17.04/Dockerfile | 11 ++++++----- docker/tests/containerTestCommon.psm1 | 7 ++++++- 11 files changed, 66 insertions(+), 51 deletions(-) diff --git a/docker/tests/Templates/centos7/Dockerfile b/docker/tests/Templates/centos7/Dockerfile index fc755dde23b..2ad1f561255 100644 --- a/docker/tests/Templates/centos7/Dockerfile +++ b/docker/tests/Templates/centos7/Dockerfile @@ -1,9 +1,10 @@ FROM centos:7 -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 yum install -y \ @@ -18,5 +19,5 @@ RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG RUN curl -L -o powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm RUN yum install -y powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/debian.8/Dockerfile b/docker/tests/Templates/debian.8/Dockerfile index 31a599715ce..912036791e8 100644 --- a/docker/tests/Templates/debian.8/Dockerfile +++ b/docker/tests/Templates/debian.8/Dockerfile @@ -1,9 +1,10 @@ FROM debian:jessie -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 \ @@ -23,5 +24,5 @@ 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 dpkg -i powershell_$PSVERSIONSTUB-1.debian.8_amd64.deb || : RUN apt-get install -y -f -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/debian.9/Dockerfile b/docker/tests/Templates/debian.9/Dockerfile index b64d6891aab..20ccc66e81f 100644 --- a/docker/tests/Templates/debian.9/Dockerfile +++ b/docker/tests/Templates/debian.9/Dockerfile @@ -1,9 +1,10 @@ FROM debian:stretch -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 \ @@ -23,5 +24,5 @@ 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 dpkg -i powershell_$PSVERSIONSTUB-1.debian.9_amd64.deb || : RUN apt-get install -y -f -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/fedora26/Dockerfile b/docker/tests/Templates/fedora26/Dockerfile index d786307b316..f4084ae8ffe 100644 --- a/docker/tests/Templates/fedora26/Dockerfile +++ b/docker/tests/Templates/fedora26/Dockerfile @@ -1,9 +1,10 @@ FROM fedora:26 -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 dnf install -y \ @@ -19,5 +20,5 @@ RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG RUN curl -L -o powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm RUN dnf install -y powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/fedora27/Dockerfile b/docker/tests/Templates/fedora27/Dockerfile index a6bdda064b3..4e6b8b9c862 100644 --- a/docker/tests/Templates/fedora27/Dockerfile +++ b/docker/tests/Templates/fedora27/Dockerfile @@ -1,9 +1,10 @@ FROM fedora:27 -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 dnf install -y \ @@ -18,5 +19,5 @@ RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG RUN curl -L -o powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm RUN dnf install -y powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/kalilinux/Dockerfile b/docker/tests/Templates/kalilinux/Dockerfile index f97424c0c6a..9cf203b5b42 100644 --- a/docker/tests/Templates/kalilinux/Dockerfile +++ b/docker/tests/Templates/kalilinux/Dockerfile @@ -1,9 +1,10 @@ FROM kalilinux/kali-linux-docker:latest -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 \ @@ -25,5 +26,5 @@ RUN curl -L -o powershell_$PSVERSIONSTUB-1.ubuntu.16.04_amd64.deb $PACKAGELOCATI RUN dpkg -i libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb || : RUN dpkg -i powershell_$PSVERSIONSTUB-1.ubuntu.16.04_amd64.deb || : RUN apt-get install -y -f -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/opensuse42.2/Dockerfile b/docker/tests/Templates/opensuse42.2/Dockerfile index d44cbb32ff5..421d2c36a2e 100644 --- a/docker/tests/Templates/opensuse42.2/Dockerfile +++ b/docker/tests/Templates/opensuse42.2/Dockerfile @@ -1,9 +1,10 @@ FROM opensuse:42.2 -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module +ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git ARG POWERSHELL_LINKFILE=/usr/bin/pwsh @@ -34,5 +35,5 @@ RUN tar zxf powershell-$PSVERSIONSTUB-linux-x64.tar.gz -C /opt/microsoft/powersh # Create the symbolic link that points to powershell RUN ln -s /opt/microsoft/powershell/$PSVERSIONSTUB/pwsh $POWERSHELL_LINKFILE -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/ubuntu14.04/Dockerfile b/docker/tests/Templates/ubuntu14.04/Dockerfile index 181610b6c28..1297a215c5f 100644 --- a/docker/tests/Templates/ubuntu14.04/Dockerfile +++ b/docker/tests/Templates/ubuntu14.04/Dockerfile @@ -1,9 +1,10 @@ FROM ubuntu:trusty -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 \ @@ -23,5 +24,5 @@ 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 dpkg -i powershell_$PSVERSIONSTUB-1.ubuntu.14.04_amd64.deb || : RUN apt-get install -y -f -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/ubuntu16.04/Dockerfile b/docker/tests/Templates/ubuntu16.04/Dockerfile index 211e6d974e5..6983cfa2bc0 100644 --- a/docker/tests/Templates/ubuntu16.04/Dockerfile +++ b/docker/tests/Templates/ubuntu16.04/Dockerfile @@ -1,9 +1,10 @@ FROM ubuntu:xenial -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 \ @@ -23,5 +24,5 @@ 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 dpkg -i powershell_$PSVERSIONSTUB-1.ubuntu.16.04_amd64.deb || : RUN apt-get install -y -f -RUN git clone --recursive https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/Templates/ubuntu17.04/Dockerfile b/docker/tests/Templates/ubuntu17.04/Dockerfile index dae4b3fe0c0..3182a12e7b6 100644 --- a/docker/tests/Templates/ubuntu17.04/Dockerfile +++ b/docker/tests/Templates/ubuntu17.04/Dockerfile @@ -1,9 +1,10 @@ FROM ubuntu:zesty -ARG PSVERSIONSTUB -ARG PSVERSIONSTUBRPM +ARG PSVERSIONSTUB=6.0.1 +ARG PSVERSIONSTUBRPM=6.0.1 ARG PACKAGELOCATIONSTUB -ARG TESTLISTSTUB +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 \ @@ -23,5 +24,5 @@ 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 https://github.com/PowerShell/PowerShell.git -RUN pwsh -c "Import-Module /PowerShell/build.psm1;Restore-PSPester -Destination /usr/local/share/powershell/Modules;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount" +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" diff --git a/docker/tests/containerTestCommon.psm1 b/docker/tests/containerTestCommon.psm1 index 68ae2f3491b..2d593ee0e57 100644 --- a/docker/tests/containerTestCommon.psm1 +++ b/docker/tests/containerTestCommon.psm1 @@ -224,7 +224,9 @@ function Test-PSPackage [string] $PSVersion = "6.0.1", [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] + $GitLocation = "https://github.com/PowerShell/PowerShell.git" ) $PSPackageLocation = $PSPackageLocation.TrimEnd('/','\') @@ -250,6 +252,8 @@ function Test-PSPackage $testlistStubValue = $TestList $packageLocationStubName = 'PACKAGELOCATIONSTUB' $packageLocationStubValue = $PSPackageLocation + $GitLocationStubName = 'GITLOCATION' + $GitLocationStubValue = $GitLocation $results = @{} @@ -263,6 +267,7 @@ function Test-PSPackage $buildArgs += "--build-arg","$versionStubName=$versionStubValue" $buildArgs += "--build-arg","$testlistStubName=$testlistStubValue" $buildArgs += "--build-arg","$packageLocationStubName=$packageLocationStubValue" + $buildArgs += "--build-arg","$GitLocationStubName=$GitLocationStubValue" $buildArgs += "--no-cache" $buildArgs += $dir.FullName