Fail early when tart images fail to clone
Closes #2 (closed)
When tart fails to clone an image, its non-zero exit code is currently swallowed by wait
. In order to surface non-zero exit codes from subprocesses, we have to run wait $pid
instead. The script would then fail early because we set -e
in the header.
However, because the loop blocks for each pid in sequence, any successful image pull listed before the failing one will run to completion, even though we could fail earlier. To fix that, I moved the parallel execution to a dedicated tool, GNU parallel.
By setting --halt-on-error "now,fail=1"
, it will exit immediately when one job experiences a failure.
Edited by Adrien Kohlbecker