Make Linux package universal. by TravisEz13 · Pull Request #15109 · PowerShell/PowerShell · GitHub
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
8 changes: 8 additions & 0 deletions .vsts-ci/linux.yml
92 changes: 92 additions & 0 deletions .vsts-ci/linux/templates/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
parameters:
pool: 'ubuntu-16.04'
parentJobs: []
name: 'Linux'

jobs:
- job: ${{ parameters.name }}_packaging
dependsOn:
${{ parameters.parentJobs }}
pool:
vmImage: ${{ parameters.pool }}

displayName: ${{ parameters.name }} packaging

steps:
- pwsh: |
Get-ChildItem -Path env:
displayName: Capture Environment
condition: succeededOrFailed()

- task: DownloadBuildArtifacts@0
displayName: 'Download build artifacts'
inputs:
downloadType: specific
itemPattern: |
build/**/*
downloadPath: '$(System.ArtifactsDirectory)'

- pwsh: |
Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse
displayName: 'Capture Artifacts Directory'
continueOnError: true

- pwsh: |
Import-Module .\build.psm1
Start-PSBootstrap -Package
displayName: Bootstrap

- pwsh: |
Import-Module ./build.psm1
displayName: 'Capture Artifacts Directory'
continueOnError: true

- task: ExtractFiles@1
displayName: 'Extract Build ZIP'
inputs:
archiveFilePatterns: '$(System.ArtifactsDirectory)/build/build.zip'
destinationFolder: '$(System.ArtifactsDirectory)/bins'

- bash: |
find "$(System.ArtifactsDirectory)/bins" -type d -exec chmod +rwx {} \;
find "$(System.ArtifactsDirectory)/bins" -type f -exec chmod +rw {} \;
displayName: 'Fix permissions'
continueOnError: true

- pwsh: |
Get-ChildItem "$(System.ArtifactsDirectory)\bins\*" -Recurse -ErrorAction SilentlyContinue
displayName: 'Capture Extracted Build ZIP'
continueOnError: true

- pwsh: |
Import-Module .\tools\ci.psm1
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
$options = (Get-PSOptions)
$rootPath = '$(System.ArtifactsDirectory)\bins'
$originalRootPath = Split-Path -path $options.Output
$path = Join-Path -path $rootPath -ChildPath (split-path -leaf -path $originalRootPath)
$pwshPath = Join-Path -path $path -ChildPath 'pwsh'
chmod a+x $pwshPath
$options.Output = $pwshPath
Set-PSOptions $options
Invoke-CIFinish
displayName: Packaging Tests
condition: succeeded()

- pwsh: |
Get-ChildItem "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}\*.deb" -Recurse | ForEach-Object {
$packagePath = $_.FullName
Write-Host "Uploading $packagePath"
Write-Host "##vso[artifact.upload containerfolder=deb;artifactname=deb]$packagePath"
}
Get-ChildItem "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}\*.rpm" -Recurse | ForEach-Object {
$packagePath = $_.FullName
Write-Host "Uploading $packagePath"
Write-Host "##vso[artifact.upload containerfolder=rpm;artifactname=rpm]$packagePath"
}
Get-ChildItem "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}\*.tar.gz" -Recurse | ForEach-Object {
$packagePath = $_.FullName
Write-Host "Uploading $packagePath"
Write-Host "##vso[artifact.upload containerfolder=rpm;artifactname=rpm]$packagePath"
}
displayName: Upload packages
3 changes: 2 additions & 1 deletion .vsts-ci/templates/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')

- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
- ${{ if ne(variables['AzDevOpsFeed'], '') }}:
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml

- pwsh: |
if (Test-Path -Path $HOME/.dotnet) {
Expand Down
25 changes: 11 additions & 14 deletions tools/ci.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ function New-LinuxPackage

# Only build packages for PowerShell/PowerShell repository
# branches, not pull requests
$packages = @(Start-PSPackage @packageParams -SkipReleaseChecks)
$packages = @(Start-PSPackage @packageParams -SkipReleaseChecks -Type deb, rpm, tar)
foreach($package in $packages)
{
if (Test-Path $package)
Expand All @@ -725,21 +725,18 @@ function New-LinuxPackage
Write-Error -Message "Package NOT found: $package"
}

if($isFullBuild)
if ($package -isnot [System.IO.FileInfo])
{
if ($package -isnot [System.IO.FileInfo])
{
$packageObj = Get-Item $package
Write-Error -Message "The PACKAGE is not a FileInfo object"
}
else
{
$packageObj = $package
}

Write-Log -message "Artifacts directory: ${env:BUILD_ARTIFACTSTAGINGDIRECTORY}"
Copy-Item $packageObj.FullName -Destination "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}" -Force
$packageObj = Get-Item $package
Write-Error -Message "The PACKAGE is not a FileInfo object"
}
else
{
$packageObj = $package
}

Write-Log -message "Artifacts directory: ${env:BUILD_ARTIFACTSTAGINGDIRECTORY}"
Copy-Item $packageObj.FullName -Destination "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}" -Force
}

if ($IsLinux)
Expand Down
117 changes: 15 additions & 102 deletions tools/packaging/packaging.psm1
Loading