Workaround for resolving deb.debian.org

The stx-init-env script sets up a minikube profile
and immediately starts building the container images.

Occasionally, the minikube network has not yet finished setup
when the build image step starts, which causes some URLs
to fail to resolve, most often deb.debian.org

While the root cause investigation is pending,
this commit adds a short pause in between these steps
to prevent the issue.

In addition, some extra logging is added for clarity.

Test Plan:
pass - ./stx-init-env --rebuild

Partial-Bug: 2093371

Change-Id: I4f5ce7849799b3fdd3a0bb4e64bab244b95cca94
Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
This commit is contained in:
Leonardo Fagundes Luz Serrano 2025-01-09 16:01:47 -03:00
parent 451a7a695a
commit c6b4ff0e88

@ -710,6 +710,8 @@ elif [[ $RESTART_MINIKUBE -eq 1 ]] ; then
warn "--restart-minikube is only supported on minikube platform -- ignoring"
fi
# Workaround: Wait for Minikube network to stabilize before building images
sleep 10
if [[ -n "${BUILD_DOCKER_IMAGES}" ]] ; then
notice "Building docker images"
@ -718,6 +720,8 @@ if [[ -n "${BUILD_DOCKER_IMAGES}" ]] ; then
docker_build_args+=("--no-cache")
fi
for img in $BUILD_DOCKER_IMAGES; do
info "Starting to build image: $img:$DOCKER_TAG_LOCAL"
extra_build_args=()
if grep -q -E '^\s*ARG\s+STX_MIRROR_URL\s*=' "$STX_TOOLS_DIR/"stx/dockerfiles/$img.Dockerfile ; then
init_stx_mirror_url
@ -725,8 +729,12 @@ if [[ -n "${BUILD_DOCKER_IMAGES}" ]] ; then
extra_build_args+=("--build-arg" "STX_MIRROR_URL=$STX_MIRROR_URL")
fi
fi
docker build "${docker_build_args[@]}" "${extra_build_args[@]}" -t $img:$DOCKER_TAG_LOCAL -f "$STX_TOOLS_DIR/"stx/dockerfiles/$img.Dockerfile "$STX_TOOLS_DIR" || exit 1
info "built image $img:$DOCKER_TAG_LOCAL"
cmd="docker build "${docker_build_args[@]}" "${extra_build_args[@]}" -t $img:$DOCKER_TAG_LOCAL -f "$STX_TOOLS_DIR/"stx/dockerfiles/$img.Dockerfile "$STX_TOOLS_DIR""
info "Running command: ${cmd}"
eval "$cmd" || exit 1
info "Finished building image: $img:$DOCKER_TAG_LOCAL"
done
fi