-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automation for PS package validation using Docker containers #5401
Automation for PS package validation using Docker containers #5401
Conversation
[string] | ||
$PSVersion = "6.0.0-beta.9", | ||
[string] | ||
$TestList = "/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to review default set of tests to run.
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline at end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated for all files
$results | ||
|
||
return $returnValue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline
foreach($file in $tempateFiles) | ||
{ | ||
(Get-Content $file)` | ||
-replace $versionRpmStubName,$versionRpmStubValue` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add args to the dockerfile and pass them in when running build instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea; Updated to use --build-arg's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use the release dockefiles the just run this command. This would cause less code duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are to test the generated packages before publishing them to Microsoft Repository, so the release dockerfiles won't help here. We need to download the packages from the Azure blob.
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use full cmdlet name Import-Module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated for all files.
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
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 "ipmo /PowerShell/build.psm1;exit (Invoke-Pester {TESTLISTSTUB} -PassThru).FailedCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
$packageLocationStubName = '{PACKAGELOCATIONSTUB}' | ||
$packageLocationStubValue = $PSPackageLocation | ||
|
||
$tempateFiles = (Get-ChildItem -Recurse -Path $RootFolder -Filter Dockerfile).FullName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in variable name $tempateFiles
-> $templateFiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable got removed in refactoring.
$results | ||
|
||
return $returnValue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Export-ModuleMember
to specify which functions are public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless it is required, I'd rather not.
It appears that this module does not do this for other functions.
# 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. | ||
# This function must be run on a Docker host machine in 'Linux containers' mode, such as Windows 10 server with Hyper-V role installed. | ||
function ValidatePSPackage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a public function, should be named Test-PSPackage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to Test-PSPackage
This automation is used for basic validation of PS packages during a release;
Covered configs:
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.