Skip to content

Commit

Permalink
Merge pull request kubevirt#2099 from rmohr/bazel-server
Browse files Browse the repository at this point in the history
Run bazel build server always in the background
  • Loading branch information
rmohr authored Mar 8, 2019
2 parents f13e23f + dffcb44 commit da01881
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
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
5 changes: 5 additions & 0 deletions hack/bazel-server.sh
Original file line number Diff line number Diff line change
@@ -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
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 da01881

Please sign in to comment.