summaryrefslogtreecommitdiff
path: root/tools/ci/scripts/dockerretry.sh
blob: 121878cbb5e3058edeff3f00e8e6409f427646a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

# skip if we not in docker
if [[ ${CI_RUNNER_TAGS} != *"docker"* ]]; 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