2020-08-21 13:01:23 +00:00
|
|
|
parameters:
|
|
|
|
BARBuildId: ''
|
|
|
|
PromoteToChannelIds: ''
|
|
|
|
|
2019-06-13 12:10:50 +00:00
|
|
|
jobs:
|
|
|
|
- job: setupMaestroVars
|
|
|
|
displayName: Setup Maestro Vars
|
2020-01-30 13:35:10 +00:00
|
|
|
variables:
|
|
|
|
- template: common-variables.yml
|
2019-06-13 12:10:50 +00:00
|
|
|
pool:
|
|
|
|
vmImage: 'windows-2019'
|
|
|
|
steps:
|
2019-10-24 22:05:36 +00:00
|
|
|
- checkout: none
|
|
|
|
|
2020-08-21 13:01:23 +00:00
|
|
|
- ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}:
|
|
|
|
- task: DownloadBuildArtifacts@0
|
|
|
|
displayName: Download Release Configs
|
|
|
|
inputs:
|
|
|
|
buildType: current
|
|
|
|
artifactName: ReleaseConfigs
|
2019-06-13 12:10:50 +00:00
|
|
|
|
|
|
|
- task: PowerShell@2
|
|
|
|
name: setReleaseVars
|
|
|
|
displayName: Set Release Configs Vars
|
|
|
|
inputs:
|
2019-10-24 22:05:36 +00:00
|
|
|
targetType: inline
|
|
|
|
script: |
|
|
|
|
try {
|
2020-08-21 13:01:23 +00:00
|
|
|
if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') {
|
2020-01-30 13:35:10 +00:00
|
|
|
$Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt
|
2019-10-24 22:05:36 +00:00
|
|
|
|
2020-01-30 13:35:10 +00:00
|
|
|
$BarId = $Content | Select -Index 0
|
2020-04-24 17:34:25 +00:00
|
|
|
$Channels = $Content | Select -Index 1
|
2020-01-30 13:35:10 +00:00
|
|
|
$IsStableBuild = $Content | Select -Index 2
|
2019-10-24 22:05:36 +00:00
|
|
|
|
2020-01-30 13:35:10 +00:00
|
|
|
$AzureDevOpsProject = $Env:System_TeamProject
|
|
|
|
$AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId
|
|
|
|
$AzureDevOpsBuildId = $Env:Build_BuildId
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}"
|
|
|
|
|
|
|
|
$apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]'
|
|
|
|
$apiHeaders.Add('Accept', 'application/json')
|
|
|
|
$apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}")
|
|
|
|
|
|
|
|
$buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
|
|
|
|
|
|
|
|
$BarId = $Env:BARBuildId
|
2020-04-24 17:34:25 +00:00
|
|
|
$Channels = $Env:PromoteToMaestroChannels -split ","
|
|
|
|
$Channels = $Channels -join "]["
|
2020-08-21 13:01:23 +00:00
|
|
|
$Channels = "[$Channels]"
|
2020-01-30 13:35:10 +00:00
|
|
|
|
2020-04-24 17:34:25 +00:00
|
|
|
$IsStableBuild = $buildInfo.stable
|
2020-01-30 13:35:10 +00:00
|
|
|
$AzureDevOpsProject = $buildInfo.azureDevOpsProject
|
|
|
|
$AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId
|
|
|
|
$AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId
|
|
|
|
}
|
2019-10-24 22:05:36 +00:00
|
|
|
|
|
|
|
Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId"
|
2020-04-24 17:34:25 +00:00
|
|
|
Write-Host "##vso[task.setvariable variable=TargetChannels;isOutput=true]$Channels"
|
2019-10-24 22:05:36 +00:00
|
|
|
Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild"
|
2020-01-30 13:35:10 +00:00
|
|
|
|
|
|
|
Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject"
|
|
|
|
Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId"
|
|
|
|
Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId"
|
2019-10-24 22:05:36 +00:00
|
|
|
}
|
|
|
|
catch {
|
|
|
|
Write-Host $_
|
|
|
|
Write-Host $_.Exception
|
|
|
|
Write-Host $_.ScriptStackTrace
|
|
|
|
exit 1
|
|
|
|
}
|
2020-01-30 13:35:10 +00:00
|
|
|
env:
|
|
|
|
MAESTRO_API_TOKEN: $(MaestroApiAccessToken)
|
2020-08-21 13:01:23 +00:00
|
|
|
BARBuildId: ${{ parameters.BARBuildId }}
|
|
|
|
PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }}
|