Skip to content

Commit a5ec565

Browse files
authored
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
1 parent 6fa1e86 commit a5ec565

File tree

8 files changed

+82
-11
lines changed

8 files changed

+82
-11
lines changed

tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,20 @@ foreach ($linuxPackage in $linuxPackages)
5858
Write-Verbose "Copying $filePath to $destination" -Verbose
5959
Copy-Item -Path $filePath -Destination $destination -force
6060
}
61+
62+
Write-Verbose "Exporting project.assets files ..." -verbose
63+
64+
$projectAssetsCounter = 1
65+
$projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets'
66+
$projectAssetsZip = Join-Path -Path $destination -ChildPath 'projectAssetssymbols.zip'
67+
Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object {
68+
$itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $projectAssetsCounter
69+
New-Item -Path $itemDestination -ItemType Directory -Force
70+
$file = $_.FullName
71+
Write-Verbose "Copying $file to $itemDestination" -verbose
72+
Copy-Item -Path $file -Destination "$itemDestination\" -Force
73+
$projectAssetsCounter++
74+
}
75+
76+
Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip
77+
Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue

tools/releaseBuild/Images/microsoft_powershell_alpine3/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>"
77
RUN apk update \
88
&& apk add cmake clang build-base git bash
99

10+
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
11+
1012
COPY build-and-run-pwsh.sh /

tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ RUN yum install -y \
2323

2424
COPY PowerShellPackage.ps1 /
2525

26+
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
27+
2628
# Use PowerShell as the default shell
2729
ENTRYPOINT [ "pwsh" ]

tools/releaseBuild/Images/microsoft_powershell_ubuntu14.04/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@ RUN apt-get update \
3232

3333
COPY PowerShellPackage.ps1 /
3434

35+
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
36+
3537
# Use PowerShell as the default shell
3638
ENTRYPOINT [ "pwsh" ]

tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@ RUN apt-get update \
3030

3131
COPY PowerShellPackage.ps1 /
3232

33+
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
34+
3335
# Use PowerShell as the default shell
3436
ENTRYPOINT [ "pwsh" ]

tools/releaseBuild/Images/microsoft_powershell_windowsservercore/DockerFile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ RUN Import-Module ./containerFiles/wix.psm1; `
2121

2222
COPY PowerShellPackage.ps1 /
2323

24+
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
25+
2426
ENTRYPOINT ["C:\\Program Files\\PowerShell\\latest\\pwsh.exe", "-command"]

tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ param (
2525

2626
[Parameter(Mandatory,ParameterSetName='packageSigned')]
2727
[ValidatePattern("-signed.zip$")]
28-
[string]$BuildZip
28+
[string]$BuildZip,
29+
30+
[Parameter(Mandatory,ParameterSetName='ComponentRegistration')]
31+
[switch] $ComponentRegistration
2932
)
3033

3134
$releaseTagParam = @{}
@@ -92,24 +95,46 @@ try{
9295
}
9396

9497
$pspackageParams = @{'Type'='msi'; 'WindowsRuntime'=$Runtime}
95-
if(!$Symbols.IsPresent -and $Runtime -notmatch "arm")
98+
if(!$ComponentRegistration.IsPresent -and !$Symbols.IsPresent -and $Runtime -notmatch "arm")
9699
{
97100
Write-Verbose "Starting powershell packaging(msi)..." -verbose
98101
Start-PSPackage @pspackageParams @releaseTagParam
99102
}
100103

101-
$pspackageParams['Type']='zip'
102-
$pspackageParams['IncludeSymbols']=$Symbols.IsPresent
103-
Write-Verbose "Starting powershell packaging(zip)..." -verbose
104-
Start-PSPackage @pspackageParams @releaseTagParam
104+
if(!$ComponentRegistration.IsPresent)
105+
{
106+
$pspackageParams['Type']='zip'
107+
$pspackageParams['IncludeSymbols']=$Symbols.IsPresent
108+
Write-Verbose "Starting powershell packaging(zip)..." -verbose
109+
Start-PSPackage @pspackageParams @releaseTagParam
110+
111+
Write-Verbose "Exporting packages ..." -verbose
105112

106-
Write-Verbose "Exporting packages ..." -verbose
113+
Get-ChildItem $location\*.msi,$location\*.zip,$location\*.wixpdb | ForEach-Object {
114+
$file = $_.FullName
115+
Write-Verbose "Copying $file to $destination" -verbose
116+
Copy-Item -Path $file -Destination "$destination\" -Force
117+
}
118+
}
119+
else {
120+
Write-Verbose "Exporting project.assets files ..." -verbose
121+
122+
$projectAssetsCounter = 1
123+
$projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets'
124+
$projectAssetsZip = Join-Path -Path $destination -ChildPath 'projectAssetssymbols.zip'
125+
Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object {
126+
$itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $projectAssetsCounter
127+
New-Item -Path $itemDestination -ItemType Directory -Force
128+
$file = $_.FullName
129+
Write-Verbose "Copying $file to $itemDestination" -verbose
130+
Copy-Item -Path $file -Destination "$itemDestination\" -Force
131+
$projectAssetsCounter++
132+
}
107133

108-
Get-ChildItem $location\*.msi,$location\*.zip,$location\*.wixpdb | ForEach-Object {
109-
$file = $_.FullName
110-
Write-Verbose "Copying $file to $destination" -verbose
111-
Copy-Item -Path $file -Destination "$destination\" -Force
134+
Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip
135+
Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue
112136
}
137+
113138
}
114139
finally
115140
{

tools/releaseBuild/build.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@
3434
"DockerImageName": "ps-winsrvcore",
3535
"BinaryBucket": "release"
3636
},
37+
{
38+
"Name": "win-x64-component-registration",
39+
"RepoDestinationPath": "C:\\PowerShell",
40+
"BuildCommand": "C:\\PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -Runtime win7-x64 -ReleaseTag _ReleaseTag_ -ComponentRegistration",
41+
"BuildDockerOptions": [
42+
"-m",
43+
"3968m"
44+
],
45+
"DockerFile": ".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\DockerFile",
46+
"AdditionalContextFiles" :[
47+
".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\PowerShellPackage.ps1",
48+
".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\wix.psm1",
49+
".\\tools\\releaseBuild\\Images\\microsoft_powershell_windowsservercore\\dockerInstall.psm1"
50+
],
51+
"DockerImageName": "ps-winsrvcore",
52+
"BinaryBucket": "results",
53+
"ArtifactsExpected": 1,
54+
"VariableForExtractedBinariesPath": "componentregistration"
55+
},
3756
{
3857
"Name": "win-x64-symbols",
3958
"RepoDestinationPath": "C:\\PowerShell",

0 commit comments

Comments
 (0)