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,
|
|
|
|
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com',
|
|
|
|
[Parameter(Mandatory=$true)][string] $WaitPublishingFinish,
|
2020-08-21 13:01:23 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $EnableSourceLinkValidation,
|
|
|
|
[Parameter(Mandatory=$false)][string] $EnableSigningValidation,
|
|
|
|
[Parameter(Mandatory=$false)][string] $EnableNugetValidation,
|
2020-09-05 12:49:59 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $PublishInstallersAndChecksums,
|
2020-05-30 12:44:29 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters,
|
2020-11-20 17:08:04 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters,
|
2020-05-30 12:44:29 +00:00
|
|
|
[Parameter(Mandatory=$false)][string] $SigningValidationAdditionalParameters
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
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-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 `
|
|
|
|
--source-branch master `
|
|
|
|
--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
|
|
|
|
}
|