diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faf56ea3b..ce23985ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,13 +137,7 @@ jobs: docker build -t coffea-rados-parquet-test \ --file docker/coffea_rados_parquet/Dockerfile \ . - docker run \ - -v $(pwd):/w \ - -w /w \ - -e IS_CI=true \ - --privileged \ - coffea-rados-parquet-test \ - ./docker/coffea_rados_parquet/script.sh + ./docker/coffea_rados_parquet/run.sh release: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') diff --git a/docker/coffea_rados_parquet/run.sh b/docker/coffea_rados_parquet/run.sh new file mode 100755 index 000000000..029b73dc2 --- /dev/null +++ b/docker/coffea_rados_parquet/run.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -ex + +function fail { + echo $1 >&2 + exit 1 +} + +function retry { + local n=1 + local max=3 + local delay=5 + while true; do + "$@" && break || { + if [[ $n -lt $max ]]; then + ((n++)) + echo "Command failed. Attempt $n/$max:" + sleep $delay; + else + fail "The command has failed after $n attempts." + fi + } + done +} + +retry docker run \ + -v $(pwd):/w \ + -w /w \ + -e IS_CI=true \ + --privileged \ + coffea-rados-parquet-test \ + ./docker/coffea_rados_parquet/script.sh +