From 0901da7830af1f0a2eaa5a1be0da00d4914f1507 Mon Sep 17 00:00:00 2001 From: Matt Rickard Date: Tue, 27 Jun 2017 10:05:43 -0700 Subject: [PATCH] Force docker builds for cross builds --- Makefile | 10 +++++----- docs/contributors/releasing_minikube.md | 2 +- hack/jenkins/minikube_cross_build_and_upload.sh | 2 +- hack/jenkins/release_build_and_upload.sh | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 19394da8189e..8408f65055cd 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ REGISTRY?=gcr.io/k8s-minikube MINIKUBE_BUILD_IMAGE ?= karalabe/xgo-1.8.3 LOCALKUBE_BUILD_IMAGE ?= gcr.io/google_containers/kube-cross:v1.7.1-0 -ISO_BUILD_IMAGE ?= $(REGISTRY)/buildroot-image +ISO_BUILD_IMAGE ?= $(REGISTRY)/buildroot-image ISO_VERSION ?= v0.20.0 ISO_BUCKET ?= minikube/iso @@ -54,14 +54,14 @@ MINIKUBEFILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/miniku MINIKUBE_ENV_LINUX := CGO_ENABLED=1 GOARCH=amd64 GOOS=linux MINIKUBE_ENV_DARWIN := CC=o64-clang CXX=o64-clang++ CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin -MINIKUBE_ENV_WINDOWS := CGO_ENABLED=1 GOARCH=amd64 GOOS=linux +MINIKUBE_ENV_WINDOWS := CGO_ENABLED=0 GOARCH=amd64 GOOS=windows MINIKUBE_DOCKER_CMD := docker run -e IN_DOCKER=1 --user $(shell id -u):$(shell id -g) --workdir /go/src/$(REPOPATH) --entrypoint /bin/bash -v $(PWD):/go/src/$(REPOPATH) $(MINIKUBE_BUILD_IMAGE) -c KUBE_CROSS_DOCKER_CMD := docker run -w /go/src/$(REPOPATH) --user $(shell id -u):$(shell id -g) -e IN_DOCKER=1 -v $(shell pwd):/go/src/$(REPOPATH) $(LOCALKUBE_BUILD_IMAGE) # $(call MINIKUBE_GO_BUILD_CMD, output file, OS) define MINIKUBE_GO_BUILD_CMD - $(call uc,MINIKUBE_ENV_$(2)) go build --installsuffix cgo -ldflags="$(MINIKUBE_LDFLAGS) $(K8S_VERSION_LDFLAGS)" -o $(1) k8s.io/minikube/cmd/minikube + $($(shell echo MINIKUBE_ENV_$(2) | tr a-z A-Z)) go build --installsuffix cgo -ldflags="$(MINIKUBE_LDFLAGS) $(K8S_VERSION_LDFLAGS)" -o $(1) k8s.io/minikube/cmd/minikube endef ifeq ($(BUILD_IN_DOCKER),y) @@ -97,9 +97,9 @@ out/minikube-windows-amd64.exe: out/minikube-windows-amd64 out/minikube-%-amd64: pkg/minikube/assets/assets.go $(shell $(MINIKUBEFILES)) ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y) - $(MINIKUBE_DOCKER_CMD) '$(call MINIKUBE_GO_BUILD_CMD, $@, $*)' + $(MINIKUBE_DOCKER_CMD) '$(call MINIKUBE_GO_BUILD_CMD,$@,$*)' else - $(call MINIKUBE_GO_BUILD_CMD, $@, $*) + $(call MINIKUBE_GO_BUILD_CMD,$@,$*) endif minikube_iso: # old target kept for making tests happy diff --git a/docs/contributors/releasing_minikube.md b/docs/contributors/releasing_minikube.md index 8d40bcab6347..650e79967555 100644 --- a/docs/contributors/releasing_minikube.md +++ b/docs/contributors/releasing_minikube.md @@ -40,7 +40,7 @@ Send a PR for the Makefile change and wait until it is merged. Once the commit Run this command: ```shell -make cross checksum +BUILD_IN_DOCKER=y make cross checksum ``` ## Add the version to the releases.json file diff --git a/hack/jenkins/minikube_cross_build_and_upload.sh b/hack/jenkins/minikube_cross_build_and_upload.sh index d01d80feee3b..19b8abffb075 100755 --- a/hack/jenkins/minikube_cross_build_and_upload.sh +++ b/hack/jenkins/minikube_cross_build_and_upload.sh @@ -38,7 +38,7 @@ fi export GOPATH=~/go # Build all platforms (Windows, Linux, OSX) -make cross +BUILD_IN_DOCKER=y make cross # Build the e2e test target for Darwin and Linux. We don't run tests on Windows yet. # We build these on Linux, but run the tests on different platforms. diff --git a/hack/jenkins/release_build_and_upload.sh b/hack/jenkins/release_build_and_upload.sh index 75e178735847..33af576668e4 100755 --- a/hack/jenkins/release_build_and_upload.sh +++ b/hack/jenkins/release_build_and_upload.sh @@ -38,7 +38,7 @@ cat Makefile | grep "VERSION_MINOR ?=" | grep $VERSION_MINOR cat Makefile | grep "VERSION_BUILD ?=" | grep $VERSION_BUILD # Build and upload -make cross checksum +BUILD_IN_DOCKER=y make cross checksum gsutil cp out/minikube-linux-amd64 gs://$BUCKET/releases/$TAGNAME/ gsutil cp out/minikube-linux-amd64.sha256 gs://$BUCKET/releases/$TAGNAME/