From d15dfc1da03fc973829ed41c8c56efd718beb18c Mon Sep 17 00:00:00 2001 From: Bartosz Rybacki Date: Thu, 9 Dec 2021 17:47:43 +0100 Subject: [PATCH] Make static build (#22) * Make build static and consistent with other plugins Make build work in the same way as for other velero plugins. That ways it is easier to follow velero changes, and easier for other velero plugin developers to jump into the project if needed. Signed-off-by: Bartosz Rybacki * Fix func-tests Signed-off-by: Bartosz Rybacki * Simplify func-tests Travis no longer used Signed-off-by: Bartosz Rybacki --- Dockerfile | 2 +- Makefile | 176 ++++++++++++++++-------- hack/build/build-builder.sh | 31 ----- hack/build/build-dirs.sh | 24 ---- hack/build/build-functest.sh | 19 +-- hack/build/build.sh | 36 ++++- hack/build/docker/builder/Dockerfile | 63 --------- hack/build/docker/builder/entrypoint.sh | 29 ---- hack/build/docker/builder/fedora.repo | 40 ------ hack/build/docker/builder/rsyncd.conf | 19 --- hack/build/in-docker.sh | 45 ------ hack/build/push-builder.sh | 26 ---- hack/build/stop-builder.sh | 24 ---- hack/run-ci.sh | 2 +- hack/run-unit-tests.sh | 2 - 15 files changed, 161 insertions(+), 377 deletions(-) delete mode 100755 hack/build/build-builder.sh delete mode 100755 hack/build/build-dirs.sh delete mode 100644 hack/build/docker/builder/Dockerfile delete mode 100755 hack/build/docker/builder/entrypoint.sh delete mode 100644 hack/build/docker/builder/fedora.repo delete mode 100644 hack/build/docker/builder/rsyncd.conf delete mode 100755 hack/build/in-docker.sh delete mode 100755 hack/build/push-builder.sh delete mode 100755 hack/build/stop-builder.sh diff --git a/Dockerfile b/Dockerfile index f073b97c..46dfc439 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,6 @@ FROM alpine:3.13 RUN mkdir /plugins -COPY bin/kubevirt-velero-plugin /plugins/ +ADD ./kubevirt-velero-plugin /plugins/ USER nobody:nogroup ENTRYPOINT ["/bin/sh", "-c", "cp /plugins/* /target/."] diff --git a/Makefile b/Makefile index d2fccb95..1096229a 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ .PHONY: clean \ all \ build-all \ + build-builder \ build-image \ build-dirs \ push \ @@ -23,12 +24,10 @@ modules \ vendor \ gomod-update \ - stop-builder \ local-deploy-velero \ add-plugin \ remove-plugin \ local-undeploy-velero \ - push-builder \ cluster-up \ cluster-down \ cluster-sync \ @@ -36,17 +35,9 @@ rebuild-functest \ clean-test -DOCKER?=1 -ifeq (${DOCKER}, 1) - # use entrypoint.sh (default) as your entrypoint into the container - DO=./hack/build/in-docker.sh -else - DO=eval -endif - GREEN=\e[0;32m WHITE=\e[0;37m -BIN=bin/kubevirt-velero-plugin +BIN=kubevirt-velero-plugin SRC_FILES=main.go \ $(shell find pkg -name "*.go") @@ -58,65 +49,108 @@ TESTS_SRC_FILES=\ DOCKER_PREFIX?=kubevirt DOCKER_TAG?=latest IMAGE_NAME?=kubevirt-velero-plugin + +# Which architecture to build - see $(ALL_ARCH) for options. +# if the 'local' rule is being run, detect the ARCH from 'go env' +# if it wasn't specified by the caller. +local : ARCH ?= $(shell go env GOOS)-$(shell go env GOARCH) +ARCH ?= linux-amd64 + +platform_temp = $(subst -, ,$(ARCH)) +GOOS = $(word 1, $(platform_temp)) +GOARCH = $(word 2, $(platform_temp)) + # registry prefix is the prefix usable from inside the local cluster KUBEVIRTCI_REGISTRY_PREFIX=registry:5000/kubevirt PORT=$(shell ./cluster-up/cli.sh ports registry) -all: clean build-image +BUILD_IMAGE ?= golang:1.16-stretch -build-image: build-all - @echo -e "${GREEN}Building plugin image${WHITE}" - @docker build -t ${DOCKER_PREFIX}/${IMAGE_NAME}:${DOCKER_TAG} . +all: build-image -build-all: build-builder build-dirs ${BIN} - -${BIN}: ${SRC_FILES} - @echo -e "${GREEN}Building...${WHITE}" - @${DO} hack/build/build.sh +local: build-dirs + GOOS=$(GOOS) \ + GOARCH=$(GOARCH) \ + PKG=$(PKG) \ + BIN=$(BIN) \ + GIT_SHA=$(GIT_SHA) \ + GIT_DIRTY="$(GIT_DIRTY)" \ + OUTPUT_DIR=$$(pwd)/_output/bin/$(GOOS)/$(GOARCH) \ + GO111MODULE=on \ + GOFLAGS=-mod=readonly \ + ./hack/build.sh -push: build-image - @echo -e "${GREEN}Pushing plugin image to local registry${WHITE}" - @docker push ${DOCKER_PREFIX}/${IMAGE_NAME}:${DOCKER_TAG} +build-all: build-dirs _output/bin/$(GOOS)/$(GOARCH)/$(BIN) -cluster-push-image: build-image - @echo -e "${GREEN}Pushing plugin image to local K8s cluster${WHITE}" - DOCKER_PREFIX=${DOCKER_PREFIX} IMAGE_NAME=${IMAGE_NAME} DOCKER_TAG=${DOCKER_TAG} PORT=${PORT} KUBEVIRTCI_REGISTRY_PREFIX=${KUBEVIRTCI_REGISTRY_PREFIX} \ - hack/build/cluster-push-image.sh +build-builder: + @echo "deprecated" +_output/bin/$(GOOS)/$(GOARCH)/$(BIN): build-dirs ${SRC_FILES} + @echo -e "${GREEN}Building...${WHITE}" + @echo "building: $@" + $(MAKE) shell CMD="-c '\ + GOOS=$(GOOS) \ + GOARCH=$(GOARCH) \ + PKG=$(PKG) \ + BIN=$(BIN) \ + GIT_SHA=$(GIT_SHA) \ + GIT_DIRTY="$(GIT_DIRTY)" \ + OUTPUT_DIR=/output/$(GOOS)/$(GOARCH) \ + GO111MODULE=on \ + GOFLAGS=-mod=readonly \ + ./hack/build/build.sh'" + +TTY := $(shell tty -s && echo "-t") + +shell: build-dirs + @echo "running docker: $@" + @docker run \ + -e GOFLAGS \ + -i $(TTY) \ + --rm \ + -u $$(id -u):$$(id -g) \ + -v "$$(pwd)/_output/bin:/output:delegated" \ + -v $$(pwd)/.go/pkg:/go/pkg \ + -v $$(pwd)/.go/src:/go/src \ + -v $$(pwd)/.go/std:/go/std \ + -v $$(pwd):/go/src/kubevirt-velero-plugin:z \ + -v $$(pwd)/.go/std/$(GOOS)_$(GOARCH):/usr/local/go/pkg/$(GOOS)_$(GOARCH)_static \ + -v "$$(pwd)/.go/go-build:/.cache/go-build:delegated" \ + -e CGO_ENABLED=0 \ + -w /go/src/kubevirt-velero-plugin \ + $(BUILD_IMAGE) \ + /bin/sh $(CMD) -add-plugin: local-deploy-velero - @echo -e "${GREEN}Adding the plugin to local Velero${WHITE}" - IMAGE_NAME=${IMAGE_NAME} DOCKER_TAG=${DOCKER_TAG} DOCKER_PREFIX=${KUBEVIRTCI_REGISTRY_PREFIX} hack/velero/add-plugin.sh +build-dirs: + @mkdir -p _output/bin/$(GOOS)/$(GOARCH) + @mkdir -p .go/src/$(PKG) .go/pkg .go/bin .go/std/$(GOOS)/$(GOARCH) .go/go-build -remove-plugin: - @echo -e "${GREEN}Removing the plugin from local Velero${WHITE}" - IMAGE_NAME=${IMAGE_NAME} DOCKER_TAG=${DOCKER_TAG} DOCKER_PREFIX=${KUBEVIRTCI_REGISTRY_PREFIX} hack/velero/remove-plugin.sh +container-name: + @echo "container: ${DOCKER_PREFIX}/${IMAGE_NAME}:${DOCKER_TAG}" -local-deploy-velero: - @echo -e "${GREEN}Deploying velero to local cluster${WHITE}" - @hack/velero/deploy-velero.sh +build-image: build-all + @echo -e "${GREEN}Building plugin image${WHITE}" + cp Dockerfile _output/bin/$(GOOS)/$(GOARCH)/Dockerfile + docker build -t ${DOCKER_PREFIX}/${IMAGE_NAME}:${DOCKER_TAG} -f _output/bin/$(GOOS)/$(GOARCH)/Dockerfile _output/bin/$(GOOS)/$(GOARCH) -local-undeploy-velero: - @echo -e "${GREEN}Removing velero from local cluster${WHITE}" - @hack/velero/undeploy-velero.sh +push: build-image + @echo -e "${GREEN}Pushing plugin image to local registry${WHITE}" + @docker push ${DOCKER_PREFIX}/${IMAGE_NAME}:${DOCKER_TAG} gomod-update: modules vendor -build-builder: stop-builder - @hack/build/build-builder.sh - -push-builder: - @hack/build/push-builder.sh - clean-dirs: @echo -e "${GREEN}Removing output directories${WHITE}" - @${DO} "rm -rf _output bin" + rm -rf .container-* _output/.dockerfile-* + rm -rf .go _output -clean: clean-dirs stop-builder +clean: clean-dirs + @echo "cleaning" + docker rmi $(BUILD_IMAGE) test: build-dirs @echo -e "${GREEN}Testing${WHITE}" - @${DO} "CGO_ENABLED=0 go test -v -timeout 60s ./pkg/..." + @$(MAKE) shell CMD="-c 'CGO_ENABLED=0 go test -v -timeout 60s ./pkg/...'" test-functional: ${TESTS_BINARY} @echo -e "${GREEN}Running functional tests${WHITE}" @@ -129,7 +163,19 @@ clean-test: ${TESTS_BINARY}: ${TESTS_SRC_FILES} ${TESTS_OUT_DIR} @echo -e "${GREEN}Building functional tests${WHITE}" - @${DO} hack/build/build-functest.sh + $(MAKE) shell CMD="-c '\ + GOOS=$(GOOS) \ + GOARCH=$(GOARCH) \ + PKG=$(PKG) \ + BIN=$(BIN) \ + GIT_SHA=$(GIT_SHA) \ + GIT_DIRTY="$(GIT_DIRTY)" \ + OUTPUT_DIR=/output/$(GOOS)/$(GOARCH) \ + GO111MODULE=on \ + GOFLAGS=-mod=readonly \ + TESTS_OUT_DIR=$(TESTS_OUT_DIR) \ + JOB_TYPE="${JOB_TYPE:-}" \ + ./hack/build/build-functest.sh'" ${TESTS_OUT_DIR}: @mkdir -p ${TESTS_OUT_DIR} @@ -141,18 +187,32 @@ vendor: @${DO} "GO111MODULE=on go mod tidy -v" @${DO} "GO111MODULE=on go mod vendor -v" -build-dirs: - @echo -e "${GREEN}Creating output directories${WHITE}" - @hack/build/build-dirs.sh - -stop-builder: - @echo -n -e "${GREEN}Stopping builder...${WHITE}" - @hack/build/stop-builder.sh > /dev/null - @echo -e "${GREEN} done${WHITE}" - goveralls: test ${DO} "TRAVIS_JOB_ID=${TRAVIS_JOB_ID} TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} TRAVIS_BRANCH=${TRAVIS_BRANCH} ./hack/build/goveralls.sh" +# local test cluster targets +cluster-push-image: build-image + @echo -e "${GREEN}Pushing plugin image to local K8s cluster${WHITE}" + DOCKER_PREFIX=${DOCKER_PREFIX} IMAGE_NAME=${IMAGE_NAME} DOCKER_TAG=${DOCKER_TAG} PORT=${PORT} KUBEVIRTCI_REGISTRY_PREFIX=${KUBEVIRTCI_REGISTRY_PREFIX} \ + hack/build/cluster-push-image.sh + + +add-plugin: local-deploy-velero + @echo -e "${GREEN}Adding the plugin to local Velero${WHITE}" + IMAGE_NAME=${IMAGE_NAME} DOCKER_TAG=${DOCKER_TAG} DOCKER_PREFIX=${KUBEVIRTCI_REGISTRY_PREFIX} hack/velero/add-plugin.sh + +remove-plugin: + @echo -e "${GREEN}Removing the plugin from local Velero${WHITE}" + IMAGE_NAME=${IMAGE_NAME} DOCKER_TAG=${DOCKER_TAG} DOCKER_PREFIX=${KUBEVIRTCI_REGISTRY_PREFIX} hack/velero/remove-plugin.sh + +local-deploy-velero: + @echo -e "${GREEN}Deploying velero to local cluster${WHITE}" + @hack/velero/deploy-velero.sh + +local-undeploy-velero: + @echo -e "${GREEN}Removing velero from local cluster${WHITE}" + @hack/velero/undeploy-velero.sh + cluster-up: @hack/cluster-up.sh diff --git a/hack/build/build-builder.sh b/hack/build/build-builder.sh deleted file mode 100755 index f42fa680..00000000 --- a/hack/build/build-builder.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -#Copyright 2019 The CDI Authors. -# -#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. - -set -e -if [ -z "$KUBEVIRTCI_PATH" ]; then - KUBEVIRTCI_PATH="$( - cd "$(dirname "${BASH_SOURCE[0]}")/" - echo "$(pwd)/" - )" -fi -source "${KUBEVIRTCI_PATH}"/../config.sh - -# Build the encapsulated compile and test container -(cd ${BUILDER_SPEC} && docker build --tag ${BUILDER_IMAGE} .) - -DIGEST=$(docker images --digests | grep ${UNTAGGED_BUILDER_IMAGE} | grep ${BUILDER_TAG} | awk '{ print $4 }') -echo "Image: ${BUILDER_IMAGE}" -echo "Digest: ${DIGEST}" diff --git a/hack/build/build-dirs.sh b/hack/build/build-dirs.sh deleted file mode 100755 index 97231155..00000000 --- a/hack/build/build-dirs.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -#Copyright 2021 The CDI Authors. -# -#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. - -set -e - -script_dir="$(cd "$(dirname "$0")" && pwd -P)" -source "${script_dir}"/../config.sh - -mkdir -p _output/bin/${GOOS}/${GOARCH} -mkdir -p -m 777 _output/gocache/ -mkdir -p bin \ No newline at end of file diff --git a/hack/build/build-functest.sh b/hack/build/build-functest.sh index af03feda..4c49ca6b 100755 --- a/hack/build/build-functest.sh +++ b/hack/build/build-functest.sh @@ -14,13 +14,16 @@ #See the License for the specific language governing permissions and #limitations under the License. -set -e +set -euo pipefail -script_dir="$(cd "$(dirname "$0")" && pwd -P)" -source "${script_dir}"/../config.sh +export PATH=$PATH:$HOME/gopath/bin + +test_path="tests" +(cd $test_path; go install github.com/onsi/ginkgo/ginkgo@latest) +(cd $test_path; GOFLAGS= go get github.com/onsi/gomega) +(cd $test_path; go mod tidy; go mod vendor) +test_out_path=${test_path}/_out +mkdir -p ${test_out_path} +(cd $test_path; ginkgo build .) +mv ${test_path}/tests.test ${TESTS_OUT_DIR} -mkdir -p ${TESTS_OUT_DIR}/ -# use vendor -export GO111MODULE=off -ginkgo build tests/ -mv tests/tests.test ${TESTS_OUT_DIR}/ diff --git a/hack/build/build.sh b/hack/build/build.sh index 6ee876bd..ecb93022 100755 --- a/hack/build/build.sh +++ b/hack/build/build.sh @@ -14,12 +14,36 @@ #See the License for the specific language governing permissions and #limitations under the License. -set -e +set -o errexit +set -o nounset +set -o pipefail -script_dir="$(cd "$(dirname "$0")" && pwd -P)" -source "${script_dir}"/../config.sh +if [ -z "${BIN}" ]; then + echo "BIN must be set" + exit 1 +fi +if [ -z "${GOOS}" ]; then + echo "GOOS must be set" + exit 1 +fi +if [ -z "${GOARCH}" ]; then + echo "GOARCH must be set" + exit 1 +fi -mkdir -p _output/bin/${GOOS}/${GOARCH} -go build -a -ldflags '-extldflags "-static"' -tags static -o _output/bin/${GOOS}/${GOARCH} . -ln -f _output/bin/${GOOS}/${GOARCH}/${BIN} ${BIN_DIR}/${BIN} \ No newline at end of file +export CGO_ENABLED=0 + +if [[ -z "${OUTPUT_DIR:-}" ]]; then + OUTPUT_DIR=. +fi +OUTPUT=${OUTPUT_DIR}/${BIN} +if [[ "${GOOS}" = "windows" ]]; then + OUTPUT="${OUTPUT}.exe" +fi + +go build \ + -o ${OUTPUT} \ + -installsuffix "static" \ + -mod=readonly \ + ./ \ No newline at end of file diff --git a/hack/build/docker/builder/Dockerfile b/hack/build/docker/builder/Dockerfile deleted file mode 100644 index 4a605e78..00000000 --- a/hack/build/docker/builder/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -FROM registry.fedoraproject.org/fedora-minimal:32 -## Fedora version cannot be higher until the runtime image for Velero -## is not upgraded. Velero runs on ubuntu:focal which has glibc 2.31 -## while fedora >=33 includes glibc 2.32. - -LABEL maintainer="The KubeVirt Project " - -COPY fedora.repo /tmp/fedora_ci.dnf.repo -RUN sed -i 's/proxy = None//gI' /tmp/fedora_ci.dnf.repo && \ - cat /tmp/fedora_ci.dnf.repo && \ - mkdir /etc/yum.repos.d/old && \ - mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/old && \ - mv /tmp/fedora_ci.dnf.repo /etc/yum.repos.d/fedora.repo && \ - microdnf update -y && microdnf install -y \ - diffutils \ - git \ - gcc \ - gcc-c++ \ - glibc-devel \ - golang \ - findutils \ - autoconf \ - automake \ - libtool \ - jq \ - rsync-daemon \ - rsync \ - patch \ - unzip \ - buildah \ - crun \ - && microdnf clean all && \ - mv /etc/yum.repos.d/old/* /etc/yum.repos.d/ && \ - rmdir /etc/yum.repos.d/old - -ENV GIMME_GO_VERSION=1.16.10 GOPATH="/go" KUBEBUILDER_VERSION="2.3.1" ARCH="amd64" GO111MODULE="on" - -RUN mkdir -p /gimme && curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | HOME=/gimme bash >> /etc/profile.d/gimme.sh - -RUN \ - . /etc/profile.d/gimme.sh && \ - eval $(go env) && \ - go get github.com/onsi/ginkgo/ginkgo && \ - go get golang.org/x/tools/cmd/goimports && \ - go get mvdan.cc/sh/cmd/shfmt && \ - go get github.com/mattn/goveralls && \ - go get -u golang.org/x/lint/golint && \ - go get github.com/rmohr/go-swagger-utils/swagger-doc && \ - go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0 && \ - go get github.com/securego/gosec/v2/cmd/gosec@0ce48a5 && \ - go get github.com/onsi/ginkgo/ginkgo && \ - go get github.com/onsi/gomega/... && \ - rm -rf "${GOPATH}/pkg" - -ADD entrypoint.sh /entrypoint.sh -COPY rsyncd.conf /etc/rsyncd.conf -RUN \ - sed 's/#mount_program = "\/usr\/bin\/fuse-overlayfs"/mount_program = "\/usr\/bin\/fuse-overlayfs"/' /etc/containers/storage.conf > /etc/containers/storage.conf.new && \ - cp /etc/containers/storage.conf.new /etc/containers/storage.conf -ENV BUILDAH_ISOLATION=chroot \ - PATH="/go/bin:${PATH}" - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/hack/build/docker/builder/entrypoint.sh b/hack/build/docker/builder/entrypoint.sh deleted file mode 100755 index 25b301fe..00000000 --- a/hack/build/docker/builder/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -#Copyright 2018 The CDI Authors. -# -#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. - -# Keep the pipefail here, or the unit tests won't return an error when needed. -set -eo pipefail - -source /etc/profile.d/gimme.sh - -export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk -export PATH=${GOPATH}/bin:/opt/gradle/gradle-4.3.1/bin:$PATH - -eval "$@" - -if [ "$KUBEVIRTCI_RUNTIME" != "podman" ] && [ -n ${RUN_UID} ] && [ -n ${RUN_GID} ]; then - find . -user root -exec chown -h ${RUN_UID}:${RUN_GID} {} \; -fi diff --git a/hack/build/docker/builder/fedora.repo b/hack/build/docker/builder/fedora.repo deleted file mode 100644 index 0ba959c2..00000000 --- a/hack/build/docker/builder/fedora.repo +++ /dev/null @@ -1,40 +0,0 @@ -[fedora-base-fc31] -clean_requirements_on_remove=True -tsflags=nodocs -name=Fedora $releasever - $basearch -failovermethod=priority -#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ -metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch -enabled=1 -metadata_expire=7d -repo_gpgcheck=0 -type=rpm -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch -skip_if_unavailable=False - -[fedora-updates-fc31] -clean_requirements_on_remove=True -tsflags=nodocs -name=Fedora $releasever - $basearch - Updates -failovermethod=priority -#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Everything/$basearch/ -metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch -enabled=1 -repo_gpgcheck=0 -type=rpm -gpgcheck=1 -metadata_expire=6h -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch -skip_if_unavailable=False - -[copr:copr.fedorainfracloud.org:vbatts:bazel] -name=Copr repo for bazel owned by vbatts -baseurl=https://copr-be.cloud.fedoraproject.org/results/vbatts/bazel/fedora-$releasever-$basearch/ -type=rpm-md -skip_if_unavailable=True -gpgcheck=1 -gpgkey=https://copr-be.cloud.fedoraproject.org/results/vbatts/bazel/pubkey.gpg -repo_gpgcheck=0 -enabled=1 -enabled_metadata=1 diff --git a/hack/build/docker/builder/rsyncd.conf b/hack/build/docker/builder/rsyncd.conf deleted file mode 100644 index f98577f3..00000000 --- a/hack/build/docker/builder/rsyncd.conf +++ /dev/null @@ -1,19 +0,0 @@ -gid = 0 -uid = 0 -log file = /dev/stdout -reverse lookup = no -[build] - hosts allow = * - read only = false - path = /root/go/src/kubevirt.io/kubevirt-velero-plugin/ - comment = input sources -[out] - hosts allow = * - read only = false - path = /root/go/src/kubevirt.io/kubevirt-velero-plugin/_out - comment = build output -[vendor] - hosts allow = * - read only = false - path = /root/go/src/kubevirt.io/kubevirt-velero-plugin/vendor - comment = vendor directory diff --git a/hack/build/in-docker.sh b/hack/build/in-docker.sh deleted file mode 100755 index 46bc243d..00000000 --- a/hack/build/in-docker.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -#Copyright 2021 The CDI Authors. -# -#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. - -set -e - -script_dir="$(cd "$(dirname "$0")" && pwd -P)" -source "${script_dir}"/../config.sh - -WORK_DIR="/go/src/kubevirt.io/kubevirt-velero-plugin" - -# Ensure that a build server is running -if [ -z "$(${DOCKER_CMD} ps --format '{{.Image}}' | grep ${BUILDER_IMAGE})" ]; then - ${DOCKER_CMD} run \ - --rm \ - -d \ - --name ${BUILDER_CONTAINER_NAME} \ - -v ${PLUGIN_DIR}:${WORK_DIR}:rw,Z \ - -v ${CACHE_DIR}:/gocache:rw,Z \ - -e RUN_UID=$(id -u) \ - -e RUN_GID=$(id -g) \ - -e KUBEVIRTCI_RUNTIME=${KUBEVIRTCI_RUNTIME} \ - -e GOCACHE=/gocache \ - -w ${WORK_DIR} \ - --privileged \ - -v ${DOCKER_HOST_SOCK}:/run/docker.sock \ - ${BUILDER_IMAGE} "while true; do sleep 24h; done" -fi - -# Execute the build -[ -t 1 ] && USE_TTY="-it" - -${DOCKER_CMD} exec ${USE_TTY} ${BUILDER_CONTAINER_NAME} bash -c "$@" diff --git a/hack/build/push-builder.sh b/hack/build/push-builder.sh deleted file mode 100755 index f4568c10..00000000 --- a/hack/build/push-builder.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -#Copyright 2019 The CDI Authors. -# -#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. - -set -e -if [ -z "$KUBEVIRTCI_PATH" ]; then - KUBEVIRTCI_PATH="$( - cd "$(dirname "$BASH_SOURCE[0]")/" - echo "$(pwd)/" - )" -fi -source "${KUBEVIRTCI_PATH}"/../config.sh - -docker push ${BUILDER_IMAGE} \ No newline at end of file diff --git a/hack/build/stop-builder.sh b/hack/build/stop-builder.sh deleted file mode 100755 index 07f56409..00000000 --- a/hack/build/stop-builder.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -#Copyright 2021 The CDI Authors. -# -#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. - -set -e - -script_dir="$(cd "$(dirname "$0")" && pwd -P)" -source "${script_dir}"/../config.sh - -if [ -n "$(docker ps --format '{{.Names}}' | grep ${BUILDER_CONTAINER_NAME})" ]; then - docker stop ${BUILDER_CONTAINER_NAME} -fi diff --git a/hack/run-ci.sh b/hack/run-ci.sh index 63442d00..64f43c08 100755 --- a/hack/run-ci.sh +++ b/hack/run-ci.sh @@ -17,7 +17,7 @@ set -e # Setup a cluster -make build-builder cluster-up cluster-push-image cluster-sync CLUSTER_PREFIX='-p pull-kvp-functional-test' +make cluster-up cluster-push-image cluster-sync CLUSTER_PREFIX='-p pull-kvp-functional-test' # Run the tests make test-functional CLUSTER_PREFIX='-p pull-kvp-functional-test' diff --git a/hack/run-unit-tests.sh b/hack/run-unit-tests.sh index 801d573c..528a045b 100755 --- a/hack/run-unit-tests.sh +++ b/hack/run-unit-tests.sh @@ -16,6 +16,4 @@ set -e -make build-builder -# Run the tests make test