Commit 7d05f20d authored by nimrod's avatar nimrod
Browse files

Handle errors a little better.

parent f311f190
Loading
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
#!/bin/sh
set -eu

_check() {
    containers="$(until docker-compose ps -q; do true; done)"
    # shellcheck disable=SC2086
    docker container inspect --format '{{ .State.Health.Status }}' $containers | grep -v '^healthy$'
}

_deploy() {
    echo "Deploying to $1" >&2
    export DOCKER_HOST="ssh://$1"
@@ -10,11 +16,11 @@ _deploy() {
    for i in $(seq 12)
    do
        # shellcheck disable=SC2046
        docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$' || break
        _check || break
        sleep 10
    done
    # shellcheck disable=SC2046
    ! docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$'
    ! _check
    unset DOCKER_HOST
    unset RUNNER_NAME
}