From ab809d95d9cf3b5750a7675cef2473d0592dbaea Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 14 Nov 2018 01:04:39 +0000 Subject: [PATCH] Merged PR 5818: Port changes to allow AzDevOps NuGet feeds for Mac build Port changes to allow AzDevOps NuGet feeds for Mac build --- tools/packaging/packaging.psm1 | 9 ++++++- .../macOS/PowerShellPackageVsts.ps1 | 14 +--------- tools/releaseBuild/macOS/vsts.yml | 27 ++++++++++--------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index be0ff24edc..f6637569fa 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -767,6 +767,7 @@ function New-UnixPackage { $ManGzipInfo = New-ManGzip -IsPreview:$IsPreview # Change permissions for packaging + Write-Log "Setting permissions..." Start-NativeExecution { find $Staging -type d | xargs chmod 755 find $Staging -type f | xargs chmod 644 @@ -779,6 +780,7 @@ function New-UnixPackage { # Add macOS powershell launcher if ($Type -eq "osxpkg") { + Write-Log "Adding macOS launch opplication..." if ($pscmdlet.ShouldProcess("Add macOS launch application")) { # Generate launcher app folder @@ -816,10 +818,12 @@ function New-UnixPackage { # Build package try { if ($pscmdlet.ShouldProcess("Create $type package")) { + Write-Log "Creating package with fpm..." $Output = Start-NativeExecution { fpm $Arguments } } } finally { if ($Environment.IsMacOS) { + Write-Log "Starting Cleanup for mac packaging..." if ($pscmdlet.ShouldProcess("Cleanup macOS launcher")) { Clear-MacOSLauncher @@ -1203,6 +1207,7 @@ function New-ManGzip $IsPreview ) + Write-Log "Creating man gz..." # run ronn to convert man page to roff $RonnFile = "$RepoRoot/assets/pwsh.1.ronn" if ($IsPreview.IsPresent) @@ -1215,7 +1220,8 @@ function New-ManGzip $RoffFile = $RonnFile -replace "\.ronn$" # Run ronn on assets file - Start-NativeExecution { ronn --roff $RonnFile } -VerboseOutputOnError + Write-Log "Creating man gz - running ronn..." + Start-NativeExecution { ronn --roff $RonnFile } if ($IsPreview.IsPresent) { @@ -1224,6 +1230,7 @@ function New-ManGzip # gzip in assets directory $GzipFile = "$RoffFile.gz" + Write-Log "Creating man gz - running gzip..." Start-NativeExecution { gzip -f $RoffFile } -VerboseOutputOnError $ManFile = Join-Path "/usr/local/share/man/man1" (Split-Path -Leaf $GzipFile) diff --git a/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 b/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 index 8023657491..5ebed79d34 100644 --- a/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 +++ b/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 @@ -29,27 +29,15 @@ param ( [switch] $Build ) -# We must build in /PowerShell -$repoRoot = '/PowerShell' -if ($BootStrap.IsPresent) { - $repoRoot = $location -} +$repoRoot = $location if ($Build.IsPresent) { - # cleanup the folder but don't delete it or the build agent will loose ownership of the folder - Write-Verbose -Message "cleaning /PowerShell" -Verbose - Get-ChildItem -Path /PowerShell/* -Attributes Hidden, Normal, Directory | Remove-Item -Recurse -Force - - # clone the repository to the location we must build from - Write-Verbose -Message "cloning to /PowerShell" -Verbose - git clone $location /PowerShell $releaseTagParam = @{} if ($ReleaseTag) { $releaseTagParam = @{ 'ReleaseTag' = $ReleaseTag } } } - Push-Location try { Write-Verbose -Message "Init..." -Verbose diff --git a/tools/releaseBuild/macOS/vsts.yml b/tools/releaseBuild/macOS/vsts.yml index 10e8c01bfb..57cdb50738 100644 --- a/tools/releaseBuild/macOS/vsts.yml +++ b/tools/releaseBuild/macOS/vsts.yml @@ -14,16 +14,6 @@ steps: scriptPath: 'tools/releaseBuild/setReleaseTag.sh' args: '-ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"' displayName: 'Calculate Release Tag' -- powershell: | - Import-Module $(Build.SourcesDirectory)/build.psm1 -Force - New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination $(Build.SourcesDirectory)/src/Modules - - if(-not (Test-Path "$(Build.SourcesDirectory)/src/Modules/nuget.config")) - { - throw "nuget.config is not created" - } - displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules ' - condition: ne(Variable['SkipFxDependent'], 'true') - task: ShellScript@2 inputs: scriptPath: 'tools/installpsh-osx.sh' @@ -32,13 +22,26 @@ steps: inputs: scriptPath: 'tools/releaseBuild/macOS/createPowerShell.sh' displayName: 'Create /PowerShell' +- powershell: | + Write-Host "##vso[task.setvariable variable=PowerShellRoot]/PowerShell" + git clone $env:BUILD_REPOSITORY_LOCALPATH /PowerShell + displayName: Clone PowerShell Repo to /PowerShell - task: ShellScript@2 inputs: scriptPath: 'tools/releaseBuild/macOS/PowerShellPackageVsts.sh' - args: '-location $(Build.SourcesDirectory) -BootStrap' + args: '-location $(PowerShellRoot) -BootStrap' displayName: 'Bootstrap VM' +- powershell: | + Import-Module $(Build.SourcesDirectory)/build.psm1 -Force + New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination "$(PowerShellRoot)/src/Modules" + + if(-not (Test-Path "$(PowerShellRoot)/src/Modules/nuget.config")) + { + throw "nuget.config is not created" + } + displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules ' - powershell: | $env:AZDEVOPSFEEDPAT = '$(AzDevOpsFeedPAT)' - $(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -ExtraPackage "tar" -location $(Build.SourcesDirectory) -Build + $(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -ExtraPackage "tar" -location $(PowerShellRoot) -Build $env:AZDEVOPSFEEDPAT = $null displayName: 'Build and Package'