Skip to content

add option to exit runner if docker isn't available #3733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Misc/layoutroot/run-helper.sh.template
Original file line number Diff line number Diff line change
@@ -20,16 +20,28 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# Wait for docker to start
if [ ! -z "$RUNNER_WAIT_FOR_DOCKER_IN_SECONDS" ]; then
RUNNER_WAIT_FOR_DOCKER_SUCCESS=false
if [ "$RUNNER_WAIT_FOR_DOCKER_IN_SECONDS" -gt 0 ]; then
echo "Waiting for docker to be ready."
for i in $(seq "$RUNNER_WAIT_FOR_DOCKER_IN_SECONDS"); do
if docker ps > /dev/null 2>&1; then
echo "Docker is ready."
RUNNER_WAIT_FOR_DOCKER_SUCCESS=true
break
fi
"$DIR"/safe_sleep.sh 1
done
fi
if [[ $RUNNER_WAIT_FOR_DOCKER_SUCCESS == false ]]; then
echo "Docker is not ready after $RUNNER_WAIT_FOR_DOCKER_IN_SECONDS seconds"

if [[ ! -z "$RUNNER_WAIT_FOR_DOCKER_EXIT_ON_FAILURE" ]]; then
echo "Respecting RUNNER_WAIT_FOR_DOCKER_EXIT_ON_FAILURE, exiting..."
exit 1
else
echo "RUNNER_WAIT_FOR_DOCKER_EXIT_ON_FAILURE not set, continuing anyways..."
fi
fi
fi

updateFile="update.finished"