diff --git a/automation/test.sh b/automation/test.sh index 167964506847..ae7675c8623a 100755 --- a/automation/test.sh +++ b/automation/test.sh @@ -180,6 +180,7 @@ build --remote_http_cache=http://bazel-cache.kubevirt-prow.svc.cluster.local:808 EOF make cluster-sync +hack/dockerized bazel shutdown # OpenShift is running important containers under default namespace namespaces=(kubevirt default) diff --git a/cluster/ephemeral-provider-common.sh b/cluster/ephemeral-provider-common.sh index 6045c9690d50..96d5666f4552 100644 --- a/cluster/ephemeral-provider-common.sh +++ b/cluster/ephemeral-provider-common.sh @@ -41,7 +41,7 @@ function _add_common_params() { function build() { # Build everyting and publish it ${KUBEVIRT_PATH}hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/build-manifests.sh" - DOCKER_PREFIX=${docker_prefix} DOCKER_TAG=${docker_tag} make bazel-push-images + hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./hack/bazel-push-images.sh" # Make sure that all nodes use the newest images container="" diff --git a/hack/bazel-server.sh b/hack/bazel-server.sh new file mode 100755 index 000000000000..e70e17d19cad --- /dev/null +++ b/hack/bazel-server.sh @@ -0,0 +1,5 @@ +BAZEL_PID=$(bazel info | grep server_pid | cut -d " " -f 2) +while kill -0 $BAZEL_PID 2>/dev/null; do sleep 1; done +# Might not be necessary, just to be sure that exec shutdowns always succeed +# and are not killed by docker. +sleep 1 diff --git a/hack/dockerized b/hack/dockerized index 772974771f57..5c8399fa2b10 100755 --- a/hack/dockerized +++ b/hack/dockerized @@ -101,9 +101,15 @@ if [ -d "${HOME}/.docker" ]; then volumes="$volumes -v ${HOME}/.docker:/root/.docker:ro,z" fi +# Ensure that a bazel server is running + +if [ -z "$(docker ps --format '{{.Names}}' | grep ${BUILDER}-bazel-server)" ]; then + docker run --network host -d ${volumes} --security-opt label:disable --name ${BUILDER}-bazel-server -w "/root/go/src/kubevirt.io/kubevirt" --rm ${BUILDER} hack/bazel-server.sh +fi + # Run the command test -t 1 && USE_TTY="-it" -docker run --network host --rm ${volumes} --security-opt label:disable ${USE_TTY} -w "/root/go/src/kubevirt.io/kubevirt" ${BUILDER} "$@" +docker exec ${USE_TTY} ${BUILDER}-bazel-server /entrypoint.sh "$@" # Copy the whole kubevirt data out to get generated sources and formatting changes _rsync \