From 776d1e6eac25e6977092f99db52a10e77a916acb Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 15 Jun 2018 11:07:27 -0700 Subject: [PATCH] Enable NuGet Package Registration for compliance (#7053) update the Windows release build script with the ability to capture all the project.assets.json files add a Windows build to use the new feature in the release build script update the Linux release build script with the ability to capture all the project.assets.json files -no new build is needed because signing is not currently automated # Conflicts: # tools/releaseBuild/Images/microsoft_powershell_alpine3/Dockerfile --- .../GenericLinuxFiles/PowerShellPackage.ps1 | 17 +++++++ .../microsoft_powershell_alpine3/Dockerfile | 12 +++++ .../microsoft_powershell_centos7/Dockerfile | 2 + .../Dockerfile | 2 + .../Dockerfile | 2 + .../DockerFile | 2 + .../PowerShellPackage.ps1 | 47 ++++++++++++++----- tools/releaseBuild/build.json | 19 ++++++++ 8 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 tools/releaseBuild/Images/microsoft_powershell_alpine3/Dockerfile diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index 74b3762e79..e9e8ab378c 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -55,3 +55,20 @@ foreach ($linuxPackage in $linuxPackages) Write-Verbose "Copying $filePath to $destination" -Verbose Copy-Item -Path $filePath -Destination $destination -force } + +Write-Verbose "Exporting project.assets files ..." -verbose + +$projectAssetsCounter = 1 +$projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets' +$projectAssetsZip = Join-Path -Path $destination -ChildPath 'projectAssetssymbols.zip' +Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object { + $itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $projectAssetsCounter + New-Item -Path $itemDestination -ItemType Directory -Force + $file = $_.FullName + Write-Verbose "Copying $file to $itemDestination" -verbose + Copy-Item -Path $file -Destination "$itemDestination\" -Force + $projectAssetsCounter++ +} + +Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip +Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue diff --git a/tools/releaseBuild/Images/microsoft_powershell_alpine3/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_alpine3/Dockerfile new file mode 100644 index 0000000000..4bdbd2a0af --- /dev/null +++ b/tools/releaseBuild/Images/microsoft_powershell_alpine3/Dockerfile @@ -0,0 +1,12 @@ +# Docker image file that describes an Centos7 image with PowerShell installed from Microsoft YUM Repo + +FROM microsoft/dotnet:2.1-sdk-alpine +LABEL maintainer="PowerShell Team " + +# Install dependencies and clean up +RUN apk update \ + && apk add cmake clang build-base git bash + +ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + +COPY build-and-run-pwsh.sh / diff --git a/tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile index b7a5997182..10955fbf67 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile +++ b/tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile @@ -23,5 +23,7 @@ RUN yum install -y \ COPY PowerShellPackage.ps1 / +ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + # Use PowerShell as the default shell ENTRYPOINT [ "pwsh" ] diff --git a/tools/releaseBuild/Images/microsoft_powershell_ubuntu14.04/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_ubuntu14.04/Dockerfile index debdc50b07..7eb7a6d613 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_ubuntu14.04/Dockerfile +++ b/tools/releaseBuild/Images/microsoft_powershell_ubuntu14.04/Dockerfile @@ -32,5 +32,7 @@ RUN apt-get update \ COPY PowerShellPackage.ps1 / +ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + # Use PowerShell as the default shell ENTRYPOINT [ "pwsh" ] diff --git a/tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile index 5c036ebab2..7c6779f0a0 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile +++ b/tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile @@ -30,5 +30,7 @@ RUN apt-get update \ COPY PowerShellPackage.ps1 / +ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + # Use PowerShell as the default shell ENTRYPOINT [ "pwsh" ] diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile index c8be0a943e..f6ebd133b4 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile @@ -21,4 +21,6 @@ RUN Import-Module ./containerFiles/wix.psm1; ` COPY PowerShellPackage.ps1 / +ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + ENTRYPOINT ["C:\\Program Files\\PowerShell\\latest\\pwsh.exe", "-command"] diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index d9f4b4fdea..bcd47e740c 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -23,7 +23,10 @@ param ( [Parameter(Mandatory,ParameterSetName='packageSigned')] [ValidatePattern("-signed.zip$")] - [string]$BuildZip + [string]$BuildZip, + + [Parameter(Mandatory,ParameterSetName='ComponentRegistration')] + [switch] $ComponentRegistration ) $releaseTagParam = @{} @@ -90,24 +93,46 @@ try{ } $pspackageParams = @{'Type'='msi'; 'WindowsRuntime'=$Runtime} - if(!$Symbols.IsPresent -and $Runtime -notmatch "arm") + if(!$ComponentRegistration.IsPresent -and !$Symbols.IsPresent -and $Runtime -notmatch "arm") { Write-Verbose "Starting powershell packaging(msi)..." -verbose Start-PSPackage @pspackageParams @releaseTagParam } - $pspackageParams['Type']='zip' - $pspackageParams['IncludeSymbols']=$Symbols.IsPresent - Write-Verbose "Starting powershell packaging(zip)..." -verbose - Start-PSPackage @pspackageParams @releaseTagParam + if(!$ComponentRegistration.IsPresent) + { + $pspackageParams['Type']='zip' + $pspackageParams['IncludeSymbols']=$Symbols.IsPresent + Write-Verbose "Starting powershell packaging(zip)..." -verbose + Start-PSPackage @pspackageParams @releaseTagParam - Write-Verbose "Exporting packages ..." -verbose + Write-Verbose "Exporting packages ..." -verbose - Get-ChildItem $location\*.msi,$location\*.zip,$location\*.wixpdb | ForEach-Object { - $file = $_.FullName - Write-Verbose "Copying $file to $destination" -verbose - Copy-Item -Path $file -Destination "$destination\" -Force + Get-ChildItem $location\*.msi,$location\*.zip,$location\*.wixpdb | ForEach-Object { + $file = $_.FullName + Write-Verbose "Copying $file to $destination" -verbose + Copy-Item -Path $file -Destination "$destination\" -Force + } } + else { + Write-Verbose "Exporting project.assets files ..." -verbose + + $projectAssetsCounter = 1 + $projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets' + $projectAssetsZip = Join-Path -Path $destination -ChildPath 'projectAssetssymbols.zip' + Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object { + $itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $projectAssetsCounter + New-Item -Path $itemDestination -ItemType Directory -Force + $file = $_.FullName + Write-Verbose "Copying $file to $itemDestination" -verbose + Copy-Item -Path $file -Destination "$itemDestination\" -Force + $projectAssetsCounter++ + } + + Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip + Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue + } + } finally { diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json index 505c7256ab..99551947c6 100644 --- a/tools/releaseBuild/build.json +++ b/tools/releaseBuild/build.json @@ -34,6 +34,25 @@ "DockerImageName": "ps-winsrvcore", "BinaryBucket": "release" }, + { + "Name": "win-x64-component-registration", + "RepoDestinationPath": "C:\\PowerShell", + "BuildCommand": "C:\\PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -Runtime win7-x64 -ReleaseTag _ReleaseTag_ -ComponentRegistration", + "BuildDockerOptions": [ + "-m", + "3968m" + ], + "DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile", + "AdditionalContextFiles" :[ + ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1", + ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1", + ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1" + ], + "DockerImageName": "ps-winsrvcore", + "BinaryBucket": "results", + "ArtifactsExpected": 1, + "VariableForExtractedBinariesPath": "componentregistration" + }, { "Name": "win-x64-symbols", "RepoDestinationPath": "C:\\PowerShell",