msbuild

Форк
0
/
check-channel-consistency.ps1 
40 строк · 1.8 Кб
1
param(
2
  [Parameter(Mandatory=$true)][string] $PromoteToChannels,            # List of channels that the build should be promoted to
3
  [Parameter(Mandatory=$true)][array] $AvailableChannelIds            # List of channel IDs available in the YAML implementation
4
)
5

6
try {
7
  . $PSScriptRoot\post-build-utils.ps1
8

9
  if ($PromoteToChannels -eq "") {
10
    Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info."
11
    ExitWithExitCode 0
12
  }
13

14
  # Check that every channel that Maestro told to promote the build to 
15
  # is available in YAML
16
  $PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ }
17

18
  $hasErrors = $false
19

20
  foreach ($id in $PromoteToChannelsIds) {
21
    if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) {
22
      Write-PipelineTaskError -Message "Channel $id is not present in the post-build YAML configuration! This is an error scenario. Please contact @dnceng."
23
      $hasErrors = $true
24
    }
25
  }
26

27
  # The `Write-PipelineTaskError` doesn't error the script and we might report several errors
28
  # in the previous lines. The check below makes sure that we return an error state from the
29
  # script if we reported any validation error
30
  if ($hasErrors) {
31
    ExitWithExitCode 1 
32
  }
33

34
  Write-Host 'done.'
35
} 
36
catch {
37
  Write-Host $_
38
  Write-PipelineTelemetryError -Category 'CheckChannelConsistency' -Message "There was an error while trying to check consistency of Maestro default channels for the build and post-build YAML configuration."
39
  ExitWithExitCode 1
40
}
41

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

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

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

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