Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ function Start-PSBuild {
# If this parameter is not provided it will get determined automatically.
[ValidateSet("alpine-x64",
"fxdependent",
"fxdependent-alpine-x64",
"fxdependent-linux-x64",
"fxdependent-linux-arm64",
"fxdependent-win-desktop",
Expand Down Expand Up @@ -887,6 +888,7 @@ function New-PSOptions {
[ValidateSet("",
"alpine-x64",
"fxdependent",
"fxdependent-alpine-x64",
"fxdependent-linux-x64",
"fxdependent-linux-arm64",
"fxdependent-win-desktop",
Expand Down Expand Up @@ -973,7 +975,7 @@ function New-PSOptions {

# Build the Output path
if (!$Output) {
if ($Runtime -like 'fxdependent*' -and $Runtime -like 'fxdependent*linux*') {
if ($Runtime -like 'fxdependent*' -and ($Runtime -like 'fxdependent*linux*' -or $Runtime -like 'fxdependent*alpine*')) {
$outputRuntime = $Runtime -replace 'fxdependent-', ''
$Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $outputRuntime, "publish", $Executable)
}
Expand Down
80 changes: 71 additions & 9 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Start-PSPackage {
[string]$Name = "powershell",

# Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported
[ValidateSet("msix", "deb", "osxpkg", "rpm", "rpm-fxdependent", "rpm-fxdependent-arm64", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size")]
[ValidateSet("msix", "deb", "osxpkg", "rpm", "rpm-fxdependent", "rpm-fxdependent-arm64", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size", "tar-alpine-fxdependent")]
[string[]]$Type,

# Generate windows downlevel package
Expand Down Expand Up @@ -114,6 +114,9 @@ function Start-PSPackage {
} elseif ($Type.Count -eq 1 -and $Type[0] -eq "rpm-fxdependent-arm64") {
New-PSOptions -Configuration "Release" -Runtime 'fxdependent-linux-arm64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
}
elseif ($Type.Count -eq 1 -and $Type[0] -eq "tar-alpine-fxdependent") {
New-PSOptions -Configuration "Release" -Runtime 'fxdependent-alpine-x64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
}
else {
New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
}
Expand Down Expand Up @@ -417,7 +420,7 @@ function Start-PSPackage {
}
}
}
{ $_ -like "fxdependent*" } {
{ $_ -like "fxdependent*"} {
if ($Environment.IsWindows) {
$Arguments = @{
PackageNameSuffix = $NameSuffix
Expand Down Expand Up @@ -449,6 +452,25 @@ function Start-PSPackage {
}
}
}
"tar-alpine-fxdependent" {
if ($Environment.IsLinux) {
$Arguments = @{
PackageSourcePath = $Source
Name = $Name
PackageNameSuffix = 'alpine-fxdependent'
Version = $Version
Force = $Force
R2RVerification = [R2RVerification]@{
R2RState = 'R2R'
OperatingSystem = "Linux"
}
}

if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
New-TarballPackage @Arguments
}
}
}
"msi" {
$TargetArchitecture = "x64"
$r2rArchitecture = "amd64"
Expand Down Expand Up @@ -3983,6 +4005,13 @@ function ReduceFxDependentPackage
$runtimeFolder = Get-ChildItem $Path -Recurse -Directory -Filter 'runtimes'

$runtimeFolderPath = $runtimeFolder | Out-String

if ($runtimeFolder.Count -eq 0)
{
Write-Log -message "No runtimes folder found under $Path. Completing cleanup."
return
}

Write-Log -message $runtimeFolderPath

if ($runtimeFolder.Count -eq 0)
Expand Down Expand Up @@ -4037,7 +4066,8 @@ function Start-PrepForGlobalToolNupkg
param(
[Parameter(Mandatory)] [string] $LinuxBinPath,
[Parameter(Mandatory)] [string] $WindowsBinPath,
[Parameter(Mandatory)] [string] $WindowsDesktopBinPath
[Parameter(Mandatory)] [string] $WindowsDesktopBinPath,
[Parameter(Mandatory)] [string] $AlpineBinPath
)

Write-Log "Start-PrepForGlobalToolNupkg: Running clean up for New-GlobalToolNupkg package creation."
Expand All @@ -4054,7 +4084,7 @@ function Start-PrepForGlobalToolNupkg
}

# Remove unnecessary xml files
Get-ChildItem -Path $LinuxBinPath, $WindowsBinPath, $WindowsDesktopBinPath -Filter *.xml | Remove-Item -Verbose
Get-ChildItem -Path $LinuxBinPath, $WindowsBinPath, $WindowsDesktopBinPath, $AlpineBinPath -Filter *.xml | Remove-Item -Verbose
}

<#
Expand Down Expand Up @@ -4089,6 +4119,7 @@ function New-GlobalToolNupkgSource
[Parameter(Mandatory)] [string] $LinuxBinPath,
[Parameter(Mandatory)] [string] $WindowsBinPath,
[Parameter(Mandatory)] [string] $WindowsDesktopBinPath,
[Parameter(Mandatory)] [string] $AlpineBinPath,
[Parameter(Mandatory)] [string] $PackageVersion
)

Expand All @@ -4099,6 +4130,9 @@ function New-GlobalToolNupkgSource
Write-Log "New-GlobalToolNupkgSource: Reducing size of Linux package"
ReduceFxDependentPackage -Path $LinuxBinPath

Write-Log "New-GlobalToolNupkgSource: Reducing size of Alpine package"
ReduceFxDependentPackage -Path $AlpineBinPath

Write-Log "New-GlobalToolNupkgSource: Reducing size of Windows package"
ReduceFxDependentPackage -Path $WindowsBinPath -KeepWindowsRuntimes

Expand Down Expand Up @@ -4148,11 +4182,8 @@ function New-GlobalToolNupkgSource

$ridFolder = New-Item -Path (Join-Path $RootFolder "tools/$script:netCoreRuntime/any") -ItemType Directory

Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $LinuxBinPath for $PackageType"
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
Remove-Item -Path $ridFolder/runtimes/linux-arm -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/linux-arm64 -Recurse -Force
Remove-Item -Path $ridFolder/runtimes/osx -Recurse -Force
Write-Log "New-GlobalToolNupkgSource: Copying runtime assemblies from $AlpineBinPath for $PackageType"
Copy-Item "$AlpineBinPath/*" -Destination $ridFolder -Recurse
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
}

Expand Down Expand Up @@ -4329,6 +4360,7 @@ ${minSizeLinuxBuildFolder} = 'pwshLinuxBuildMinSize'
${arm32LinuxBuildFolder} = 'pwshLinuxBuildArm32'
${arm64LinuxBuildFolder} = 'pwshLinuxBuildArm64'
${amd64MarinerBuildFolder} = 'pwshMarinerBuildAmd64'
${amd64AlpineFxdBuildFolder} = 'pwshAlpineFxdBuildAmd64'
${arm64MarinerBuildFolder} = 'pwshMarinerBuildArm64'

<#
Expand Down Expand Up @@ -4432,6 +4464,16 @@ function Invoke-AzDevOpsLinuxPackageCreation {
Write-Verbose -Verbose "options.Top $($options.Top)"

Start-PSPackage -Type rpm-fxdependent-arm64 @releaseTagParam -LTS:$LTS
} elseif ($BuildType -eq 'alpine') {
Restore-PSOptions -PSOptionsPath "${env:SYSTEM_ARTIFACTSDIRECTORY}\${amd64AlpineFxdBuildFolder}-meta\psoptions.json"
$filePermissionFile = "${env:SYSTEM_ARTIFACTSDIRECTORY}\${amd64AlpineFxdBuildFolder}-meta\linuxFilePermission.json"
Set-LinuxFilePermission -FilePath $filePermissionFile -RootPath "${env:SYSTEM_ARTIFACTSDIRECTORY}\${amd64AlpineFxdBuildFolder}"

Write-Verbose -Verbose "---- tar-alpine-fxdependent ----"
Write-Verbose -Verbose "options.Output: $($options.Output)"
Write-Verbose -Verbose "options.Top $($options.Top)"

Start-PSPackage -Type tar-alpine-fxdependent @releaseTagParam -LTS:$LTS
}
}
catch {
Expand Down Expand Up @@ -4537,6 +4579,7 @@ function Invoke-AzDevOpsLinuxPackageBuild {
## Build for Mariner arm64
$options = Get-PSOptions
Write-Verbose -Verbose "---- Mariner arm64 ----"

Write-Verbose -Verbose "options.Output: $($options.Output)"
Write-Verbose -Verbose "options.Top $($options.Top)"
$binDir = Join-Path -Path $options.Top -ChildPath 'bin'
Expand All @@ -4547,6 +4590,25 @@ function Invoke-AzDevOpsLinuxPackageBuild {

$buildParams['Runtime'] = 'fxdependent-linux-arm64'
$buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${arm64MarinerBuildFolder}"

Start-PSBuild -Clean @buildParams @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json"
# Remove symbol files, xml document files.
Remove-Item "${buildFolder}\*.pdb", "${buildFolder}\*.xml" -Force
Get-ChildItem -Path $buildFolder -Recurse -File | Export-LinuxFilePermission -FilePath "${buildFolder}-meta/linuxFilePermission.json" -RootPath ${buildFolder} -Force
} elseif ($BuildType -eq 'alpine') {
## Build for alpine fxdependent
$options = Get-PSOptions
Write-Verbose -Verbose "---- fxdependent alpine x64 ----"
Write-Verbose -Verbose "options.Output: $($options.Output)"
Write-Verbose -Verbose "options.Top $($options.Top)"
$binDir = Join-Path -Path $options.Top -ChildPath 'bin'
if (Test-Path -Path $binDir) {
Write-Verbose -Verbose "Remove $binDir, to get a clean build for Mariner package"
Remove-Item -Path $binDir -Recurse -Force
}

$buildParams['Runtime'] = 'fxdependent-alpine-x64'
$buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${amd64AlpineFxdBuildFolder}"
Start-PSBuild -Clean @buildParams @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json"
# Remove symbol files, xml document files.
Remove-Item "${buildFolder}\*.pdb", "${buildFolder}\*.xml" -Force
Expand Down
20 changes: 13 additions & 7 deletions tools/releaseBuild/azureDevOps/releaseBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ stages:
unsignedBuildArtifactName: pwshLinuxBuild.tar.gz
signedBuildArtifactName: pwshLinuxBuildAlpine.tar.gz
signedArtifactContainer: authenticode-signed
linux-x64-Alpine-Fxdependent:
runtime: linux-x64-Alpine-Fxdependent
unsignedBuildArtifactContainer: pwshAlpineFxdBuildAmd64.tar.gz
unsignedBuildArtifactName: pwshAlpineFxdBuildAmd64.tar.gz
signedBuildArtifactName: pwshAlpineFxdBuildAmd64.tar.gz
signedArtifactContainer: authenticode-signed
linux-arm32:
runtime: linux-arm32
unsignedBuildArtifactContainer: pwshLinuxBuildArm32.tar.gz
Expand Down Expand Up @@ -338,19 +344,19 @@ stages:
parameters:
buildArchitecture: arm64

# This is done late so that we dont use resources before the big signing and packaging tasks.
- stage: compliance
dependsOn: ['package_signing']
jobs:
- template: templates/compliance.yml

- stage: nuget_and_json
displayName: NuGet Packaging and Build Json
dependsOn: [package_signing]
dependsOn: ['package_signing']
jobs:
- template: templates/nuget.yml
- template: templates/json.yml

# This is done late so that we dont use resources before the big signing and packaging tasks.
- stage: compliance
dependsOn: ['package_signing']
jobs:
- template: templates/compliance.yml

- stage: test_and_release_artifacts
displayName: Test and Release Artifacts
dependsOn: ['prep']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
- name: LinuxBinPath
- name: WindowsBinPath
- name: WindowsDesktopBinPath
- name: AlpineBinPath
- name: DestinationPath
- name: ListOfPackageTypes
type: object
Expand All @@ -21,10 +22,11 @@ steps:
Write-Verbose -Verbose 'LinuxBinPath path: ${{ parameters.LinuxBinPath }}'
Write-Verbose -Verbose 'WindowsBinPath path: ${{ parameters.WindowsBinPath }}'
Write-Verbose -Verbose 'WindowsDesktopBinPath path: ${{ parameters.WindowsDesktopBinPath }}'
Write-Verbose -Verbose 'AlpineBinPath path: ${{ parameters.AlpineBinPath }}'

Import-Module -Name $env:REPOROOT\build.psm1
Import-Module -Name $env:REPOROOT\tools\packaging
Start-PrepForGlobalToolNupkg -LinuxBinPath '${{ parameters.LinuxBinPath }}' -WindowsBinPath '${{ parameters.WindowsBinPath }}' -WindowsDesktopBinPath '${{ parameters.WindowsDesktopBinPath }}'
Start-PrepForGlobalToolNupkg -LinuxBinPath '${{ parameters.LinuxBinPath }}' -WindowsBinPath '${{ parameters.WindowsBinPath }}' -WindowsDesktopBinPath '${{ parameters.WindowsDesktopBinPath }}' -AlpineBinPath '${{ parameters.AlpineBinPath }}'
displayName: 'Preparation for Global Tools package creation.'

# NOTE: The Unified package must always be created first, and so must always be first in ListOfPackageTypes.
Expand All @@ -38,7 +40,7 @@ steps:
# Create global tool NuSpec source for package.
Import-Module -Name $env:REPOROOT\build.psm1
Import-Module -Name $env:REPOROOT\tools\packaging
New-GlobalToolNupkgSource -PackageType $PackageType -PackageVersion '${{ parameters.PackageVersion }}' -LinuxBinPath '${{ parameters.LinuxBinPath }}' -WindowsBinPath '${{ parameters.WindowsBinPath }}' -WindowsDesktopBinPath '${{ parameters.WindowsDesktopBinPath }}'
New-GlobalToolNupkgSource -PackageType $PackageType -PackageVersion '${{ parameters.PackageVersion }}' -LinuxBinPath '${{ parameters.LinuxBinPath }}' -WindowsBinPath '${{ parameters.WindowsBinPath }}' -WindowsDesktopBinPath '${{ parameters.WindowsDesktopBinPath }}' -AlpineBinPath '${{ parameters.AlpineBinPath }}'
displayName: 'Create global tool NuSpec source for package.'

- pwsh: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ jobs:
path: $(Build.ArtifactStagingDirectory)/linuxTars/pwshLinuxBuildAlpine.tar.gz
displayName: Download alpine build

- task: DownloadPipelineArtifact@2
inputs:
artifact: pwshLinuxBuildAlpine.tar.gz
path: $(Build.ArtifactStagingDirectory)/linuxTars/pwshAlpineFxdBuildAmd64.tar.gz
displayName: Download alpine fxdependent build

- task: DownloadPipelineArtifact@2
inputs:
artifact: pwshLinuxBuildFxdependent.tar.gz
Expand Down Expand Up @@ -101,6 +107,10 @@ jobs:
New-Item -Path $(Build.ArtifactStagingDirectory)/pwshLinuxBuildAlpine -ItemType Directory
tar -xf $(Build.ArtifactStagingDirectory)/linuxTars/pwshLinuxBuildAlpine.tar.gz/pwshLinuxBuild.tar.gz -C $(Build.ArtifactStagingDirectory)/pwshLinuxBuildAlpine

Write-Verbose -Verbose -Message "Expanding $(Build.ArtifactStagingDirectory)/linuxTars/pwshAlpineFxdBuildAmd64.tar.gz/pwshAlpineFxdBuildAmd64.tar.gz to $(Build.ArtifactStagingDirectory)/pwshLinuxBuildAlpineFxd"
New-Item -Path $(Build.ArtifactStagingDirectory)/pwshLinuxBuildAlpineFxd -ItemType Directory
tar -xf $(Build.ArtifactStagingDirectory)/linuxTars/pwshAlpineFxdBuildAmd64.tar.gz/pwshAlpineFxdBuildAmd64.tar.gz -C $(Build.ArtifactStagingDirectory)/pwshLinuxBuildAlpineFxd

Write-Verbose -Verbose -Message "Expanding $(Build.ArtifactStagingDirectory)/linuxTars/pwshLinuxBuildFxdependent.tar.gz/pwshLinuxBuild.tar.gz to $(Build.ArtifactStagingDirectory)/pwshLinuxBuildFxdependent"
New-Item -Path $(Build.ArtifactStagingDirectory)/pwshLinuxBuildFxdependent -ItemType Directory
tar -xf $(Build.ArtifactStagingDirectory)/linuxTars/pwshLinuxBuildFxdependent.tar.gz/pwshLinuxBuild.tar.gz -C $(Build.ArtifactStagingDirectory)/pwshLinuxBuildFxdependent
Expand Down Expand Up @@ -163,6 +173,11 @@ jobs:
binLocation: pwshLinuxBuildAlpine
buildPrefixName: 'PowerShell Linux Alpine x64'

- template: signBuildFiles.yml
parameters:
binLocation: pwshLinuxBuildAlpineFxd
buildPrefixName: 'PowerShell Linux Alpine Fxd x64'

- template: signBuildFiles.yml
parameters:
binLocation: pwshLinuxBuildFxdependent
Expand Down
19 changes: 19 additions & 0 deletions tools/releaseBuild/azureDevOps/templates/linux-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ jobs:
pattern: '**/pwshLinuxBuildAlpine.tar.gz'
displayName: Download alpine build

- ${{ if eq(variables.build,'alpine') }} :
- task: DownloadPipelineArtifact@2
inputs:
artifact: authenticode-signed
path: $(Build.ArtifactStagingDirectory)/pwshAlpineFxdBuildAmd64-signed
pattern: '**/pwshAlpineFxdBuildAmd64.tar.gz'
displayName: Download alpine framework dependent build

- ${{ if eq(variables.build,'fxdependent') }} :
- task: DownloadPipelineArtifact@2
inputs:
Expand Down Expand Up @@ -134,6 +142,13 @@ jobs:
path: $(Build.ArtifactStagingDirectory)/pwshLinuxBuild-meta
displayName: Download alpine build meta

- ${{ if eq(variables.build,'alpine') }} :
- task: DownloadPipelineArtifact@2
inputs:
artifact: pwshAlpineFxdBuildAmd64-meta
path: $(Build.ArtifactStagingDirectory)/pwshAlpineFxdBuildAmd64-meta
displayName: Download alpine build meta

- ${{ if eq(variables.build,'fxdependent') }} :
- task: DownloadPipelineArtifact@2
inputs:
Expand Down Expand Up @@ -182,6 +197,10 @@ jobs:
Write-Verbose -Verbose "Expanding $(Build.ArtifactStagingDirectory)/pwshLinuxBuildAlpine-signed/pwshLinuxBuildAlpine.tar.gz to $(Build.ArtifactStagingDirectory)/pwshLinuxBuild"
New-Item -Path $(Build.ArtifactStagingDirectory)/pwshLinuxBuild -ItemType Directory
tar -xf $(Build.ArtifactStagingDirectory)/pwshLinuxBuildAlpine-signed/pwshLinuxBuildAlpine.tar.gz -C $(Build.ArtifactStagingDirectory)/pwshLinuxBuild

Write-Verbose -Verbose "Expanding $(Build.ArtifactStagingDirectory)/pwshAlpineFxdBuildAmd64-signed/pwshAlpineFxdBuildAmd64.tar.gz to $(Build.ArtifactStagingDirectory)/pwshAlpineFxdBuildAmd64"
New-Item -Path $(Build.ArtifactStagingDirectory)/pwshAlpineFxdBuildAmd64 -ItemType Directory
tar -xf $(Build.ArtifactStagingDirectory)/pwshAlpineFxdBuildAmd64-signed/pwshAlpineFxdBuildAmd64.tar.gz -C $(Build.ArtifactStagingDirectory)/pwshAlpineFxdBuildAmd64
}

if ('$(build)' -eq 'fxdependent') {
Expand Down
Loading