Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,16 @@ extends:
exactToolVersion: 4.4.2
policheck:
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
tsaOptionsFile: .config\tsaoptions.json
tsaOptionsFile: $(Build.SourcesDirectory)\.config\tsaoptions.json
stages:
- template: /.pipelines/templates/release-prep-for-ev2.yml@self
parameters:
skipPublish: ${{ parameters.skipPublish }}

# NonOfficial: run the publish stage to verify templateContext artifact download,
# but skip the actual Ev2 push to PMC.
- template: /.pipelines/templates/release-publish-pmc.yml@self
parameters:
releaseEnvironment: Test
stagePrefix: Test
skipEv2Push: true
2 changes: 1 addition & 1 deletion .pipelines/PowerShell-Release-Official-Azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extends:
exactToolVersion: 4.4.2
policheck:
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
tsaOptionsFile: .config\tsaoptions.json
tsaOptionsFile: $(Build.SourcesDirectory)\.config\tsaoptions.json
stages:
- template: /.pipelines/templates/release-prep-for-ev2.yml@self
parameters:
Expand Down
46 changes: 20 additions & 26 deletions .pipelines/templates/release-prep-for-ev2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ stages:
displayName: 'Copy EV2 Files to Artifact'
pool:
type: linux
templateContext:
inputs:
- input: pipelineArtifact
pipeline: PSPackagesOfficial
artifactName: drop_linux_package_deb
- input: pipelineArtifact
pipeline: PSPackagesOfficial
artifactName: drop_linux_package_rpm
- input: pipelineArtifact
pipeline: PSPackagesOfficial
artifactName: drop_linux_package_mariner_x64
- input: pipelineArtifact
pipeline: PSPackagesOfficial
artifactName: drop_linux_package_mariner_arm64
variables:
- name: ob_outputDirectory
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
Expand All @@ -24,6 +38,8 @@ stages:
- group: 'packages.microsoft.com'
- name: ob_sdl_credscan_suppressionsFile
value: $(Build.SourcesDirectory)/PowerShell/.config/suppress.json
- name: ob_sdl_tsa_configFile
value: $(Build.SourcesDirectory)/PowerShell/.config/tsaoptions.json
steps:
- checkout: self ## the global setting on lfs didn't work
lfs: false
Expand Down Expand Up @@ -99,39 +115,17 @@ stages:
env:
ob_restore_phase: true

- download: PSPackagesOfficial
artifact: 'drop_linux_package_deb'
displayName: 'Download artifact containing .deb_amd64.deb file from PSPackagesOfficial triggering pipeline'
env:
ob_restore_phase: true

- download: PSPackagesOfficial
artifact: 'drop_linux_package_rpm'
displayName: 'Download artifact containing .rh.x64_86.rpm file from PSPackagesOfficial triggering pipeline'
env:
ob_restore_phase: true

- download: PSPackagesOfficial
artifact: 'drop_linux_package_mariner_x64'
displayName: 'Download artifact containing .cm.x86_64.rpm file from PSPackagesOfficial triggering pipeline'
env:
ob_restore_phase: true

- download: PSPackagesOfficial
artifact: 'drop_linux_package_mariner_arm64'
displayName: 'Download artifact containing .cm.aarch64.rpm file from PSPackagesOfficial triggering pipeline'
env:
ob_restore_phase: true

- pwsh: |
Write-Verbose -Verbose "Copy ESRP signed .deb and .rpm packages"
$downloadedPipelineFolder = Join-Path '$(Pipeline.Workspace)' -ChildPath 'PSPackagesOfficial'
# templateContext.inputs places the PSPackagesOfficial pipelineArtifact files
# directly under $(Pipeline.Workspace), not in per-artifact subfolders.
$downloadedPipelineFolder = '$(Pipeline.Workspace)'
$srcFilesFolder = Join-Path -Path '$(Pipeline.Workspace)' -ChildPath 'SourceFiles'
New-Item -Path $srcFilesFolder -ItemType Directory
$packagesFolder = Join-Path -Path $srcFilesFolder -ChildPath 'packages'
New-Item -Path $packagesFolder -ItemType Directory

$packageFiles = Get-ChildItem -Path $downloadedPipelineFolder -Recurse -Directory -Filter "drop_*" | Get-ChildItem -File -Include *.deb, *.rpm
$packageFiles = Get-ChildItem -Path $downloadedPipelineFolder -File | Where-Object { $_.Extension -in '.deb', '.rpm' }
foreach ($file in $packageFiles)
{
Write-Verbose -Verbose "copying file: $($file.FullName)"
Expand Down
65 changes: 42 additions & 23 deletions .pipelines/templates/release-publish-pmc.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,56 @@
parameters:
- name: releaseEnvironment
type: string
default: Production
values:
- Production
- PPE
- Test
- name: approvalServiceEnvironment
type: string
default: Production
values:
- Production
- PPE
- Test
# OneBranch requires the stage name to be prefixed with the release environment.
# Official uses 'Prod' for Production; NonProd validators require '<env>' (e.g. 'Test', 'PPE').
- name: stagePrefix
type: string
default: Prod
Comment on lines +16 to +20

Copilot AI Apr 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stagePrefix and releaseEnvironment can be set inconsistently (e.g., releaseEnvironment: PPE but leaving stagePrefix at default Prod), which would produce a stage name that doesn't match the actual release environment and can fail OneBranch environment/stage-name validation. Consider deriving the stage prefix from releaseEnvironment inside the template (e.g., map Production -> Prod, else use the environment name) so callers only need to set releaseEnvironment (and optionally override if there’s a true exception).

Copilot uses AI. Check for mistakes.
# When true, the Ev2 push step is skipped. Useful for NonOfficial dry-runs that
# only want to validate artifact download via templateContext.inputs.
- name: skipEv2Push
type: boolean
default: false

stages:
- stage: 'Prod_Release'
- stage: ${{ parameters.stagePrefix }}_Release
displayName: 'Deploy packages to PMC with EV2'
dependsOn:
- PrepForEV2
variables:
- name: ob_release_environment
value: "Production"
value: ${{ parameters.releaseEnvironment }}
- name: repoRoot
value: $(Build.SourcesDirectory)
jobs:
- job: Prod_ReleaseJob
- job: ${{ parameters.stagePrefix }}_ReleaseJob
displayName: Publish to PMC
pool:
type: release

steps:
- task: DownloadPipelineArtifact@2
templateContext:
inputs:
targetPath: '$(Pipeline.Workspace)'
artifact: drop_PrepForEV2_CopyEv2FilesToArtifact
displayName: 'Download drop_PrepForEV2_CopyEv2FilesToArtifact artifact that has all files needed'
- input: pipelineArtifact
artifactName: drop_PrepForEV2_CopyEv2FilesToArtifact

- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: '$(Pipeline.Workspace)'
displayName: 'Download to get EV2 Files'

- task: vsrm-ev2.vss-services-ev2.adm-release-task.ExpressV2Internal@1
displayName: 'Ev2: Push to PMC'
inputs:
UseServerMonitorTask: true
EndpointProviderType: ApprovalService
ApprovalServiceEnvironment: Production
ServiceRootPath: '$(Pipeline.Workspace)/drop_PrepForEV2_CopyEV2FilesToArtifact/EV2Specs/ServiceGroupRoot'
RolloutSpecPath: '$(Pipeline.Workspace)/drop_PrepForEV2_CopyEV2FilesToArtifact/EV2Specs/ServiceGroupRoot/RolloutSpec.json'
steps:
- ${{ if not(parameters.skipEv2Push) }}:
- task: vsrm-ev2.vss-services-ev2.adm-release-task.ExpressV2Internal@1
displayName: 'Ev2: Push to PMC'
inputs:
UseServerMonitorTask: true
EndpointProviderType: ApprovalService
ApprovalServiceEnvironment: ${{ parameters.approvalServiceEnvironment }}
ServiceRootPath: '$(Pipeline.Workspace)/EV2Specs/ServiceGroupRoot'
RolloutSpecPath: '$(Pipeline.Workspace)/EV2Specs/ServiceGroupRoot/RolloutSpec.json'
Loading