2020-05-30 12:44:29 +00:00
|
|
|
param(
|
|
|
|
[Parameter(Mandatory=$true)][int] $BuildId,
|
2020-08-28 21:35:06 +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,
|
|
|
|
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com',
|
|
|
|
[Parameter(Mandatory=$true)][string] $WaitPublishingFinish,
|
2020-08-28 21:35:06 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $EnableSourceLinkValidation,
|
|
|
|
[Parameter(Mandatory=$false)][string] $EnableSigningValidation,
|
|
|
|
[Parameter(Mandatory=$false)][string] $EnableNugetValidation,
|
2020-09-10 18:55:14 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $PublishInstallersAndChecksums,
|
2020-05-30 12:44:29 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters,
|
|
|
|
[Parameter(Mandatory=$false)][string] $SigningValidationAdditionalParameters
|
|
|
|
)
|
|
|
|
|
|
|
|
try {
|
|
|
|
. $PSScriptRoot\post-build-utils.ps1
|
2021-08-03 21:49:17 +00:00
|
|
|
|
|
|
|
$darc = Get-Darc
|
2020-05-30 12:44:29 +00:00
|
|
|
|
|
|
|
$optionalParams = [System.Collections.ArrayList]::new()
|
|
|
|
|
|
|
|
if ("" -ne $ArtifactsPublishingAdditionalParameters) {
|
|
|
|
$optionalParams.Add("artifact-publishing-parameters") | Out-Null
|
|
|
|
$optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("false" -eq $WaitPublishingFinish) {
|
|
|
|
$optionalParams.Add("--no-wait") | Out-Null
|
|
|
|
}
|
|
|
|
|
2020-09-10 18:55:14 +00:00
|
|
|
if ("false" -ne $PublishInstallersAndChecksums) {
|
2020-05-30 12:44:29 +00:00
|
|
|
$optionalParams.Add("--publish-installers-and-checksums") | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("true" -eq $EnableNugetValidation) {
|
|
|
|
$optionalParams.Add("--validate-nuget") | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("true" -eq $EnableSourceLinkValidation) {
|
|
|
|
$optionalParams.Add("--validate-sourcelinkchecksums") | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("true" -eq $EnableSigningValidation) {
|
|
|
|
$optionalParams.Add("--validate-signingchecksums") | Out-Null
|
|
|
|
|
|
|
|
if ("" -ne $SigningValidationAdditionalParameters) {
|
|
|
|
$optionalParams.Add("--signing-validation-parameters") | Out-Null
|
|
|
|
$optionalParams.Add($SigningValidationAdditionalParameters) | Out-Null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-10 18:55:14 +00:00
|
|
|
& $darc add-build-to-channel `
|
2020-08-28 21:35:06 +00:00
|
|
|
--id $buildId `
|
|
|
|
--publishing-infra-version $PublishingInfraVersion `
|
|
|
|
--default-channels `
|
2021-03-09 23:53:12 +00:00
|
|
|
--source-branch main `
|
2020-08-28 21:35:06 +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
|
|
|
|
}
|