Skip to content

Commit

Permalink
Run bazel build server always in the background
Browse files Browse the repository at this point in the history
Speed up all bazel related operations because it does not have to run in
batch mode.
  • Loading branch information
rmohr committed Mar 7, 2019
1 parent f13e23f commit 0bd333b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cluster/ephemeral-provider-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down
2 changes: 2 additions & 0 deletions hack/bazel-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BAZEL_PID=$(bazel info | grep server_pid | cut -d " " -f 2)
while kill -0 $BAZEL_PID 2>/dev/null; do sleep 1; done
8 changes: 7 additions & 1 deletion hack/dockerized
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 0bd333b

Please sign in to comment.