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

This commit is contained in:
Daniel Donenfeld 2019-02-28 12:39:26 -08:00
parent 9d0b30f09d
commit 7a3bfa26dc

View File

@ -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 { }
"cancelled" { return $true }
}
}
return $false