Skip to content

Commit

Permalink
Force docker builds for cross builds
Browse files Browse the repository at this point in the history
  • Loading branch information
r2d4 committed Jun 27, 2017
1 parent 993a53f commit 0901da7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/contributors/releasing_minikube.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hack/jenkins/minikube_cross_build_and_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion hack/jenkins/release_build_and_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit 0901da7

Please sign in to comment.