msbuild

Форк
0
/
add-build-to-channel.ps1 
48 строк · 1.6 Кб
1
param(
2
  [Parameter(Mandatory=$true)][int] $BuildId,
3
  [Parameter(Mandatory=$true)][int] $ChannelId,
4
  [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken,
5
  [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net',
6
  [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16'
7
)
8

9
try {
10
  . $PSScriptRoot\post-build-utils.ps1
11

12
  # Check that the channel we are going to promote the build to exist
13
  $channelInfo = Get-MaestroChannel -ChannelId $ChannelId
14

15
  if (!$channelInfo) {
16
    Write-PipelineTelemetryCategory -Category 'PromoteBuild' -Message "Channel with BAR ID $ChannelId was not found in BAR!"
17
    ExitWithExitCode 1
18
  }
19

20
  # Get info about which channel(s) the build has already been promoted to
21
  $buildInfo = Get-MaestroBuild -BuildId $BuildId
22
  
23
  if (!$buildInfo) {
24
    Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "Build with BAR ID $BuildId was not found in BAR!"
25
    ExitWithExitCode 1
26
  }
27

28
  # Find whether the build is already assigned to the channel or not
29
  if ($buildInfo.channels) {
30
    foreach ($channel in $buildInfo.channels) {
31
      if ($channel.Id -eq $ChannelId) {
32
        Write-Host "The build with BAR ID $BuildId is already on channel $ChannelId!"
33
        ExitWithExitCode 0
34
      }
35
    }
36
  }
37

38
  Write-Host "Promoting build '$BuildId' to channel '$ChannelId'."
39

40
  Assign-BuildToChannel -BuildId $BuildId -ChannelId $ChannelId
41

42
  Write-Host 'done.'
43
} 
44
catch {
45
  Write-Host $_
46
  Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to promote build '$BuildId' to channel '$ChannelId'"
47
  ExitWithExitCode 1
48
}
49

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.