summaryrefslogblamecommitdiff
path: root/tools/ci/scripts/dockerretry.sh
blob: 58dcdb5b18c101830b5b1a7b70ec89d4f7b7ca74 (plain) (tree)
1
2
3
4
5
                   

                          

                               
















                                          
#!/usr/bin/env bash

# skip if we not in docker
if [[ ${CI_RUNNER_ID} != "" ]];
then
    echo "Running from shell. Skipping $*"
    exit 0
fi

n=0

while true; do
    $*
    if [ "$?" == 0 ]; then
        exit 0
    fi
    if [[ $n -ge 10 ]]; then
        exit -1
    fi
    sleep 5s
    n=$((n+1))
done