Skip to content
Snippets Groups Projects
Commit 054725ff authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'dind_capable_wait' into 'master'

check every 2 seconds for a minute if docker is ready before failing dind check

See merge request to-be-continuous/docker!84
parents 4b0c4aaa ea965f6e
No related branches found
No related tags found
No related merge requests found
......@@ -329,8 +329,19 @@ stages:
done
}
function is_runner_dind_capable() {
docker info > /dev/null 2>&1
function wait_for_docker_daemon() {
log_info "Wait for Docker daemon..."
# shellcheck disable=SC2034
for i in $(seq 1 30); do
if ! docker info &> /dev/null; then
log_info "... not responding: wait"
sleep 2
else
log_info "... ready: continue"
return
fi
done
fail "... timeout reached: halt"
}
function awkenvsubst() {
......@@ -392,14 +403,6 @@ stages:
unscope_variables
eval_all_secrets
configure_registries_auth
if is_runner_dind_capable
then
docker info
elif [[ -x /kaniko/executor ]]
then
create_kaniko_cache_dir
fi
}
# evaluate the context path
......@@ -462,6 +465,10 @@ stages:
key: "$CI_COMMIT_REF_SLUG-docker"
paths:
- .cache
before_script:
- *docker-scripts
- create_kaniko_cache_dir
.docker-dind-base:
extends: .docker-base
......@@ -488,7 +495,7 @@ stages:
if [[ -n "${DOCKER_REGISTRY_MIRROR}" ]]; then dockerd-entrypoint.sh --registry-mirror ${DOCKER_REGISTRY_MIRROR}; else dockerd-entrypoint.sh; fi || exit
before_script:
- *docker-scripts
- if ! is_runner_dind_capable; then fail "Docker-in-Docker is not enabled on this runner. Either use a Docker-in-Docker capable runner, or disable this job by setting \$DOCKER_BUILD_TOOL to a different value"; fi
- if ! wait_for_docker_daemon; then fail "Docker-in-Docker is not enabled on this runner. Either use a Docker-in-Docker capable runner, or disable this job by setting \$DOCKER_BUILD_TOOL to a different value"; fi
# ==================================================
# Stage: build
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment