Bump to go1.8.1 and remove the edge GOROOT

pull/6/head
Lucas Käldström 2017-04-25 23:45:47 +03:00
parent e1adcc2367
commit 6b5d5371d9
No known key found for this signature in database
GPG Key ID: 600FEFBBD0D40D21
6 changed files with 15 additions and 34 deletions

View File

@ -19,7 +19,7 @@ FROM gcr.io/google_containers/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
RUN touch /kube-build-image
# To run as non-root we sometimes need to rebuild go stdlib packages.
RUN chmod -R a+rwx /usr/local/go/pkg ${K8S_EDGE_GOROOT}/pkg
RUN chmod -R a+rwx /usr/local/go/pkg
# For running integration tests /var/run/kubernetes is required
# and should be writable by user

View File

@ -15,7 +15,7 @@
# This file creates a standard build environment for building cross
# platform go binary for the architecture kubernetes cares about.
FROM golang:1.7.5
FROM golang:1.8.1
ENV GOARM 7
ENV KUBE_DYNAMIC_CROSSPLATFORMS \
@ -77,12 +77,3 @@ RUN export ETCD_VERSION=v3.0.17; \
&& cd /usr/local/src/etcd \
&& curl -fsSL https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz | tar -xz \
&& ln -s ../src/etcd/etcd-${ETCD_VERSION}-linux-amd64/etcd /usr/local/bin/
# TODO: Remove the need for two golang versions; when we use go1.8 for all other builds we can remove this
ENV K8S_GOLANG_EDGE_VERSION=1.8.1 \
K8S_EDGE_GOROOT=/usr/local/go_k8s_edge
RUN mkdir -p ${K8S_EDGE_GOROOT} \
&& curl -sSL https://golang.org/dl/go${K8S_GOLANG_EDGE_VERSION}.linux-amd64.tar.gz | tar -xz -C ${K8S_EDGE_GOROOT} --strip-components=1
# Prebuild the standard library for those platforms that need the edge GOROOT
RUN for platform in linux/arm linux/ppc64le; do GOOS=${platform%/*} GOARCH=${platform##*/} GOROOT=${K8S_EDGE_GOROOT} go install std; done

View File

@ -1 +1 @@
v1.7.5-3
v1.8.1-1

View File

@ -15,10 +15,10 @@
# Build the etcd-version-monitor image
#
# Usage:
# [GOLANG_VERSION=1.7.5] [REGISTRY=gcr.io/google-containers] [TAG=test] make (build|push)
# [GOLANG_VERSION=1.8.1] [REGISTRY=gcr.io/google-containers] [TAG=test] make (build|push)
# TODO(shyamjvs): Support architectures other than amd64 if needed.
ARCH:=amd64
GOLANG_VERSION?=1.7.5
GOLANG_VERSION?=1.8.1
REGISTRY?=gcr.io/google-containers
TAG?=0.1.0
IMAGE:=$(REGISTRY)/etcd-version-monitor:$(TAG)

View File

@ -274,8 +274,6 @@ kube::golang::set_platform_envs() {
"linux/arm")
export CGO_ENABLED=1
export CC=arm-linux-gnueabihf-gcc
# Use a special edge version of golang since the stable golang version used for everything else doesn't work
export GOROOT=${K8S_EDGE_GOROOT}
;;
"linux/arm64")
export CGO_ENABLED=1
@ -284,8 +282,6 @@ kube::golang::set_platform_envs() {
"linux/ppc64le")
export CGO_ENABLED=1
export CC=powerpc64le-linux-gnu-gcc
# Use a special edge version of golang since the stable golang version used for everything else doesn't work
export GOROOT=${K8S_EDGE_GOROOT}
;;
"linux/s390x")
export CGO_ENABLED=1
@ -487,13 +483,7 @@ kube::golang::build_binaries_for_platform() {
local -a nonstatics=()
local -a tests=()
# Temporary workaround while we have two GOROOT's (which we'll get rid of as soon as we upgrade to go1.8 for amd64 as well)
local GO=go
if [[ "${GOROOT}" == "${K8S_EDGE_GOROOT:-}" ]]; then
GO="${K8S_EDGE_GOROOT}/bin/go"
fi
V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-} GO=${GO}"
V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}"
for binary in "${binaries[@]}"; do
if [[ "${binary}" =~ ".test"$ ]]; then
@ -513,7 +503,7 @@ kube::golang::build_binaries_for_platform() {
kube::log::progress " "
for binary in "${statics[@]:+${statics[@]}}"; do
local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}")
CGO_ENABLED=0 "${GO}" build -o "${outfile}" \
CGO_ENABLED=0 go build -o "${outfile}" \
"${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
@ -522,7 +512,7 @@ kube::golang::build_binaries_for_platform() {
done
for binary in "${nonstatics[@]:+${nonstatics[@]}}"; do
local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}")
"${GO}" build -o "${outfile}" \
go build -o "${outfile}" \
"${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
@ -533,13 +523,13 @@ kube::golang::build_binaries_for_platform() {
else
# Use go install.
if [[ "${#nonstatics[@]}" != 0 ]]; then
"${GO}" install "${goflags[@]:+${goflags[@]}}" \
go install "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${nonstatics[@]:+${nonstatics[@]}}"
fi
if [[ "${#statics[@]}" != 0 ]]; then
CGO_ENABLED=0 "${GO}" install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" \
CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${statics[@]:+${statics[@]}}"
@ -572,13 +562,13 @@ kube::golang::build_binaries_for_platform() {
# doing a staleness check on k8s.io/kubernetes/test/e2e package always
# returns true (always stale). And that's why we need to install the
# test package.
"${GO}" install "${goflags[@]:+${goflags[@]}}" \
go install "${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \
"${testpkg}"
mkdir -p "$(dirname ${outfile})"
"${GO}" test -i -c \
go test -i -c \
"${goflags[@]:+${goflags[@]}}" \
-gcflags "${gogcflags}" \
-ldflags "${goldflags}" \

View File

@ -15,11 +15,11 @@
# Cross-build the serve_hostname image
#
# Usage:
# [TAG=v1.6] [PREFIX=gcr.io/google_containers] [TEST_REGISTRY=gcr.io/k8s-authenticated-test] [ARCH=amd64] [BASEIMAGE=busybox] make all
# [TAG=v1.7] [PREFIX=gcr.io/google_containers] [TEST_REGISTRY=gcr.io/k8s-authenticated-test] [ARCH=amd64] [BASEIMAGE=busybox] make all
.PHONY: all push container clean
TAG ?= v1.6
TAG ?= v1.7
REGISTRY ?= gcr.io/google-containers
TEST_REGISTRY ?= gcr.io/k8s-authenticated-test
@ -31,7 +31,7 @@ ALL_ARCH = amd64 arm arm64 ppc64le s390x
GOARM=7
TEMP_DIR := $(shell mktemp -d)
GOLANG_VERSION=1.7.5
GOLANG_VERSION=1.8.1
BIN = serve_hostname
SRCS = serve_hostname.go