Skip to content

Commit

Permalink
Update kubevirt builder image to use go1.13.14
Browse files Browse the repository at this point in the history
- Updated the kubevirt builder image to use go1.13.14.
- We now use go modules to get all the dependencies we need.
  It allows us to just go get the specific version that we need instead
  of having to download and compile it ourselves.
- Set the versions of the dependencies statically.

Signed-off-by: Daniel Belenky <[email protected]>
Signed-off-by: L. Pivarc <[email protected]>
  • Loading branch information
xpivarc committed Aug 26, 2020
1 parent 5f6375c commit 088e768
Show file tree
Hide file tree
Showing 258 changed files with 32,716 additions and 25,064 deletions.
28 changes: 22 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

# Additional bazel rules

# fix for https://github.com/bazelbuild/rules_go/issues/1999 will be included in > v0.20.3
http_archive(
name = "io_bazel_rules_go",
sha256 = "aca4d0081b8bf96dce8f1395904ab1f21f5fea9c08afb9a9c67358982d4491eb",
strip_prefix = "rules_go-b2c7df325cf96bf8daa9c5d329baf85df4b405eb",
sha256 = "38392eb0617c1a9fdff17c4a284f012da13e4feefbaf87d04b3579b107902e9b",
urls = [
"https://github.com/bazelbuild/rules_go/archive/b2c7df325cf96bf8daa9c5d329baf85df4b405eb.tar.gz",
"https://storage.googleapis.com/builddeps/aca4d0081b8bf96dce8f1395904ab1f21f5fea9c08afb9a9c67358982d4491eb",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.22.8/rules_go-v0.22.8.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.22.8/rules_go-v0.22.8.tar.gz",
],
)

Expand Down Expand Up @@ -176,7 +174,7 @@ load(
go_rules_dependencies()

go_register_toolchains(
go_version = "1.12.8",
go_version = "1.13.4",
nogo = "@//:nogo_vet",
)

Expand Down Expand Up @@ -583,3 +581,21 @@ go_repository(
)

register_toolchains("//:py_toolchain")

go_repository(
name = "org_golang_x_mod",
build_file_generation = "on",
build_file_proto_mode = "disable",
importpath = "golang.org/x/mod",
sum = "h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=",
version = "v0.3.0",
)

go_repository(
name = "org_golang_x_xerrors",
build_file_generation = "on",
build_file_proto_mode = "disable",
importpath = "golang.org/x/xerrors",
sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
version = "v0.0.0-20200804184101-5ec99f83aff1",
)
9 changes: 7 additions & 2 deletions cmd/container-disk-v2alpha/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
"time"

. "github.com/onsi/ginkgo"
Expand All @@ -17,11 +18,15 @@ var containerDiskBinary string

func init() {
flag.StringVar(&containerDiskBinary, "container-disk-binary", "_out/cmd/container-disk-v2alpha/container-disk", "path to container disk binary")
flag.Parse()
containerDiskBinary = filepath.Join("../../", containerDiskBinary)

}

var _ = Describe("the containerDisk binary", func() {
BeforeEach(func() {
if !strings.Contains(containerDiskBinary, "../../") {
containerDiskBinary = filepath.Join("../../", containerDiskBinary)
}
})

It("should be able to handle 200 connections in 5 seconds without rejecting one of them", func() {
dir, err := ioutil.TempDir("", "container-disk")
Expand Down
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/Masterminds/semver v1.5.0
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/blang/semver v3.5.1+incompatible
github.com/cloudflare/cfssl v1.4.1 // indirect
github.com/containernetworking/plugins v0.8.2
github.com/coreos/go-iptables v0.4.3
github.com/coreos/go-semver v0.3.0
Expand All @@ -27,7 +28,7 @@ require (
github.com/gogo/protobuf v1.3.0
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.3.3
github.com/golang/protobuf v1.4.1
github.com/google/go-github/v32 v32.0.0
github.com/google/goexpect v0.0.0-20190425035906-112704a48083
github.com/google/gofuzz v1.0.0
Expand Down Expand Up @@ -61,6 +62,7 @@ require (
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae
google.golang.org/grpc v1.30.0
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/cheggaaa/pb.v1 v1.0.28
gopkg.in/ini.v1 v1.42.0
gopkg.in/yaml.v2 v2.2.4
Expand Down Expand Up @@ -115,3 +117,5 @@ replace (

kubevirt.io/client-go => ./staging/src/kubevirt.io/client-go
)

go 1.13
58 changes: 58 additions & 0 deletions go.sum

Large diffs are not rendered by default.

79 changes: 24 additions & 55 deletions hack/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,73 +46,42 @@ RUN wget https://services.gradle.org/distributions/gradle-6.6-bin.zip && \
ENV PATH=$PATH:/opt/gradle/gradle-6.6/bin \
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.8.10-2.fc31.x86_64

ENV GIMME_GO_VERSION=1.12.8
ENV GIMME_GO_VERSION=1.13.14

RUN mkdir -p /gimme && curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | HOME=/gimme bash >> /etc/profile.d/gimme.sh
RUN mkdir -p /gimme && curl -sL \
https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | \
HOME=/gimme bash >> /etc/profile.d/gimme.sh

ENV GOPATH="/go" GOBIN="/usr/bin"
ENV GOPATH="/go" GOBIN="/usr/bin" GO111MODULE="on"

# Install persisten go packages
RUN \
# Install persistent go packages
RUN set -x && \
mkdir -p /go && \
source /etc/profile.d/gimme.sh && \
# Install goimports
go get -d golang.org/x/tools/cmd/goimports && \
cd $GOPATH/src/golang.org/x/tools/cmd/goimports && \
git checkout release-branch.go1.12 && \
go install && \
# Install mvdan/sh
git clone https://github.com/mvdan/sh.git $GOPATH/src/mvdan.cc/sh && \
cd $GOPATH/src/mvdan.cc/sh/cmd/shfmt && \
git checkout v2.5.0 && \
go get mvdan.cc/sh/cmd/shfmt && \
go install && \
go get -u -d k8s.io/code-generator/cmd/deepcopy-gen && \
go get -u -d k8s.io/code-generator/cmd/defaulter-gen && \
go get -u -d k8s.io/kube-openapi/cmd/openapi-gen && \
go get -u -d github.com/golang/protobuf/protoc-gen-go && \
# Install deepcopy-gen
cd $GOPATH/src/k8s.io/code-generator/cmd/deepcopy-gen && \
git checkout v0.16.4 && \
go install && \
# Install defaulter-gen
cd $GOPATH/src/k8s.io/code-generator/cmd/defaulter-gen && \
git checkout v0.16.4 && \
go install && \
# Install client-gen
cd $GOPATH/src/k8s.io/code-generator/cmd/client-gen && \
git checkout v0.16.4 && \
go install && \
# Install openapi-gen
cd $GOPATH/src/k8s.io/kube-openapi/cmd/openapi-gen && \
git checkout 30be4d16710ac61bce31eb28a01054596fe6a9f1 && \
go install && \
# Install protoc-gen-go
cd $GOPATH/src/github.com/golang/protobuf/protoc-gen-go && \
git checkout 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 && \
go install && \
cd /go && \
go clean -cache -modcache -r && \
rm -rf /go && mkdir /go

RUN \
mkdir -p /go && \
go get -v golang.org/x/tools/cmd/goimports@d5fe738 && \
go get -v mvdan.cc/sh/v3/cmd/[email protected] && \
go get -v k8s.io/code-generator/cmd/[email protected] && \
go get -v k8s.io/code-generator/cmd/[email protected] && \
go get -v k8s.io/kube-openapi/cmd/openapi-gen@30be4d1 && \
go get -v github.com/golang/protobuf/protoc-gen-go@1643683 && \
go get -v k8s.io/code-generator/cmd/[email protected] && \
go get -v sigs.k8s.io/controller-tools/cmd/[email protected] && \
go clean -cache -modcache

RUN set -x && \
source /etc/profile.d/gimme.sh && \
go get github.com/mattn/goveralls && \
go get -u github.com/golang/mock/gomock && \
go get -u github.com/rmohr/mock/mockgen && \
go get -u github.com/rmohr/go-swagger-utils/swagger-doc && \
go get -u github.com/onsi/ginkgo/ginkgo && \
cd /go && \
go clean -cache -modcache -r && \
rm -rf /go && mkdir /go
go get -v -u github.com/mattn/[email protected] && \
go get -v -u github.com/golang/mock/[email protected] && \
go get -v -u github.com/rmohr/mock/[email protected] && \
go get -v -u github.com/rmohr/go-swagger-utils/[email protected] && \
go get -v -u github.com/onsi/ginkgo/[email protected] && \
go clean -cache -modcache

# TODO: remove this and the patch below after https://github.com/fvbommel/util/issues/6 got fixed
COPY vbom_ml.diff /tmp/vbom_ml.diff

RUN \
cd / && \
export GO111MODULE=on && \
source /etc/profile.d/gimme.sh && \
git clone https://github.com/kubernetes/test-infra.git && \
cd /test-infra && \
Expand Down
5 changes: 3 additions & 2 deletions pkg/virt-launcher/monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ var fakeQEMUBinary string

func init() {
flag.StringVar(&fakeQEMUBinary, "fake-qemu-binary-path", "_out/cmd/fake-qemu-process/fake-qemu-process", "path to cirros test image")
flag.Parse()
fakeQEMUBinary = filepath.Join("../../", fakeQEMUBinary)
}

var _ = Describe("VirtLauncher", func() {
Expand Down Expand Up @@ -114,6 +112,9 @@ var _ = Describe("VirtLauncher", func() {
}

BeforeEach(func() {
if !strings.Contains(fakeQEMUBinary, "../../") {
fakeQEMUBinary = filepath.Join("../../", fakeQEMUBinary)
}
gracefulShutdownChannel = make(chan struct{})
shutdownCallback := func(pid int) {
syscall.Kill(pid, syscall.SIGTERM)
Expand Down
Loading

0 comments on commit 088e768

Please sign in to comment.