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

Add support for Golang 1.15.4 #68

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pipeline {
DOCKER_REGISTRY_SECRET = 'secret/observability-team/ci/docker-registry/prod'
REGISTRY = 'docker.elastic.co'
STAGING_IMAGE = "${env.REGISTRY}/observability-ci"
GO_VERSION = '1.14.2'
GO_VERSION = '1.15.4'
}
options {
timeout(time: 2, unit: 'HOURS')
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TARGETS=go1.10 go1.11 go1.12 go1.13 go1.14
TARGETS=go1.10 go1.11 go1.12 go1.13 go1.14 go1.15

build: status=".status.build"
build:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ The base image used is Debian 9 (stretch) unless otherwise specified.

## Build Tags

- `1.10.8-main`, `1.11.13-main`, `1.12.12-main`, `1.13.12-main`, `1.14.7` - linux/{amd64,386} and windows/{amd64,386}
- `1.10.8-arm`, `1.11.13-arm`, `1.12.12-arm`, `1.13.12-arm`, `1.14.7` - linux/{armv5,armv6,armv7,arm64}
- `1.10.8-darwin`, `1.11.13-darwin`, `1.12.12-darwin`, `1.13.12-darwin`, `1.14.7` - darwin/{amd64,386}
- `1.10.8-ppc`, `1.11.13-ppc`, `1.12.12-ppc`, `1.13.12-ppc`, `1.14.7` - linux/{ppc64,ppc64le}
- `1.10.8-mips`, `1.11.13-mips`, `1.12.12-mips`, `1.13.12-mips`, `1.14.7` - linux/{mips,mipsle,mips64,mips64le}
- `1.10.8-s390x`, `1.11.13-s390x`, `1.12.12-s390`, `1.13.12-s390`, `1.14.7` - linux/s390x
- `1.10.8-main-debian7`, `1.11.13-main-debian7`, `1.12.12-debian7`, `1.13.12-debian7`, `1.14.7` - linux/{amd64,386} and windows/{amd64,386} (Debian 7
- `1.10.8-main`, `1.11.13-main`, `1.12.12-main`, `1.13.12-main`, `1.14.7-main`, `1.15.4-main` - linux/{amd64,386} and windows/{amd64,386}
- `1.10.8-arm`, `1.11.13-arm`, `1.12.12-arm`, `1.13.12-arm`, `1.14.7-arm`, `1.15.4-arm` - linux/{armv5,armv6,armv7,arm64}
- `1.10.8-darwin`, `1.11.13-darwin`, `1.12.12-darwin`, `1.13.12-darwin`, `1.14.7-darwin`, `1.15.3-darwin/amd64` - darwin/{amd64,386}
- `1.10.8-ppc`, `1.11.13-ppc`, `1.12.12-ppc`, `1.13.12-ppc`, `1.14.7-ppc`, `1.15.4-ppc` - linux/{ppc64,ppc64le}
- `1.10.8-mips`, `1.11.13-mips`, `1.12.12-mips`, `1.13.12-mips`, `1.14.7-mips`, `1.15.4-mips` - linux/{mips,mipsle,mips64,mips64le}
- `1.10.8-s390x`, `1.11.13-s390x`, `1.12.12-s390`, `1.13.12-s390`, `1.14.7-s390`, `1.15.4-s390` - linux/s390x
- `1.10.8-main-debian7`, `1.11.13-main-debian7`, `1.12.12-debian7`, `1.13.12-debian7`, `1.14.7-debian7`, `1.15.4-debian7` - linux/{amd64,386} and windows/{amd64,386} (Debian 7
uses glibc 2.13 so the resulting binaries (if dynamically linked) have greater
compatibility.)
- `1.10.8-main-debian8`, `1.11.13-main-debian8`, `1.12.12-main-debian8`, `1.13.12-debian8`, `1.14.7` - linux/{amd64,386} and windows/{amd64,386} (Debian 8
- `1.10.8-main-debian8`, `1.11.13-main-debian8`, `1.12.12-main-debian8`, `1.13.12-debian8`, `1.14.7-debian8`, `1.15.4-debian8` - linux/{amd64,386} and windows/{amd64,386} (Debian 8
uses glibc 2.19)

## Usage Example
Expand Down
11 changes: 11 additions & 0 deletions go1.15/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# mips ppc s390x are temporarily disabled. See: https://github.com/elastic/golang-crossbuild/issues/71
IMAGES := base main darwin arm

build:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;)

# Requires login at https://docker.elastic.co:7000/.
push:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) push || exit 1;)

.PHONY: build push
26 changes: 26 additions & 0 deletions go1.15/Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/../Makefile.common

NAME := golang-crossbuild
VERSION := 1.15.5
DEBIAN_VERSION ?= 9
SUFFIX := -$(shell basename $(CURDIR))
TAG_EXTENSION ?=

export DEBIAN_VERSION TAG_EXTENSION

build:
@echo ">> Building $(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)"
@go run $(SELF_DIR)/../template.go -t Dockerfile.tmpl -o Dockerfile
@docker build -t "$(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)" \
--build-arg REPOSITORY=$(REPOSITORY) \
--build-arg VERSION=$(VERSION) \
--build-arg DEBIAN_VERSION=$(DEBIAN_VERSION) \
--build-arg TAG_EXTENSION=$(TAG_EXTENSION) \
--build-arg IMAGE="$(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)" \
--build-arg VCS_REF="$(VCS_REF)" \
--build-arg VCS_URL="$(VCS_URL)" \
--build-arg BUILD_DATE="$(BUILD_DATE)" \
.

.PHONY: build
14 changes: 14 additions & 0 deletions go1.15/Makefile.debian7
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
IMAGES := base main
DEBIAN_VERSION := 7
TAG_EXTENSION := -debian7

export DEBIAN_VERSION TAG_EXTENSION

build:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;)

# Requires login at https://docker.elastic.co:7000/.
push:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) push || exit 1;)

.PHONY: build push
14 changes: 14 additions & 0 deletions go1.15/Makefile.debian8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
IMAGES := base main
DEBIAN_VERSION := 8
TAG_EXTENSION := -debian8

export DEBIAN_VERSION TAG_EXTENSION

build:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;)

# Requires login at https://docker.elastic.co:7000/.
push:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) push || exit 1;)

.PHONY: build push
14 changes: 14 additions & 0 deletions go1.15/Makefile.debian9
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
IMAGES := base main
DEBIAN_VERSION := 9
TAG_EXTENSION := -debian9

export DEBIAN_VERSION TAG_EXTENSION

build:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;)

# Requires login at https://docker.elastic.co:7000/.
push:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) push || exit 1;)

.PHONY: build push
1 change: 1 addition & 0 deletions go1.15/arm/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Makefile
62 changes: 62 additions & 0 deletions go1.15/arm/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
ARG REPOSITORY
ARG VERSION
FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base

RUN \
dpkg --add-architecture arm64 \
# && dpkg --add-architecture armhf \
# && dpkg --add-architecture armel \
&& apt-get update -qq \
&& apt-get install -qq -y \
--no-install-recommends \
--allow-unauthenticated \
crossbuild-essential-arm64 \
crossbuild-essential-armel \
crossbuild-essential-armhf \
linux-libc-dev-arm64-cross \
linux-libc-dev-armel-cross \
linux-libc-dev-armhf-cross \
librpm-dev:arm64 \
libc-dev:arm64 \
libpopt-dev:arm64 \
linux-libc-dev:arm64 \
libxml2-dev:arm64 \
libxml2:arm64 \
libicu-dev:arm64 \
libicu57:arm64 \
icu-devtools:arm64 \
libsystemd-dev:arm64 \
# librpm-dev:armhf \
# libc-dev:armhf \
# libpopt-dev:armhf \
# linux-libc-dev:armhf \
# libxml2-dev:armhf \
# libxml2:armhf \
# libicu-dev:armhf \
# libicu57:armhf \
# icu-devtools:armhf \
# libsystemd-dev:armhf \
# librpm-dev:armel \
# libc-dev:armel \
# libpopt-dev:armel \
# linux-libc-dev:armel \
# libxml2-dev:armel \
# libxml2:armel \
# libicu-dev:armel \
# libicu57:armel \
# icu-devtools:armel \
# libsystemd-dev:armel \
&& rm -rf /var/lib/apt/lists/*

COPY rootfs /

# Build-time metadata as defined at http://label-schema.org.
ARG BUILD_DATE
ARG IMAGE
ARG VCS_REF
ARG VCS_URL
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name=$IMAGE \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.schema-version="1.0"
1 change: 1 addition & 0 deletions go1.15/arm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../Makefile.common
17 changes: 17 additions & 0 deletions go1.15/arm/rootfs/compilers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

linux:
armv7:
CC: arm-linux-gnueabihf-gcc
CXX: arm-linux-gnueabihf-g++
armv6:
# Using debian armel for ARMv6.
# This is the same as ARMv5 so it will use softfp instead of hardfp.
CC: arm-linux-gnueabi-gcc
CXX: arm-linux-gnueabi-g++
armv5:
CC: arm-linux-gnueabi-gcc
CXX: arm-linux-gnueabi-g++
arm64:
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
1 change: 1 addition & 0 deletions go1.15/base/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Makefile
49 changes: 49 additions & 0 deletions go1.15/base/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
ARG DEBIAN_VERSION
FROM debian:${DEBIAN_VERSION}

{{if or (eq .DEBIAN_VERSION "7") (eq .DEBIAN_VERSION "8") -}}
# Replace sources.list in order to use archive.debian.org.
COPY sources-debian{{.DEBIAN_VERSION}}.list /etc/apt/sources.list
{{- end}}

RUN \
apt-get -o Acquire::Check-Valid-Until=false update \
&& apt-get dist-upgrade -y \
&& apt-get install -y --no-install-recommends --allow-unauthenticated \
build-essential \
ca-certificates \
curl \
git \
gnupg \
make \
file \
flex \
bison \
&& rm -rf /var/lib/apt/lists/*

ARG GOLANG_VERSION=1.15.5
ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ARG GOLANG_DOWNLOAD_SHA256=9a58494e8da722c3aef248c9227b0e9c528c7318309827780f16220998180a0d

RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH

COPY rootfs /

WORKDIR /
RUN go get -d . \
&& go build -o /crossbuild /entrypoint.go \
&& rm -rf /go/* /root/.cache/* /entrypoint.go

ENV GOLANG_CROSSBUILD=1
VOLUME /app
WORKDIR /app
ENTRYPOINT ["/crossbuild"]
1 change: 1 addition & 0 deletions go1.15/base/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../Makefile.common
Loading