Skip to content

Commit

Permalink
Bazel target to build image bundle for external processing
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Sorensen <marcus_sorensen@apple.com>
  • Loading branch information
mlsorensen committed Jun 18, 2021
1 parent 099be90 commit c2813e2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
12 changes: 12 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ container_bundle(
},
)

# This is for generating a bundle of the core components for external processing
container_bundle(
name = "virt-components-bundle",
images = {
"$(container_prefix)/$(image_prefix)virt-api:$(container_tag)": "//cmd/virt-api:virt-api-image",
"$(container_prefix)/$(image_prefix)virt-controller:$(container_tag)": "//cmd/virt-controller:virt-controller-image",
"$(container_prefix)/$(image_prefix)virt-handler:$(container_tag)": "//cmd/virt-handler:virt-handler-image",
"$(container_prefix)/$(image_prefix)virt-launcher:$(container_tag)": "//cmd/virt-launcher:virt-launcher-image",
"$(container_prefix)/$(image_prefix)virt-operator:$(container_tag)": "//cmd/virt-operator:virt-operator-image",
},
)

# heads up: docker_push is loaded from contrib:push-all, while container_push is loaded earlier from container:container
load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push")

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ bazel-generate:
bazel-build:
hack/dockerized "export BUILD_ARCH=${BUILD_ARCH} && hack/bazel-fmt.sh && hack/bazel-build.sh"

bazel-build-image-bundle:
hack/dockerized "export BUILD_ARCH=${BUILD_ARCH} && hack/bazel-fmt.sh && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PREFIX=${IMAGE_PREFIX} hack/bazel-build-image-bundle.sh"

bazel-build-verify: bazel-build
./hack/dockerized "hack/bazel-fmt.sh"
./hack/verify-generate.sh
Expand Down Expand Up @@ -177,6 +180,7 @@ bump-kubevirtci:
go-all \
bazel-generate \
bazel-build \
bazel-build-image-bundle \
bazel-build-images \
bazel-push-images \
bazel-test \
Expand Down
30 changes: 30 additions & 0 deletions hack/bazel-build-image-bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#
# This file is part of the KubeVirt project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright 2019 Red Hat, Inc.
#

set -e

source hack/common.sh
source hack/config.sh

bazel build \
--config=${ARCHITECTURE} \
--define container_prefix=${docker_prefix} \
--define image_prefix=${image_prefix} \
--define container_tag=${docker_tag} \
//:virt-components-bundle.tar

0 comments on commit c2813e2

Please sign in to comment.