Merge pull request #33803 from ixdy/go1.7-darwin-client-binaries

Automatic merge from submit-queue

Use patched golang1.7.1 for cross-builds targeting darwin

This PR extends #32517 to use the patched go1.7.1 introduced by that PR to build all darwin targets (e.g. kubectl).

This is necessary because binaries built with earlier versions of Go regularly segfault on macOS Sierra (see #32999 and #33070).

This solution is somewhat hacky, but we intend to cherry-pick this to 1.4, and switching all of 1.4 to build with go1.7.1 is very high risk.

I haven't yet pushed the cross build image yet, so this will fail to build. Will test locally and update with results.

First step of fixing #33801.

cc @luxas @pwittrock @david-mcmahon @liggitt @smarterclayton @jfrazelle @Starefossen @gerred
This commit is contained in:
Kubernetes Submit Queue 2016-09-30 12:29:18 -07:00 committed by GitHub
commit 2628af06f8
3 changed files with 8 additions and 2 deletions

View File

@ -84,9 +84,11 @@ ENV K8S_PATCHED_GOLANG_VERSION=1.7.1 \
RUN mkdir -p ${K8S_PATCHED_GOROOT} \ RUN mkdir -p ${K8S_PATCHED_GOROOT} \
&& curl -sSL https://github.com/golang/go/archive/go${K8S_PATCHED_GOLANG_VERSION}.tar.gz | tar -xz -C ${K8S_PATCHED_GOROOT} --strip-components=1 && curl -sSL https://github.com/golang/go/archive/go${K8S_PATCHED_GOLANG_VERSION}.tar.gz | tar -xz -C ${K8S_PATCHED_GOROOT} --strip-components=1
# We need a patched go1.7.1 for linux/arm (https://github.com/kubernetes/kubernetes/issues/29904)
# We need go1.7.1 for all darwin builds (https://github.com/kubernetes/kubernetes/issues/32999)
COPY golang-patches/CL28857-go1.7.1-luxas.patch ${K8S_PATCHED_GOROOT}/ COPY golang-patches/CL28857-go1.7.1-luxas.patch ${K8S_PATCHED_GOROOT}/
RUN cd ${K8S_PATCHED_GOROOT} \ RUN cd ${K8S_PATCHED_GOROOT} \
&& patch -p1 < CL28857-go1.7.1-luxas.patch \ && patch -p1 < CL28857-go1.7.1-luxas.patch \
&& cd src \ && cd src \
&& GOROOT_FINAL=${K8S_PATCHED_GOROOT} GOROOT_BOOTSTRAP=/usr/local/go ./make.bash \ && GOROOT_FINAL=${K8S_PATCHED_GOROOT} GOROOT_BOOTSTRAP=/usr/local/go ./make.bash \
&& for platform in linux/arm; do GOOS=${platform%/*} GOARCH=${platform##*/} GOROOT=${K8S_PATCHED_GOROOT} go install std; done && for platform in linux/arm darwin/386 darwin/amd64; do GOOS=${platform%/*} GOARCH=${platform##*/} GOROOT=${K8S_PATCHED_GOROOT} go install std; done

View File

@ -1 +1 @@
v1.6.3-7 v1.6.3-8

View File

@ -236,6 +236,7 @@ kube::golang::set_platform_envs() {
if [[ ${platform} == "linux/arm" ]]; then if [[ ${platform} == "linux/arm" ]]; then
export CGO_ENABLED=1 export CGO_ENABLED=1
export CC=arm-linux-gnueabi-gcc export CC=arm-linux-gnueabi-gcc
# See https://github.com/kubernetes/kubernetes/issues/29904
export GOROOT=${K8S_PATCHED_GOROOT} export GOROOT=${K8S_PATCHED_GOROOT}
elif [[ ${platform} == "linux/arm64" ]]; then elif [[ ${platform} == "linux/arm64" ]]; then
export CGO_ENABLED=1 export CGO_ENABLED=1
@ -243,6 +244,9 @@ kube::golang::set_platform_envs() {
elif [[ ${platform} == "linux/ppc64le" ]]; then elif [[ ${platform} == "linux/ppc64le" ]]; then
export CGO_ENABLED=1 export CGO_ENABLED=1
export CC=powerpc64le-linux-gnu-gcc export CC=powerpc64le-linux-gnu-gcc
elif [[ ${platform} == "darwin/"* ]]; then
# See https://github.com/kubernetes/kubernetes/issues/32999
export GOROOT=${K8S_PATCHED_GOROOT}
fi fi
fi fi
} }