Fix backport issues with release pipeline (#24835)

* Add missed release-install-pwsh.yml template

* Fix backport merge conflicts to release pipeline

* Fix more backport issues

* Changed Windows container image to 2022

* Add msix pwsh task and changed DOTNET root finding in validate global tools

* Fix msix and global tools

* Revert msix change

* Add back AZ remove module

* Add install makeapp tool step

* Fix publish nuget

---------

Co-authored-by: Justin Chung <chungjustin@microsoft.com>
This commit is contained in:
Justin Chung
2025-01-22 13:09:34 -08:00
committed by GitHub
co-authored by Justin Chung
parent bf12cd1245
commit 91531f68de
6 changed files with 96 additions and 85 deletions
+27 -23
View File
@@ -26,7 +26,6 @@ parameters: # parameters are shown up in ADO UI in a build queue time
type: boolean
default: false
variables:
- name: CDP_DEFINITION_BUILD_COUNT
value: $[counter('', 0)]
@@ -51,7 +50,7 @@ variables:
- name: ob_outputDirectory
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
- name: WindowsContainerImage
value: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest'
value: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
- name: LinuxContainerImage
value: mcr.microsoft.com/onebranch/cbl-mariner/build:2.0
- name: ReleaseTagVar
@@ -84,9 +83,9 @@ resources:
extends:
template: v2/OneBranch.Official.CrossPlat.yml@templates
parameters:
release:
category: NonAzure
featureFlags:
LinuxHostVersion:
Network: Monitor
WindowsHostVersion:
Version: 2022
Network: KS3
@@ -128,6 +127,7 @@ extends:
- stage: validateSdk
displayName: 'Validate SDK'
dependsOn: []
jobs:
- template: /.pipelines/templates/release-validate-sdk.yml@self
parameters:
@@ -152,6 +152,7 @@ extends:
- stage: gbltool
displayName: 'Validate Global tools'
dependsOn: []
jobs:
- template: /.pipelines/templates/release-validate-globaltools.yml@self
parameters:
@@ -169,6 +170,7 @@ extends:
- stage: fxdpackages
displayName: 'Validate FXD Packages'
dependsOn: []
jobs:
- template: /.pipelines/templates/release-validate-fxdpackages.yml@self
parameters:
@@ -205,6 +207,7 @@ extends:
- stage: validatePackages
displayName: 'Validate Packages'
dependsOn: []
jobs:
- template: /.pipelines/templates/release-validate-packagenames.yml@self
@@ -304,18 +307,14 @@ extends:
- stage: BlobPublic
displayName: Make Blob Public
dependsOn: UpdateChangeLog
dependsOn:
- UpdateChangeLog
- PushGitTagAndMakeDraftPublic
jobs:
- template: /.pipelines/templates/release-MakeBlobPublic.yml@self
parameters:
SkipPSInfraInstallers: ${{ parameters.SkipPSInfraInstallers }}
- stage: PublishGitHubRelease
displayName: Publish GitHub Release
dependsOn: BlobPublic
jobs:
- template: /.pipelines/templates/release-githubtasks.yml@self
- stage: PublishNuGet
displayName: Publish NuGet
dependsOn:
@@ -330,14 +329,14 @@ extends:
- stage: PublishPMC
displayName: Publish PMC
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
jobs:
- template: /.pipelines/templates/release-publish-pmc.yml@self
parameters:
skipPublish: ${{ parameters.SkipPMCPublish }}
- stage: ReleaseDocker
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
displayName: 'Docker Release'
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
@@ -356,7 +355,7 @@ extends:
Kickoff docker release
- stage: UpdateDotnetDocker
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
displayName: Update DotNet SDK Docker images
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
@@ -371,7 +370,7 @@ extends:
4. create PR targeting nightly branch
- stage: UpdateWinGet
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
displayName: Add manifest entry to winget
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
@@ -382,7 +381,7 @@ extends:
This is typically done by the community 1-2 days after the release.
- stage: PublishMsix
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
displayName: Publish MSIX to store
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
@@ -393,7 +392,7 @@ extends:
Ask Steve to release MSIX bundle package to Store
- stage: PublishVPack
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
displayName: Release vPack
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
@@ -411,20 +410,22 @@ extends:
# - template: templates/release-UpdateDepsJson.yml
- stage: UploadBuildInfoJson
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
displayName: Upload BuildInfo.json
jobs:
- template: /.pipelines/templates/release-upload-buildinfo.yml@self
- stage: ReleaseSymbols
dependsOn: PublishGitHubRelease
dependsOn: PushGitTagAndMakeDraftPublic
displayName: Release Symbols
jobs:
- template: /.pipelines/templates/release-symbols.yml@self
- stage: ChangesToMaster
displayName: Ensure changes are in GH master
dependsOn: ['PublishNuGet', 'PublishPMC']
dependsOn:
- PublishNuGet
- PublishPMC
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
@@ -435,7 +436,7 @@ extends:
- stage: ReleaseSnap
displayName: Release Snap
dependsOn: 'ChangesToMaster'
dependsOn: ChangesToMaster
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
@@ -446,7 +447,7 @@ extends:
- stage: ReleaseToMU
displayName: Release to MU
dependsOn: ['PublishNuGet', 'PublishPMC', 'ChangesToMaster']
dependsOn: PushGitTagAndMakeDraftPublic
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
@@ -456,7 +457,10 @@ extends:
- stage: ReleaseClose
displayName: Finish Release
dependsOn: ['ReleaseToMU', 'ReleaseSymbols', 'ReleaseSnap']
dependsOn:
- ReleaseToMU
- ReleaseSymbols
- ReleaseSnap
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
+31 -28
View File
@@ -28,24 +28,39 @@ jobs:
displayName: Download x86 msix
patterns: '**/*.msix'
- task: AzurePowerShell@5
# This needs to run before any AzurePowerShell@ task
- pwsh: |
$azureRmModule = Get-InstalledModule AzureRM -ErrorAction SilentlyContinue -Verbose
if ($azureRmModule) {
Write-Host 'AzureRM module exists. Removing it'
Uninstall-AzureRm
Write-Host 'AzureRM module removed'
}
Install-Module -Name Az.Storage -Force -AllowClobber -Scope CurrentUser -Verbose
displayName: Remove AzRM modules and install Az.Storage
- pwsh: |
$cmd = Get-Command makeappx.exe -ErrorAction Ignore
if ($cmd) {
Write-Verbose -Verbose 'makeappx available in PATH'
$exePath = $cmd.Source
} else {
$toolsDir = '$(Pipeline.Workspace)\releasePipeline\tools'
New-Item $toolsDir -Type Directory -Force > $null
Invoke-RestMethod -Uri '$(makeappUrl)' -OutFile "$toolsDir\makeappx.zip"
Expand-Archive "$toolsDir\makeappx.zip" -DestinationPath "$toolsDir\makeappx" -Force
$exePath = "$toolsDir\makeappx\makeappx.exe"
Write-Verbose -Verbose 'makeappx was installed:'
Get-ChildItem -Path $toolsDir -Recurse
}
$vstsCommandString = "vso[task.setvariable variable=MakeAppxPath]$exePath"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: Install makeappx tool
retryCountOnTaskFailure: 1
inputs:
azureSubscription: az-blob-cicd-infra
scriptType: inlineScript
azurePowerShellVersion: LatestVersion
pwsh: true
inline: |
$toolsDir = '$(Pipeline.Workspace)\releasePipeline\tools'
New-Item $toolsDir -Type Directory -Force > $null
Invoke-RestMethod -Uri '$(makeappUrlDirect)' -OutFile "$toolsDir\makeappx.zip"
Expand-Archive "$toolsDir\makeappx.zip" -DestinationPath "$toolsDir\makeappx" -Force
$exePath = "$toolsDir\makeappx\makeappx.exe"
$vstsCommandString = "vso[task.setvariable variable=MakeAppxPath]$exePath"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
- pwsh: |
$sourceDir = '$(Pipeline.Workspace)\releasePipeline\msix'
@@ -73,18 +88,6 @@ jobs:
displayName: Create MsixBundle
retryCountOnTaskFailure: 1
- pwsh: |
$azureRmModule = Get-InstalledModule AzureRM -ErrorAction SilentlyContinue -Verbose
if ($azureRmModule) {
Write-Host 'AzureRM module exists. Removing it'
Uninstall-AzureRm
Write-Host 'AzureRM module removed'
}
Install-Module -Name Az.Storage -Force -AllowClobber -Scope CurrentUser -Verbose
displayName: Remove AzRM modules and install Az.Storage
- task: AzurePowerShell@5
displayName: Upload msix to blob
inputs:
@@ -86,19 +86,3 @@ jobs:
Publish-ReleaseDraft -Tag '$(ReleaseTag)' -Name '$(ReleaseTag) Release of PowerShell' -Description $clContent -User PowerShell -Repository PowerShell -PackageFolder "$(Pipeline.Workspace)/GitHubPackages" -Token $(GitHubReleasePat)
displayName: Publish Release Draft
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
displayName: Push Git Tag
jobName: PushGitTag
dependsOnJob: GithubReleaseDraft
instructions: |
Push the git tag to upstream
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
displayName: Make Draft Public
jobName: DraftPublic
dependsOnJob: PushGitTag
instructions: |
Make the GitHub Release Draft Public
@@ -0,0 +1,34 @@
steps:
- task: PowerShell@2
inputs:
targetType: inline
script: |
$localInstallerPath = Get-ChildItem -Path "$(Pipeline.Workspace)/GitHubPackages" -Filter '*win-x64.msi' | Select-Object -First 1 -ExpandProperty FullName
if (Test-Path -Path $localInstallerPath) {
Write-Verbose -Verbose "Installer found at $localInstallerPath"
} else {
throw "Installer not found"
}
Write-Verbose -Verbose "Installing PowerShell via msiexec"
Start-Process -FilePath msiexec -ArgumentList "/package $localInstallerPath /quiet REGISTER_MANIFEST=1" -Wait -NoNewWindow
$pwshPath = Get-ChildItem -Directory -Path 'C:\Program Files\PowerShell\7*' | Select-Object -First 1 -ExpandProperty FullName
if (Test-Path -Path $pwshPath) {
Write-Verbose -Verbose "PowerShell installed at $pwshPath"
Write-Verbose -Verbose "Adding pwsh to env:PATH"
Write-Host "##vso[task.prependpath]$pwshPath"
} else {
throw "PowerShell not installed"
}
displayName: Install pwsh 7
- task: PowerShell@2
inputs:
targetType: inline
pwsh: true
script: |
Write-Verbose -Verbose "Pwsh 7 Installed"
Write-Verbose -Verbose "env:Path: "
$env:PATH -split ';' | ForEach-Object {
Write-Verbose -Verbose $_
}
displayName: Check pwsh 7 installation
@@ -30,14 +30,10 @@ jobs:
Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
displayName: 'Capture Environment Variables'
- download: PSPackagesOfficial
artifact: drop_nupkg_build_nupkg
displayName: Download nuget packages
- pwsh: |
#Exclude all global tool packages. Their names start with 'PowerShell.'
$null = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/release"
Copy-Item "$ENV:PIPELINE_WORKSPACE/PSPackagesOfficial/drop_nupkg_build_nupkg/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose
Copy-Item "$(Pipeline.Workspace)/NuGetPackages/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose
$releaseVersion = '$(Version)'
$globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"
@@ -47,6 +43,7 @@ jobs:
Copy-Item $globalToolPath -Destination "$(Pipeline.Workspace)/release"
}
Write-Verbose -Verbose "The .nupkgs below will be pushed:"
Get-ChildItem "$(Pipeline.Workspace)/release" -recurse
displayName: Download and capture nupkgs
condition: and(ne('${{ parameters.skipPublish }}', 'false'), succeeded())
@@ -109,24 +109,13 @@ jobs:
- pwsh: |
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"
Import-Module "$repoRoot/build.psm1" -Force
Start-PSBootstrap
Start-PSBootstrap -Force
$exeName = if ($IsWindows) { "pwsh.exe" } else { "pwsh" }
$toolPath = "$(System.DefaultWorkingDirectory)/toolPath/${{ parameters.globalToolExeName }}"
$source = (get-command -Type Application -Name dotnet | Select-Object -First 1 -ExpandProperty source)
$target = (Get-ChildItem $source).target
# If we find a symbolic link for dotnet, then we need to split the filename off the target.
if ($target) {
Write-Verbose -Verbose "Splitting target: $target"
$target = Split-Path $target
}
Write-Verbose -Verbose "target is set as $target"
$env:DOTNET_ROOT = (resolve-path -Path (Join-Path (split-path $source) $target)).ProviderPath
Find-Dotnet -SetDotNetRoot
Write-Verbose -Verbose "DOTNET_ROOT: $env:DOTNET_ROOT"
Get-ChildItem $env:DOTNET_ROOT