Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

images: Build go-runner:buster-v2.0.0 using go1.15 #1499

Merged
merged 5 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ dependencies:
refPaths:
- path: images/build/cross/variants.yaml
match: \d+.\d+(alpha|beta|rc)?\.?\d+
- path: images/build/go-runner/Makefile
match: GO_VERSION\ \?=\ \d+.\d+(alpha|beta|rc)?\.?\d+
- path: images/build/go-runner/variants.yaml
match: \d+.\d+(alpha|beta|rc)?\.?\d+

- name: "k8s.gcr.io/kube-cross"
version: v1.15.0-1
Expand Down Expand Up @@ -100,7 +104,7 @@ dependencies:
match: BASEIMAGE\?\=\$\(BASE_REGISTRY\)\/debian-iptables-\$\(ARCH\):v\d+\.\d+\.\d+

- name: "k8s.gcr.io/go-runner"
version: buster-v1.0.1
version: buster-v2.0.0
refPaths:
- path: images/build/go-runner/Makefile
match: IMAGE_VERSION\ \?=\ [a-zA-Z]+\-v((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)
Expand Down
21 changes: 16 additions & 5 deletions images/build/go-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,26 @@ ARG DISTROLESS_IMAGE
FROM golang:${GO_VERSION} as builder
WORKDIR /workspace

# Run this with docker build --build_arg goproxy=$(go env GOPROXY) to override the goproxy
ARG goproxy=https://proxy.golang.org
# Run this with docker build --build_arg package=./controlplane/kubeadm or --build_arg package=./bootstrap/kubeadm
ENV GOPROXY=$goproxy

# Copy the sources
COPY ./go-runner.go ./
COPY ./go.* ./

# Allow fallback to 'direct' for GOPROXY
#
# The GOPROXY environment variable now supports skipping proxies that return
# errors. Proxy URLs may now be separated with either commas (,) or pipe
# characters (|). If a proxy URL is followed by a comma, the go command will
# only try the next proxy in the list after a 404 or 410 HTTP response. If a
# proxy URL is followed by a pipe character, the go command will try the next
# proxy in the list after any error. Note that the default value of GOPROXY
# remains https://proxy.golang.org,direct, which does not fall back to direct
# in case of errors.
#
# ref: https://golang.org/doc/go1.15#go-command
ENV GOPROXY="https://proxy.golang.org|direct"

RUN go env

# Cache the go build
RUN go build .

Expand Down
18 changes: 13 additions & 5 deletions images/build/go-runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ IMGNAME = go-runner
IMAGE = $(REGISTRY)/$(IMGNAME)

TAG ?= $(shell git describe --tags --always --dirty)
IMAGE_VERSION ?= buster-v1.0.1
IMAGE_VERSION ?= buster-v2.0.0
CONFIG ?= buster

# Build args
GO_VERSION ?= 1.13.15
GO_VERSION ?= 1.15
DISTROLESS_IMAGE ?= static-debian10

PLATFORMS = linux/amd64 linux/arm64 linux/arm linux/ppc64le linux/s390x
PLATFORMS ?= linux/amd64 linux/arm64 linux/arm linux/ppc64le linux/s390x

HOST_GOOS ?= $(shell go env GOOS)
HOST_GOARCH ?= $(shell go env GOARCH)
Expand All @@ -48,8 +48,10 @@ clean:

.PHONY: container
container: init-docker-buildx
echo "Building go-runner for the following platforms: $(PLATFORMS)"
# https://github.com/docker/buildx/issues/59
$(foreach PLATFORM,$(PLATFORMS), \
echo "Starting build for $(PLATFORM) platform"; \
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build \
--load \
--progress plain \
Expand Down Expand Up @@ -80,6 +82,12 @@ init-docker-buildx:
ifneq ($(shell docker buildx 2>&1 >/dev/null; echo $?),)
$(error "buildx not vailable. Docker 19.03 or higher is required")
endif
docker run --rm --privileged linuxkit/binfmt:4ea3b9b0938cbd19834c096aa31ff475cc75d281
docker buildx create --name multiarch-go-runner --use || true
# Ensure qemu is in binfmt_misc
# NOTE: Please always pin this to a digest for predictability/auditability
# Last updated: 08/21/2020
docker run --rm --privileged multiarch/qemu-user-static@sha256:c772ee1965aa0be9915ee1b018a0dd92ea361b4fa1bcab5bbc033517749b2af4 --reset -p yes

# Ensure we use a builder that can leverage it (the default on linux will not)
docker buildx rm multiarch-go-runner || true
docker buildx create --name multiarch-go-runner --use
docker buildx inspect --bootstrap
4 changes: 2 additions & 2 deletions images/build/go-runner/variants.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variants:
buster:
CONFIG: 'buster'
IMAGE_VERSION: 'buster-v1.0.1'
GO_VERSION: '1.13.15'
IMAGE_VERSION: 'buster-v2.0.0'
GO_VERSION: '1.15'
DISTROLESS_IMAGE: 'static-debian10'