[master] Update dependencies from dotnet/arcade (#3469)
* Update dependencies from https://github.com/dotnet/arcade build 20190725.15 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19375.15 * Update dependencies from https://github.com/dotnet/arcade build 20190726.18 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19376.18
This commit is contained in:
parent
fc791931b6
commit
cff0723064
34 changed files with 334 additions and 226 deletions
|
@ -1,33 +1,20 @@
|
|||
param(
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string] $SourceRepo,
|
||||
[Parameter(Mandatory=$true)][int] $ChannelId,
|
||||
[string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com",
|
||||
[string] $BarToken,
|
||||
[string] $ApiVersion = "2019-01-16"
|
||||
[Parameter(Mandatory=$true)][string] $MaestroApiAccessToken,
|
||||
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = "https://maestro-prod.westus2.cloudapp.azure.com",
|
||||
[Parameter(Mandatory=$false)][string] $MaestroApiVersion = "2019-01-16"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
Set-StrictMode -Version 2.0
|
||||
|
||||
. $PSScriptRoot\..\tools.ps1
|
||||
|
||||
function Get-Headers([string]$accept, [string]$barToken) {
|
||||
$headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]'
|
||||
$headers.Add('Accept',$accept)
|
||||
$headers.Add('Authorization',"Bearer $barToken")
|
||||
return $headers
|
||||
}
|
||||
. $PSScriptRoot\post-build-utils.ps1
|
||||
|
||||
# Get all the $SourceRepo subscriptions
|
||||
$normalizedSourceRepo = $SourceRepo.Replace('dnceng@', '')
|
||||
$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSourceRepo&api-version=$apiVersion"
|
||||
$headers = Get-Headers 'application/json' $barToken
|
||||
|
||||
$subscriptions = Invoke-WebRequest -Uri $getSubscriptionsApiEndpoint -Headers $headers | ConvertFrom-Json
|
||||
$subscriptions = Get-MaestroSubscriptions -SourceRepository $normalizedSourceRepo -ChannelId $ChannelId
|
||||
|
||||
if (!$subscriptions) {
|
||||
Write-Host "No subscriptions found for source repo '$normalizedSourceRepo' in channel '$ChannelId'"
|
||||
return
|
||||
ExitWithExitCode 0
|
||||
}
|
||||
|
||||
$subscriptionsToTrigger = New-Object System.Collections.Generic.List[string]
|
||||
|
@ -36,21 +23,18 @@ $failedTriggeredSubscription = $false
|
|||
# Get all enabled subscriptions that need dependency flow on 'everyBuild'
|
||||
foreach ($subscription in $subscriptions) {
|
||||
if ($subscription.enabled -and $subscription.policy.updateFrequency -like 'everyBuild' -and $subscription.channel.id -eq $ChannelId) {
|
||||
Write-Host "$subscription.id"
|
||||
Write-Host "Should trigger this subscription: $subscription.id"
|
||||
[void]$subscriptionsToTrigger.Add($subscription.id)
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($subscriptionToTrigger in $subscriptionsToTrigger) {
|
||||
try {
|
||||
$triggerSubscriptionApiEndpoint = "$maestroEndpoint/api/subscriptions/$subscriptionToTrigger/trigger?api-version=$apiVersion"
|
||||
$headers = Get-Headers 'application/json' $BarToken
|
||||
|
||||
Write-Host "Triggering subscription '$subscriptionToTrigger'..."
|
||||
Write-Host "Triggering subscription '$subscriptionToTrigger'."
|
||||
|
||||
Invoke-WebRequest -Uri $triggerSubscriptionApiEndpoint -Headers $headers -Method Post
|
||||
Trigger-Subscription -SubscriptionId $subscriptionToTrigger
|
||||
|
||||
Write-Host "Subscription '$subscriptionToTrigger' triggered!"
|
||||
Write-Host "done."
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -61,9 +45,13 @@ foreach ($subscriptionToTrigger in $subscriptionsToTrigger) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($failedTriggeredSubscription) {
|
||||
if ($subscriptionsToTrigger.Count -eq 0) {
|
||||
Write-Host "No subscription matched source repo '$normalizedSourceRepo' and channel ID '$ChannelId'."
|
||||
}
|
||||
elseif ($failedTriggeredSubscription) {
|
||||
Write-Host "At least one subscription failed to be triggered..."
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
|
||||
Write-Host "All subscriptions were triggered successfully!"
|
||||
else {
|
||||
Write-Host "All subscriptions were triggered successfully!"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue