chore: Improve error handling in ps1 scripts

pull/151/head
Robert Dailey 2 years ago
parent d04b10f9d0
commit f5ac125fdc

@ -38,3 +38,7 @@ dotnet publish $BuildPath `
--runtime $Runtime ` --runtime $Runtime `
--self-contained $selfContained ` --self-contained $selfContained `
$singleFileArgs $singleFileArgs
if ($LASTEXITCODE -ne 0) {
throw "dotnet publish failed"
}

@ -4,6 +4,8 @@ param (
[string[]] $RunArgs [string[]] $RunArgs
) )
$ErrorActionPreference = "Stop"
$artifactsDir = "$PSScriptRoot\artifacts" $artifactsDir = "$PSScriptRoot\artifacts"
# Delete old build artifacts # Delete old build artifacts
@ -24,6 +26,9 @@ finally {
Push-Location "$PSScriptRoot\..\debugging" Push-Location "$PSScriptRoot\..\debugging"
try { try {
docker compose up -d --pull always docker compose up -d --pull always
if ($LASTEXITCODE -ne 0) {
throw "docker compose up failed"
}
} }
finally { finally {
Pop-Location Pop-Location
@ -31,6 +36,13 @@ finally {
# Finally, build the docker image and run it # Finally, build the docker image and run it
docker compose build docker compose build
if ($LASTEXITCODE -ne 0) {
throw "docker compose build failed"
}
# TODO: Use `--build` when it releases: # TODO: Use `--build` when it releases:
# https://github.com/docker/compose/issues/10003 # https://github.com/docker/compose/issues/10003
docker compose run --rm recyclarr @RunArgs docker compose run --rm recyclarr @RunArgs
if ($LASTEXITCODE -ne 0) {
throw "docker compose run failed"
}

Loading…
Cancel
Save