Skip to content

Commit

Permalink
Use remote cache server
Browse files Browse the repository at this point in the history
  • Loading branch information
Artyom Lukianov committed Feb 17, 2019
1 parent 439a9b7 commit 09dd6bf
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 22 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ script:
- make generate
- if [[ -n "$(git status --porcelain)" ]] ; then echo "It seems like you need to run
`make generate`. Please run it and commit the changes"; git status --porcelain; false; fi
- make bazel-generate
- if [[ -n "$(git status --porcelain)" ]] ; then echo "It seems like you need to run
`make bazel-generate`. Please run it and commit the changes"; git status --porcelain; false; fi
- if diff <(git grep -c '') <(git grep -cI '') | egrep -v -e 'docs/.*\.png|swagger-ui' -e 'vendor/*'
| grep '^<'; then echo "Binary files are present in git repostory."; false; fi
- make build
Expand Down
5 changes: 5 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
# gazelle:prefix kubevirt.io/kubevirt
gazelle(name = "gazelle")

load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")

buildifier(name = "buildifier")

genrule(
name = "get-version",
srcs = [],
Expand Down Expand Up @@ -131,6 +135,7 @@ container_bundle(
# cmd images
"$(container_prefix)/container-disk-v1alpha:$(container_tag)": "//cmd/container-disk-v1alpha:container-disk-v1alpha-image",
"$(container_prefix)/example-hook-sidecar:$(container_tag)": "//cmd/example-hook-sidecar:example-hook-sidecar-image",
"$(container_prefix)/example-cloudinit-hook-sidecar:$(container_tag)": "//cmd/example-cloudinit-hook-sidecar:example-cloudinit-hook-sidecar-image",
"$(container_prefix)/subresource-access-test:$(container_tag)": "//cmd/subresource-access-test:subresource-access-test-image",
"$(container_prefix)/virt-controller:$(container_tag)": "//cmd/virt-controller:virt-controller-image",
"$(container_prefix)/virt-launcher:$(container_tag)": "//cmd/virt-launcher:virt-launcher-image",
Expand Down
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ export GO15VENDOREXPERIMENT := 1
all:
hack/dockerized "./hack/check.sh && KUBEVIRT_VERSION=${KUBEVIRT_VERSION} ./hack/build-go.sh install ${WHAT} && ./hack/build-copy-artifacts.sh ${WHAT} && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/build-manifests.sh"

bazel-buildifier:
SYNC_VENDOR=true hack/dockerized "bazel run //:buildifier"

bazel-buildozer:
SYNC_VENDOR=true hack/dockerized "\
bazel run @com_github_bazelbuild_buildtools//buildozer -- 'add cdeps //:libvirt-libs //:libvirt-headers' //vendor/github.com/libvirt/libvirt-go:go_default_library && \
bazel run @com_github_bazelbuild_buildtools//buildozer -- 'add copts -Ibazel-out/k8-fastbuild/genfiles' //vendor/github.com/libvirt/libvirt-go:go_default_library"

bazel-generate:
SYNC_VENDOR=true hack/dockerized "bazel run //:gazelle"

Expand All @@ -20,7 +28,7 @@ bazel-push-images:
--define container_tag=${CONTAINER_TAG} \
//:push-images"

generate:
generate: bazel-generate bazel-buildozer bazel-buildifier
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/generate.sh"

apidocs:
Expand Down Expand Up @@ -112,7 +120,10 @@ builder-build:
builder-publish:
./hack/builder/publish.sh

.PHONY: bazel-generate \
.PHONY: \
bazel-buildifier \
bazel-buildozer \
bazel-generate \
bazel-build \
bazel-build-images \
bazel-push-images \
Expand Down
10 changes: 10 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ http_archive(
sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb",
)

http_archive(
name = "com_github_bazelbuild_buildtools",
strip_prefix = "buildtools-db073457c5a56d810e46efc18bb93a4fd7aa7b5e",
# version 0.20.0
url = "https://github.com/bazelbuild/buildtools/archive/db073457c5a56d810e46efc18bb93a4fd7aa7b5e.zip",
)

load(
"@bazel_tools//tools/build_defs/repo:git.bzl",
"git_repository",
Expand Down Expand Up @@ -93,6 +100,9 @@ load(
)
gazelle_dependencies()

load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies")
buildifier_dependencies()

# Winrmcli dependencies
go_repository(
name = "com_github_masterzen_winrmcli",
Expand Down
7 changes: 7 additions & 0 deletions automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ set -e
echo "Nodes are ready:"
kubectl get nodes

# Create .bazelrc to use remote cache
cat >.bazelrc <<EOF
startup --host_jvm_args=-Dbazel.DigestFunction=sha256
build --remote_local_fallback
build --remote_http_cache=http://bazel-cache.kubevirt-prow.svc.cluster.local:8080/kubevirt.io/kubevirt
EOF

make cluster-sync

# OpenShift is running important containers under default namespace
Expand Down
14 changes: 14 additions & 0 deletions cmd/example-cloudinit-hook-sidecar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,17 @@ go_binary(
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)

load(
"@io_bazel_rules_docker//container:container.bzl",
"container_image",
)

container_image(
name = "example-cloudinit-hook-sidecar-image",
base = "@fedora//image",
files = [":example-cloudinit-hook-sidecar"],
directory = "/",
entrypoint = ["/example-cloudinit-hook-sidecar"],
visibility = ["//visibility:public"],
)
12 changes: 0 additions & 12 deletions hack/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,10 @@ fi

if [ "${target}" = "push-cache" ]; then
docker push kubevirt/builder-cache:${KUBEVIRT_UPDATE_CACHE_FROM}
if [ -n "$KUBEVIRT_UPDATE_CACHE_FROM" ]; then
for arg in $args; do
BIN_NAME=$(basename $arg)
docker push kubevirt/${BIN_NAME}:${KUBEVIRT_UPDATE_CACHE_FROM}
done
fi
fi

if [ "${target}" = "pull-cache" ]; then
docker pull kubevirt/builder-cache:${KUBEVIRT_CACHE_FROM}
if [ -n "$KUBEVIRT_CACHE_FROM" ]; then
for arg in $args; do
BIN_NAME=$(basename $arg)
docker pull kubevirt/${BIN_NAME}:${KUBEVIRT_CACHE_FROM} || true
done
fi
fi

if [[ "${build_tests}" == "true" ]]; then
Expand Down
15 changes: 15 additions & 0 deletions images/cdi-http-import-server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ pkg_tar(
package_dir = "usr/share/nginx/html/images",
)

genrule(
name = "cirros-img",
srcs = ["@cirros_image//file"],
outs = ["usr/share/nginx/html/images/cirros.img"],
cmd = "mkdir disk && cat $(location @cirros_image//file) > $@",
)

pkg_tar(
name = "cirros-img-tar",
srcs = [":cirros-img"],
mode = "644",
package_dir = "usr/share/nginx/html/images",
)

pkg_tar(
name = "nginx-config-tar",
srcs = [
Expand All @@ -38,6 +52,7 @@ container_image(
],
tars = [
":alpine-tar",
":cirros-img-tar",
":nginx-config-tar",
],
directory = "/",
Expand Down
7 changes: 2 additions & 5 deletions vendor/github.com/libvirt/libvirt-go/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 09dd6bf

Please sign in to comment.