Skip to content

Commit

Permalink
Docker package test fix and updates (PowerShell#6169)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga authored and TravisEz13 committed Feb 22, 2018
1 parent fddfb54 commit acf0dcd
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 51 deletions.
11 changes: 6 additions & 5 deletions docker/tests/Templates/centos7/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/debian.8/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/debian.9/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/fedora26/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/fedora27/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/kalilinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/opensuse42.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/ubuntu14.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/ubuntu16.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
11 changes: 6 additions & 5 deletions docker/tests/Templates/ubuntu17.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"
7 changes: 6 additions & 1 deletion docker/tests/containerTestCommon.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,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('/','\')
Expand All @@ -252,6 +254,8 @@ function Test-PSPackage
$testlistStubValue = $TestList
$packageLocationStubName = 'PACKAGELOCATIONSTUB'
$packageLocationStubValue = $PSPackageLocation
$GitLocationStubName = 'GITLOCATION'
$GitLocationStubValue = $GitLocation

$results = @{}
$returnValue = $true
Expand All @@ -264,6 +268,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

Expand Down

0 comments on commit acf0dcd

Please sign in to comment.