From a54b9a2c441458e0eb2da8307637754b879bb2b7 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 13 Dec 2021 16:13:17 -0800 Subject: [PATCH] Update the `vmImage` and PowerShell root directory for macOS builds (#16611) --- .../azureDevOps/templates/cloneToOfficialPath.yml | 5 ++++- .../azureDevOps/templates/mac-package-build.yml | 14 +++++++++----- tools/releaseBuild/azureDevOps/templates/mac.yml | 10 ++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/templates/cloneToOfficialPath.yml b/tools/releaseBuild/azureDevOps/templates/cloneToOfficialPath.yml index 4985433aed..352458390f 100644 --- a/tools/releaseBuild/azureDevOps/templates/cloneToOfficialPath.yml +++ b/tools/releaseBuild/azureDevOps/templates/cloneToOfficialPath.yml @@ -1,7 +1,10 @@ +parameters: + nativePathRoot: '' + steps: - powershell: | $dirSeparatorChar = [system.io.path]::DirectorySeparatorChar - $nativePath = "${env:HOME}${dirSeparatorChar}PowerShell" + $nativePath = "${{parameters.nativePathRoot }}${dirSeparatorChar}PowerShell" Write-Host "##vso[task.setvariable variable=PowerShellRoot]$nativePath" if ((Test-Path "$nativePath")) { diff --git a/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml b/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml index f36383e5b0..ae828c6670 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml @@ -8,7 +8,7 @@ jobs: dependsOn: MacFileSigningJob_${{ parameters.buildArchitecture }} condition: succeeded() pool: - vmImage: internal-macos-11 + vmImage: macos-latest variables: # Turn off Homebrew analytics - name: HOMEBREW_NO_ANALYTICS @@ -23,11 +23,11 @@ jobs: - pwsh: | # create folder - sudo mkdir /PowerShell + sudo mkdir "$(Agent.TempDirectory)/PowerShell" # make the current user the owner - sudo chown $env:USER /PowerShell - displayName: 'Create /PowerShell' + sudo chown $env:USER "$(Agent.TempDirectory)/PowerShell" + displayName: 'Create $(Agent.TempDirectory)/PowerShell' - template: SetVersionVariables.yml parameters: @@ -36,6 +36,8 @@ jobs: - template: shouldSign.yml - template: cloneToOfficialPath.yml + parameters: + nativePathRoot: '$(Agent.TempDirectory)' - task: DownloadBuildArtifacts@0 displayName: Download macosBinResults @@ -108,7 +110,9 @@ jobs: displayName: 'Bootstrap VM' - pwsh: | - $(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -location $(PowerShellRoot) -ArtifactName macosPkgResults -BuildZip $(BuildPackagePath) -ExtraPackage "tar" -Runtime 'osx-${{ parameters.buildArchitecture }}' + # Add -SkipReleaseChecks as a mitigation to unblock release. + # macos-10.15 does not allow creating a folder under root. Hence, moving the folder. + $(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -location $(PowerShellRoot) -ArtifactName macosPkgResults -BuildZip $(BuildPackagePath) -ExtraPackage "tar" -Runtime 'osx-${{ parameters.buildArchitecture }}' -SkipReleaseChecks displayName: 'Package' - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 diff --git a/tools/releaseBuild/azureDevOps/templates/mac.yml b/tools/releaseBuild/azureDevOps/templates/mac.yml index b5998de057..3e3b3fc234 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac.yml @@ -6,7 +6,7 @@ jobs: displayName: Build macOS ${{ parameters.buildArchitecture }} condition: succeeded() pool: - vmImage: internal-macos-11 + vmImage: macos-latest variables: # Turn off Homebrew analytics - name: HOMEBREW_NO_ANALYTICS @@ -28,13 +28,15 @@ jobs: - pwsh: | # create folder - sudo mkdir "${env:HOME}/PowerShell" + sudo mkdir "$(Agent.TempDirectory)/PowerShell" # make the current user the owner - sudo chown $env:USER "${env:HOME}/PowerShell" - displayName: 'Create ${env:HOME}/PowerShell' + sudo chown $env:USER "$(Agent.TempDirectory)/PowerShell" + displayName: 'Create $(Agent.TempDirectory)/PowerShell' - template: cloneToOfficialPath.yml + parameters: + nativePathRoot: '$(Agent.TempDirectory)' - pwsh: | tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -location $(PowerShellRoot) -BootStrap