From 7a3bfa26dceaa2aa0d28daaf24ffd8053f797cf8 Mon Sep 17 00:00:00 2001 From: Daniel Donenfeld Date: Thu, 28 Feb 2019 12:39:26 -0800 Subject: [PATCH] Fix Get-AppveyorBuild to not just get latest build, but to use the build version to get the correct build. Fix get any failures function to also check for cancellations --- asm/scripts/Asm-Functions.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/asm/scripts/Asm-Functions.ps1 b/asm/scripts/Asm-Functions.ps1 index 53bb229..fc1e84c 100644 --- a/asm/scripts/Asm-Functions.ps1 +++ b/asm/scripts/Asm-Functions.ps1 @@ -5,7 +5,7 @@ function Get-AppVeyorBuild { throw "missing api token for AppVeyor." } - Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG" -Method GET -Headers @{ + Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/build/$($env:APPVEYOR_BUILD_VERSION)" -Method GET -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_API_TOKEN" "Content-type" = "application/json" } @@ -92,13 +92,14 @@ function travisFinished { throw "Travis build did not finished in $env:TIMEOUT_MINS minutes" } +# Returns true if any Appveyor build is "failed" or "cancelled" function Get-Any-Appveyor-Failures { (Get-AppVeyorBuild).build.jobs | Foreach-Object ` { $job = $_ switch ($job.status) { - "failed" { return $true } - Default { } + "failed" { return $true } + "cancelled" { return $true } } } return $false