From dc638e46cc7c77b4f83250d67bbdac24534afb89 Mon Sep 17 00:00:00 2001 From: Roman Mohr Date: Tue, 5 Mar 2019 09:08:26 +0100 Subject: [PATCH 1/4] Stick with DOCKER_* env variables for now Keep DOCKER_PREFIX and DOCKER_TAG also for bazel right now. If we change that, let's change it for everything to CONTAINER_TAG and CONTAINER_PREFIX. --- .travis.yml | 4 ++-- Makefile | 4 ++-- cluster/ephemeral-provider-common.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b08cf92705ad..3920482701d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ script: deploy: - provider: script - script: docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" && CONTAINER_PREFIX="index.docker.io/kubevirt" CONTAINER_TAG="latest" make bazel-push-images + script: docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" && DOCKER_PREFIX="index.docker.io/kubevirt" DOCKER_TAG="latest" make bazel-push-images skip_cleanup: true on: branch: master @@ -39,7 +39,7 @@ deploy: all_branches: true condition: $TRAVIS_BRANCH != revert-* - provider: script - script: docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" && CONTAINER_PREFIX="index.docker.io/kubevirt" CONTAINER_TAG="$TRAVIS_TAG" make bazel-push-images + script: docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" && DOCKER_PREFIX="index.docker.io/kubevirt" DOCKER_TAG="$TRAVIS_TAG" make bazel-push-images skip_cleanup: true file: on: diff --git a/Makefile b/Makefile index bd68dc891880..e15e374e4880 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ bazel-push-images: hack/dockerized "bazel run \ --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \ --workspace_status_command=./hack/print-workspace-status.sh \ - --define container_prefix=${CONTAINER_PREFIX} \ - --define container_tag=${CONTAINER_TAG} \ + --define container_prefix=${DOCKER_PREFIX} \ + --define container_tag=${DOCKER_TAG} \ //:push-images" bazel-tests: diff --git a/cluster/ephemeral-provider-common.sh b/cluster/ephemeral-provider-common.sh index 3814eb509bb2..a18b860081d0 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" - CONTAINER_PREFIX=${docker_prefix} CONTAINER_TAG=${docker_tag} make bazel-push-images + DOCKER_PREFIX=${docker_prefix} DOCKER_TAG=${docker_tag} make bazel-push-images # Make sure that all nodes use the newest images container="" From e9fba9b0d792b8a1917f9e8a0530e43ce9c4ce6d Mon Sep 17 00:00:00 2001 From: Roman Mohr Date: Tue, 5 Mar 2019 09:27:34 +0100 Subject: [PATCH 2/4] Fix external provider with bazel change --- cluster/external/provider.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster/external/provider.sh b/cluster/external/provider.sh index 25bd835ba915..9e71f8d60a04 100644 --- a/cluster/external/provider.sh +++ b/cluster/external/provider.sh @@ -31,6 +31,6 @@ function down() { function build() { # Build code and manifests - ${KUBEVIRT_PATH}hack/dockerized "DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./hack/build-manifests.sh" - make push + ${KUBEVIRT_PATH}hack/dockerized "DOCKER_TAG=${DOCKER_TAG} DOCKER_PREFIX=${docker_prefix} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./hack/build-manifests.sh" + DOCKER_PREFIX=${docker_prefix} DOCKER_TAG=${docker_tag} make bazel-push-images } From 0c815ee432dbdb9a4012b872eda684cd516409ab Mon Sep 17 00:00:00 2001 From: Roman Mohr Date: Thu, 7 Mar 2019 09:48:59 +0100 Subject: [PATCH 3/4] Don't check arch and os when installing RPMs Update to newest rpm bazel rules which don't perform the mentioned checks. Allows installing from e.g. Mac OS when rpm is installed there. --- WORKSPACE | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 5b4b28a04a7c..07b5b2c5b4f6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -159,9 +159,9 @@ _go_image_repos() http_archive( name = "io_bazel_rules_container_rpm", - sha256 = "7ace5bc7aa10697196d3c48ef5d73b0fc52b6e27c0bad3ce10751f66c5cc383c", - strip_prefix = "rules_container_rpm-0.0.3", - urls = ["https://github.com/rmohr/rules_container_rpm/archive/v0.0.3.tar.gz"], + sha256 = "b419c25576e148e537a93fafdc10cb78faf1174558d853754727b586793e71d1", + strip_prefix = "rules_container_rpm-0.0.4", + urls = ["https://github.com/rmohr/rules_container_rpm/archive/v0.0.4.tar.gz"], ) # Get container-disk-v1alpha RPM's From c8c2a214933eb7882cec2163f08aac79a34d5451 Mon Sep 17 00:00:00 2001 From: Roman Mohr Date: Thu, 7 Mar 2019 09:58:39 +0100 Subject: [PATCH 4/4] Respect hack/config* files when pushing with bazel When invoking `make bazel-push-images`, respect config settings in the hack folder. --- .gitignore | 4 ++-- Makefile | 7 +------ hack/bazel-push-images.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100755 hack/bazel-push-images.sh diff --git a/.gitignore b/.gitignore index 8ea4b9930110..4ffcdf8d47de 100644 --- a/.gitignore +++ b/.gitignore @@ -32,5 +32,5 @@ tools/vms-generator/vms-generator .coverprofile coverage.html manifests/**/*.tmp -bazel-* -.bazelrc +/bazel-* +/.bazelrc diff --git a/Makefile b/Makefile index e15e374e4880..3ae61acacee2 100644 --- a/Makefile +++ b/Makefile @@ -13,12 +13,7 @@ bazel-build: //cmd/..." bazel-push-images: - hack/dockerized "bazel run \ - --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \ - --workspace_status_command=./hack/print-workspace-status.sh \ - --define container_prefix=${DOCKER_PREFIX} \ - --define container_tag=${DOCKER_TAG} \ - //:push-images" + hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} ./hack/bazel-push-images.sh" bazel-tests: hack/dockerized "bazel test --test_output=errors -- //pkg/... " diff --git a/hack/bazel-push-images.sh b/hack/bazel-push-images.sh new file mode 100755 index 000000000000..138d29b44b16 --- /dev/null +++ b/hack/bazel-push-images.sh @@ -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 2017 Red Hat, Inc. +# + +set -e + +source hack/common.sh +source hack/config.sh + +bazel run \ + --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \ + --workspace_status_command=./hack/print-workspace-status.sh \ + --define container_prefix=${docker_prefix} \ + --define container_tag=${docker_tag} \ + //:push-images