2020-05-30 12:44:29 +00:00
|
|
|
param(
|
|
|
|
[Parameter(Mandatory=$true)][int] $BuildId,
|
2020-08-21 13:01:23 +00:00
|
|
|
[Parameter(Mandatory=$true)][int] $PublishingInfraVersion,
|
2020-05-30 12:44:29 +00:00
|
|
|
[Parameter(Mandatory=$true)][string] $AzdoToken,
|
|
|
|
[Parameter(Mandatory=$true)][string] $MaestroToken,
|
2023-11-30 17:42:52 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net',
|
2020-05-30 12:44:29 +00:00
|
|
|
[Parameter(Mandatory=$true)][string] $WaitPublishingFinish,
|
|
|
|
[Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters,
|
2022-01-14 18:46:56 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters
|
2020-05-30 12:44:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
try {
|
|
|
|
. $PSScriptRoot\post-build-utils.ps1
|
2021-01-20 14:08:25 +00:00
|
|
|
|
|
|
|
$darc = Get-Darc
|
2020-05-30 12:44:29 +00:00
|
|
|
|
|
|
|
$optionalParams = [System.Collections.ArrayList]::new()
|
|
|
|
|
|
|
|
if ("" -ne $ArtifactsPublishingAdditionalParameters) {
|
2020-12-23 13:59:02 +00:00
|
|
|
$optionalParams.Add("--artifact-publishing-parameters") | Out-Null
|
2020-05-30 12:44:29 +00:00
|
|
|
$optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null
|
|
|
|
}
|
|
|
|
|
2020-11-20 17:08:04 +00:00
|
|
|
if ("" -ne $SymbolPublishingAdditionalParameters) {
|
2020-12-23 13:59:02 +00:00
|
|
|
$optionalParams.Add("--symbol-publishing-parameters") | Out-Null
|
2020-11-20 17:08:04 +00:00
|
|
|
$optionalParams.Add($SymbolPublishingAdditionalParameters) | Out-Null
|
|
|
|
}
|
|
|
|
|
2020-05-30 12:44:29 +00:00
|
|
|
if ("false" -eq $WaitPublishingFinish) {
|
|
|
|
$optionalParams.Add("--no-wait") | Out-Null
|
|
|
|
}
|
|
|
|
|
2020-09-05 12:49:59 +00:00
|
|
|
& $darc add-build-to-channel `
|
2020-08-21 13:01:23 +00:00
|
|
|
--id $buildId `
|
|
|
|
--publishing-infra-version $PublishingInfraVersion `
|
|
|
|
--default-channels `
|
2021-03-11 13:55:56 +00:00
|
|
|
--source-branch main `
|
2020-08-21 13:01:23 +00:00
|
|
|
--azdev-pat $AzdoToken `
|
|
|
|
--bar-uri $MaestroApiEndPoint `
|
|
|
|
--password $MaestroToken `
|
2020-05-30 12:44:29 +00:00
|
|
|
@optionalParams
|
|
|
|
|
|
|
|
if ($LastExitCode -ne 0) {
|
|
|
|
Write-Host "Problems using Darc to promote build ${buildId} to default channels. Stopping execution..."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Host 'done.'
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
Write-Host $_
|
|
|
|
Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to publish build '$BuildId' to default channels."
|
|
|
|
ExitWithExitCode 1
|
|
|
|
}
|