From a33428f85431254fe0c8ff7d8417526b5e321324 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Fri, 31 Jul 2020 21:17:00 +0200 Subject: [PATCH 01/21] fix: back to Debian 7 --- go1.14/Makefile.common | 2 +- go1.14/arm/Dockerfile.tmpl | 2 +- go1.14/base/Dockerfile.tmpl | 1 - go1.14/darwin/Dockerfile.tmpl | 3 ++- go1.14/mips/Dockerfile.tmpl | 2 +- go1.14/ppc/Dockerfile.tmpl | 2 +- go1.14/s390x/Dockerfile.tmpl | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go1.14/Makefile.common b/go1.14/Makefile.common index 9c08e833..9f5cdd32 100644 --- a/go1.14/Makefile.common +++ b/go1.14/Makefile.common @@ -3,7 +3,7 @@ include $(SELF_DIR)/../Makefile.common NAME := golang-crossbuild VERSION := 1.14.6 -DEBIAN_VERSION ?= 9 +DEBIAN_VERSION ?= 7 SUFFIX := -$(shell basename $(CURDIR)) TAG_EXTENSION ?= diff --git a/go1.14/arm/Dockerfile.tmpl b/go1.14/arm/Dockerfile.tmpl index 9a29dd58..e640a35d 100644 --- a/go1.14/arm/Dockerfile.tmpl +++ b/go1.14/arm/Dockerfile.tmpl @@ -6,7 +6,7 @@ RUN \ dpkg --add-architecture arm64 \ # && dpkg --add-architecture armhf \ # && dpkg --add-architecture armel \ - && apt-get update -qq \ + && apt-get -o Acquire::Check-Valid-Until=false update -qq \ && apt-get install -qq -y \ --no-install-recommends \ --allow-unauthenticated \ diff --git a/go1.14/base/Dockerfile.tmpl b/go1.14/base/Dockerfile.tmpl index ff07bfb3..33dd61a2 100644 --- a/go1.14/base/Dockerfile.tmpl +++ b/go1.14/base/Dockerfile.tmpl @@ -8,7 +8,6 @@ COPY sources-debian{{.DEBIAN_VERSION}}.list /etc/apt/sources.list 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 \ diff --git a/go1.14/darwin/Dockerfile.tmpl b/go1.14/darwin/Dockerfile.tmpl index c5a0048a..4bb02978 100644 --- a/go1.14/darwin/Dockerfile.tmpl +++ b/go1.14/darwin/Dockerfile.tmpl @@ -3,7 +3,8 @@ ARG VERSION FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base RUN \ - apt-get update && apt-get install -y --no-install-recommends --allow-unauthenticated \ + apt-get -o Acquire::Check-Valid-Until=false update \ + && apt-get install -y --no-install-recommends --allow-unauthenticated \ clang \ llvm \ && rm -rf /var/lib/apt/lists/* diff --git a/go1.14/mips/Dockerfile.tmpl b/go1.14/mips/Dockerfile.tmpl index 25fe93d6..71c3a74e 100644 --- a/go1.14/mips/Dockerfile.tmpl +++ b/go1.14/mips/Dockerfile.tmpl @@ -4,7 +4,7 @@ FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base RUN \ dpkg --add-architecture mips64el \ - && apt-get update -qq \ + && apt-get -o Acquire::Check-Valid-Until=false update -qq \ && apt-get install -qq -y \ --no-install-recommends \ --allow-unauthenticated \ diff --git a/go1.14/ppc/Dockerfile.tmpl b/go1.14/ppc/Dockerfile.tmpl index acdc1870..aa151fd2 100644 --- a/go1.14/ppc/Dockerfile.tmpl +++ b/go1.14/ppc/Dockerfile.tmpl @@ -4,7 +4,7 @@ FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base RUN \ dpkg --add-architecture ppc64el \ - && apt-get update -qq \ + && apt-get -o Acquire::Check-Valid-Until=false update -qq \ && apt-get install -y -qq \ --no-install-recommends \ --allow-unauthenticated \ diff --git a/go1.14/s390x/Dockerfile.tmpl b/go1.14/s390x/Dockerfile.tmpl index 0efefa28..2b844d8d 100644 --- a/go1.14/s390x/Dockerfile.tmpl +++ b/go1.14/s390x/Dockerfile.tmpl @@ -4,7 +4,7 @@ FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base RUN \ dpkg --add-architecture s390x \ - && apt-get update -qq \ + && apt-get -o Acquire::Check-Valid-Until=false update -qq \ && apt-get install -y -qq \ --no-install-recommends \ --allow-unauthenticated \ From b743fe077384adb28e54d85ea53b9005d4fdf1f1 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Fri, 2 Oct 2020 22:15:13 +0200 Subject: [PATCH 02/21] fix: support x86 on Debian7 support x86 and Darwin on Debian8 support for all platforms on Debian9 support x86 and Darwin on Debian10 --- Jenkinsfile | 81 +++++++++++++++++++------------ Makefile | 6 ++- go1.14/Makefile.debian10 | 14 ++++++ go1.14/Makefile.debian8 | 3 +- go1.14/Makefile.debian9 | 2 +- go1.14/arm/Dockerfile.tmpl | 46 +++++++----------- go1.14/arm/rootfs/helloWorld.c | 5 ++ go1.14/base/Dockerfile.tmpl | 5 +- go1.14/base/sources-debian10.list | 2 + go1.14/base/sources-debian8.list | 2 +- go1.14/base/sources-debian9.list | 2 + go1.14/darwin/Dockerfile.tmpl | 15 +++++- go1.14/darwin/rootfs/helloWorld.c | 5 ++ go1.14/main/Dockerfile.tmpl | 10 +++- go1.14/main/rootfs/helloWorld.c | 5 ++ go1.14/mips/Dockerfile.tmpl | 20 +++++++- go1.14/mips/rootfs/helloWorld.c | 5 ++ go1.14/ppc/Dockerfile.tmpl | 22 ++++++++- go1.14/ppc/rootfs/helloWorld.c | 5 ++ go1.14/s390x/Dockerfile.tmpl | 22 ++++++++- go1.14/s390x/rootfs/helloWorld.c | 5 ++ 21 files changed, 207 insertions(+), 75 deletions(-) create mode 100644 go1.14/Makefile.debian10 create mode 100644 go1.14/arm/rootfs/helloWorld.c create mode 100644 go1.14/base/sources-debian10.list create mode 100644 go1.14/base/sources-debian9.list create mode 100644 go1.14/darwin/rootfs/helloWorld.c create mode 100644 go1.14/main/rootfs/helloWorld.c create mode 100644 go1.14/mips/rootfs/helloWorld.c create mode 100644 go1.14/ppc/rootfs/helloWorld.c create mode 100644 go1.14/s390x/rootfs/helloWorld.c diff --git a/Jenkinsfile b/Jenkinsfile index 9bdfa096..423f1af4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ @Library('apm@current') _ pipeline { - agent { label 'ubuntu && immutable' } + agent { label 'ubuntu-20 && immutable' } environment { REPO = 'golang-crossbuild' BASE_DIR = "src/github.com/elastic/${env.REPO}" @@ -35,37 +35,54 @@ pipeline { stash name: 'source', useDefaultExcludes: false } } - stage('Build') { - steps { - withGithubNotify(context: 'Build') { - deleteDir() - unstash 'source' - buildImages() - } - } - } - stage('Staging') { - environment { - REPOSITORY = "${env.STAGING_IMAGE}" - } - steps { - withGithubNotify(context: 'Staging') { - // It will use the already cached docker images that were created in the - // Build stage. But it's required to retag them with the staging repo. - buildImages() - publishImages() + stage('Package'){ + matrix { + agent { label 'ubuntu-20 && immutable' } + axes { + axis { + name "MAKEFILE" + values 'Makefile', 'Makefile.debian7', 'Makefile.debian8', 'Makefile.debian9', 'Makefile.debian10' + } + axis { + name 'GO_FOLDER' + values 'go1.10', 'go1.11', 'go1.12', 'go1.13', 'go1.14' + } } - } - } - stage('Release') { - when { - branch 'master' - } - stages { - stage('Publish') { - steps { - withGithubNotify(context: 'Publish') { - publishImages() + stages { + stage('Build') { + steps { + withGithubNotify(context: 'Build') { + deleteDir() + unstash 'source' + buildImages() + } + } + } + stage('Staging') { + environment { + REPOSITORY = "${env.STAGING_IMAGE}" + } + steps { + withGithubNotify(context: 'Staging') { + // It will use the already cached docker images that were created in the + // Build stage. But it's required to retag them with the staging repo. + buildImages() + publishImages() + } + } + } + stage('Release') { + when { + branch 'master' + } + stages { + stage('Publish') { + steps { + withGithubNotify(context: 'Publish') { + publishImages() + } + } + } } } } @@ -82,7 +99,7 @@ pipeline { def buildImages(){ withGoEnv(){ dir("${env.BASE_DIR}"){ - sh 'make build' + sh 'make -c ${GO_FOLDER} -f ${MAKEFILE} build' } } } diff --git a/Makefile b/Makefile index a45ea9da..e64435fa 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ build: $(MAKE) -C $(var) $@; \ $(MAKE) -C $(var) -f Makefile.debian7 $@; \ $(MAKE) -C $(var) -f Makefile.debian8 $@; \ - $(MAKE) -C $(var) -f Makefile.debian9 $@;) + $(MAKE) -C $(var) -f Makefile.debian9 $@; \ + $(MAKE) -C $(var) -f Makefile.debian10 $@;) @make -C fpm $@ # Requires login at https://docker.elastic.co:7000/. @@ -14,7 +15,8 @@ push: $(MAKE) -C $(var) $@; \ $(MAKE) -C $(var) -f Makefile.debian7 $@; \ $(MAKE) -C $(var) -f Makefile.debian8 $@; \ - $(MAKE) -C $(var) -f Makefile.debian9 $@;) + $(MAKE) -C $(var) -f Makefile.debian9 $@; \ + $(MAKE) -C $(var) -f Makefile.debian10 $@;) @make -C fpm $@ .PHONY: build push diff --git a/go1.14/Makefile.debian10 b/go1.14/Makefile.debian10 new file mode 100644 index 00000000..04126feb --- /dev/null +++ b/go1.14/Makefile.debian10 @@ -0,0 +1,14 @@ +IMAGES := base main darwin +DEBIAN_VERSION := 10 +TAG_EXTENSION := -debian10 + +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 diff --git a/go1.14/Makefile.debian8 b/go1.14/Makefile.debian8 index a9de1e2e..11834e52 100644 --- a/go1.14/Makefile.debian8 +++ b/go1.14/Makefile.debian8 @@ -1,10 +1,11 @@ -IMAGES := base main +IMAGES := base main darwin DEBIAN_VERSION := 8 TAG_EXTENSION := -debian8 export DEBIAN_VERSION TAG_EXTENSION build: + export |grep TAG_EXTENSION @$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;) # Requires login at https://docker.elastic.co:7000/. diff --git a/go1.14/Makefile.debian9 b/go1.14/Makefile.debian9 index d7eacbde..26265d60 100644 --- a/go1.14/Makefile.debian9 +++ b/go1.14/Makefile.debian9 @@ -1,4 +1,4 @@ -IMAGES := base main +IMAGES := base main arm darwin mips ppc s390x DEBIAN_VERSION := 9 TAG_EXTENSION := -debian9 diff --git a/go1.14/arm/Dockerfile.tmpl b/go1.14/arm/Dockerfile.tmpl index e640a35d..febe3723 100644 --- a/go1.14/arm/Dockerfile.tmpl +++ b/go1.14/arm/Dockerfile.tmpl @@ -1,21 +1,16 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture arm64 \ -# && dpkg --add-architecture armhf \ -# && dpkg --add-architecture armel \ - && apt-get -o Acquire::Check-Valid-Until=false update -qq \ + && 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 \ @@ -26,30 +21,25 @@ RUN \ 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 \ + librpm3:arm64 \ + librpmio3:arm64 \ + librpmbuild3:arm64 \ + librpmsign3:arm64 \ + libsqlite3-dev:arm64 \ + libnss3:arm64 \ + libsqlite3-0:arm64 \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && aarch64-linux-gnu-gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && file helloWorld | cut -d "," -f 2 | grep -c 'ARM aarch64'\ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.14/arm/rootfs/helloWorld.c b/go1.14/arm/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.14/arm/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.14/base/Dockerfile.tmpl b/go1.14/base/Dockerfile.tmpl index 49899d87..2d25b754 100644 --- a/go1.14/base/Dockerfile.tmpl +++ b/go1.14/base/Dockerfile.tmpl @@ -1,10 +1,9 @@ ARG DEBIAN_VERSION FROM debian:${DEBIAN_VERSION} -{{if or (eq .DEBIAN_VERSION "7") (eq .DEBIAN_VERSION "8") -}} +ARG TAG_EXTENSION # Replace sources.list in order to use archive.debian.org. -COPY sources-debian{{.DEBIAN_VERSION}}.list /etc/apt/sources.list -{{- end}} +COPY sources${TAG_EXTENSION}.list /etc/apt/sources.list RUN \ apt-get -o Acquire::Check-Valid-Until=false update \ diff --git a/go1.14/base/sources-debian10.list b/go1.14/base/sources-debian10.list new file mode 100644 index 00000000..bff91789 --- /dev/null +++ b/go1.14/base/sources-debian10.list @@ -0,0 +1,2 @@ +deb http://deb.debian.org/debian buster main +deb [arch=amd64,i386] http://security.debian.org/debian-security buster/updates main diff --git a/go1.14/base/sources-debian8.list b/go1.14/base/sources-debian8.list index d20d69a1..03a1b7fb 100644 --- a/go1.14/base/sources-debian8.list +++ b/go1.14/base/sources-debian8.list @@ -1,2 +1,2 @@ deb http://archive.debian.org/debian jessie main -deb http://security.debian.org/debian-security jessie/updates main +deb [arch=amd64,i386] http://security.debian.org/debian-security jessie/updates main diff --git a/go1.14/base/sources-debian9.list b/go1.14/base/sources-debian9.list new file mode 100644 index 00000000..449c0aa7 --- /dev/null +++ b/go1.14/base/sources-debian9.list @@ -0,0 +1,2 @@ +deb http://deb.debian.org/debian stretch main +deb [arch=amd64,i386] http://security.debian.org/debian-security stretch/updates main diff --git a/go1.14/darwin/Dockerfile.tmpl b/go1.14/darwin/Dockerfile.tmpl index 4bb02978..5536ef5b 100644 --- a/go1.14/darwin/Dockerfile.tmpl +++ b/go1.14/darwin/Dockerfile.tmpl @@ -1,6 +1,7 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ apt-get -o Acquire::Check-Valid-Until=false update \ @@ -29,6 +30,18 @@ ENV PATH $OSXCROSS_PATH/bin:$PATH COPY rootfs / +# Basic test +RUN cd / \ + && o64-clang helloWorld.c -o helloWorld \ + && file helloWorld \ + && file helloWorld | grep -c 'Mach-O 64-bit x86_64' + +RUN cd / \ + && o32-clang helloWorld.c -o helloWorld \ + && file helloWorld \ + && file helloWorld | grep -c 'Mach-O i386' \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.14/darwin/rootfs/helloWorld.c b/go1.14/darwin/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.14/darwin/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.14/main/Dockerfile.tmpl b/go1.14/main/Dockerfile.tmpl index 24525ecf..86711f84 100644 --- a/go1.14/main/Dockerfile.tmpl +++ b/go1.14/main/Dockerfile.tmpl @@ -1,6 +1,6 @@ ARG REPOSITORY ARG VERSION -ARG TAG_EXTENSION= +ARG TAG_EXTENSION='' FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ @@ -22,6 +22,14 @@ RUN \ COPY rootfs / +# Basic test +RUN cd / \ + && gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && file helloWorld | cut -d "," -f 2 | grep -c 'x86-64' \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.14/main/rootfs/helloWorld.c b/go1.14/main/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.14/main/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.14/mips/Dockerfile.tmpl b/go1.14/mips/Dockerfile.tmpl index 71c3a74e..f03eb5fd 100644 --- a/go1.14/mips/Dockerfile.tmpl +++ b/go1.14/mips/Dockerfile.tmpl @@ -1,6 +1,7 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture mips64el \ @@ -25,10 +26,27 @@ RUN \ libicu57:mips64el \ icu-devtools:mips64el \ libsystemd-dev:mips64el \ + librpm3:mips64el \ + librpmio3:mips64el \ + librpmbuild3:mips64el \ + librpmsign3:mips64el \ + libsqlite3-dev:mips64el \ + libnss3:mips64el \ + libsqlite3-0:mips64el \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && mips64el-linux-gnuabi64-gcc-6 helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && readelf -h helloWorld | grep -c 'MIPS R3000' \ + && readelf -h helloWorld | grep -c 'ELF64' \ + && readelf -h helloWorld | grep -c "little endian" \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.14/mips/rootfs/helloWorld.c b/go1.14/mips/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.14/mips/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.14/ppc/Dockerfile.tmpl b/go1.14/ppc/Dockerfile.tmpl index aa151fd2..5fe2f40c 100644 --- a/go1.14/ppc/Dockerfile.tmpl +++ b/go1.14/ppc/Dockerfile.tmpl @@ -1,11 +1,12 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture ppc64el \ && apt-get -o Acquire::Check-Valid-Until=false update -qq \ - && apt-get install -y -qq \ + && apt-get install -qq -y \ --no-install-recommends \ --allow-unauthenticated \ g++-6-powerpc64-linux-gnu \ @@ -21,10 +22,27 @@ RUN \ libicu57:ppc64el \ icu-devtools:ppc64el \ libsystemd-dev:ppc64el \ + librpm3:ppc64el \ + librpmio3:ppc64el \ + librpmbuild3:ppc64el \ + librpmsign3:ppc64el \ + libsqlite3-dev:ppc64el \ + libnss3:ppc64el \ + libsqlite3-0:ppc64el \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && powerpc64le-linux-gnu-gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && readelf -h helloWorld | grep -c 'PowerPC64' \ + && readelf -h helloWorld | grep -c 'ELF64' \ + && readelf -h helloWorld | grep -c "little endian" \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.14/ppc/rootfs/helloWorld.c b/go1.14/ppc/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.14/ppc/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.14/s390x/Dockerfile.tmpl b/go1.14/s390x/Dockerfile.tmpl index 2b844d8d..41370c35 100644 --- a/go1.14/s390x/Dockerfile.tmpl +++ b/go1.14/s390x/Dockerfile.tmpl @@ -1,11 +1,12 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture s390x \ && apt-get -o Acquire::Check-Valid-Until=false update -qq \ - && apt-get install -y -qq \ + && apt-get install -y \ --no-install-recommends \ --allow-unauthenticated \ g++-s390x-linux-gnu \ @@ -20,10 +21,27 @@ RUN \ libicu57:s390x \ icu-devtools:s390x \ libsystemd-dev:s390x \ + librpm3:s390x \ + librpmio3:s390x \ + librpmbuild3:s390x \ + librpmsign3:s390x \ + libsqlite3-dev:s390x \ + libnss3:s390x \ + libsqlite3-0:s390x \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && s390x-linux-gnu-gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && readelf -h helloWorld | grep -c 'IBM S/390' \ + && readelf -h helloWorld | grep -c 'ELF64' \ + && readelf -h helloWorld | grep -c "big endian" \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.14/s390x/rootfs/helloWorld.c b/go1.14/s390x/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.14/s390x/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} From 3b819e8843f9edf20ed6ad024f890acdeb3b4247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 9 Nov 2020 15:51:43 +0100 Subject: [PATCH 03/21] Add support for Golang 1.15.4 --- Jenkinsfile | 2 +- Makefile | 2 +- README.md | 16 +-- go1.15/Makefile | 10 ++ go1.15/Makefile.common | 26 +++++ go1.15/Makefile.debian7 | 14 +++ go1.15/Makefile.debian8 | 14 +++ go1.15/Makefile.debian9 | 14 +++ go1.15/arm/.dockerignore | 1 + go1.15/arm/Dockerfile.tmpl | 62 ++++++++++ go1.15/arm/Makefile | 1 + go1.15/arm/rootfs/compilers.yaml | 17 +++ go1.15/base/.dockerignore | 1 + go1.15/base/Dockerfile.tmpl | 49 ++++++++ go1.15/base/Makefile | 1 + go1.15/base/rootfs/entrypoint.go | 175 ++++++++++++++++++++++++++++ go1.15/base/sources-debian7.list | 2 + go1.15/base/sources-debian8.list | 2 + go1.15/darwin/Dockerfile.tmpl | 40 +++++++ go1.15/darwin/Makefile | 1 + go1.15/darwin/rootfs/compilers.yaml | 6 + go1.15/main/.dockerignore | 1 + go1.15/main/Dockerfile.tmpl | 34 ++++++ go1.15/main/Makefile | 1 + go1.15/main/rootfs/compilers.yaml | 25 ++++ go1.15/mips/.dockerignore | 1 + go1.15/mips/Dockerfile.tmpl | 41 +++++++ go1.15/mips/Makefile | 1 + go1.15/mips/rootfs/compilers.yaml | 15 +++ go1.15/ppc/.dockerignore | 1 + go1.15/ppc/Dockerfile.tmpl | 37 ++++++ go1.15/ppc/Makefile | 1 + go1.15/ppc/rootfs/compilers.yaml | 9 ++ go1.15/s390x/.dockerignore | 1 + go1.15/s390x/Dockerfile.tmpl | 36 ++++++ go1.15/s390x/Makefile | 1 + go1.15/s390x/rootfs/compilers.yaml | 6 + 37 files changed, 657 insertions(+), 10 deletions(-) create mode 100644 go1.15/Makefile create mode 100644 go1.15/Makefile.common create mode 100644 go1.15/Makefile.debian7 create mode 100644 go1.15/Makefile.debian8 create mode 100644 go1.15/Makefile.debian9 create mode 100644 go1.15/arm/.dockerignore create mode 100644 go1.15/arm/Dockerfile.tmpl create mode 100644 go1.15/arm/Makefile create mode 100644 go1.15/arm/rootfs/compilers.yaml create mode 100644 go1.15/base/.dockerignore create mode 100644 go1.15/base/Dockerfile.tmpl create mode 100644 go1.15/base/Makefile create mode 100644 go1.15/base/rootfs/entrypoint.go create mode 100644 go1.15/base/sources-debian7.list create mode 100644 go1.15/base/sources-debian8.list create mode 100644 go1.15/darwin/Dockerfile.tmpl create mode 100644 go1.15/darwin/Makefile create mode 100644 go1.15/darwin/rootfs/compilers.yaml create mode 100644 go1.15/main/.dockerignore create mode 100644 go1.15/main/Dockerfile.tmpl create mode 100644 go1.15/main/Makefile create mode 100644 go1.15/main/rootfs/compilers.yaml create mode 100644 go1.15/mips/.dockerignore create mode 100644 go1.15/mips/Dockerfile.tmpl create mode 100644 go1.15/mips/Makefile create mode 100644 go1.15/mips/rootfs/compilers.yaml create mode 100644 go1.15/ppc/.dockerignore create mode 100644 go1.15/ppc/Dockerfile.tmpl create mode 100644 go1.15/ppc/Makefile create mode 100644 go1.15/ppc/rootfs/compilers.yaml create mode 100644 go1.15/s390x/.dockerignore create mode 100644 go1.15/s390x/Dockerfile.tmpl create mode 100644 go1.15/s390x/Makefile create mode 100644 go1.15/s390x/rootfs/compilers.yaml diff --git a/Jenkinsfile b/Jenkinsfile index 9bdfa096..1190b5ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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') diff --git a/Makefile b/Makefile index a45ea9da..daf9eee4 100644 --- a/Makefile +++ b/Makefile @@ -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: @$(foreach var,$(TARGETS), \ diff --git a/README.md b/README.md index be7eaf11..c0ed0ee3 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/go1.15/Makefile b/go1.15/Makefile new file mode 100644 index 00000000..12f52c8b --- /dev/null +++ b/go1.15/Makefile @@ -0,0 +1,10 @@ +IMAGES := base main darwin arm mips ppc s390x + +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 diff --git a/go1.15/Makefile.common b/go1.15/Makefile.common new file mode 100644 index 00000000..15a7575a --- /dev/null +++ b/go1.15/Makefile.common @@ -0,0 +1,26 @@ +SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(SELF_DIR)/../Makefile.common + +NAME := golang-crossbuild +VERSION := 1.15.4 +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 diff --git a/go1.15/Makefile.debian7 b/go1.15/Makefile.debian7 new file mode 100644 index 00000000..c94da8a0 --- /dev/null +++ b/go1.15/Makefile.debian7 @@ -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 diff --git a/go1.15/Makefile.debian8 b/go1.15/Makefile.debian8 new file mode 100644 index 00000000..a9de1e2e --- /dev/null +++ b/go1.15/Makefile.debian8 @@ -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 diff --git a/go1.15/Makefile.debian9 b/go1.15/Makefile.debian9 new file mode 100644 index 00000000..d7eacbde --- /dev/null +++ b/go1.15/Makefile.debian9 @@ -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 diff --git a/go1.15/arm/.dockerignore b/go1.15/arm/.dockerignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/go1.15/arm/.dockerignore @@ -0,0 +1 @@ +Makefile diff --git a/go1.15/arm/Dockerfile.tmpl b/go1.15/arm/Dockerfile.tmpl new file mode 100644 index 00000000..9a29dd58 --- /dev/null +++ b/go1.15/arm/Dockerfile.tmpl @@ -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" diff --git a/go1.15/arm/Makefile b/go1.15/arm/Makefile new file mode 100644 index 00000000..0a42375f --- /dev/null +++ b/go1.15/arm/Makefile @@ -0,0 +1 @@ +include ../Makefile.common diff --git a/go1.15/arm/rootfs/compilers.yaml b/go1.15/arm/rootfs/compilers.yaml new file mode 100644 index 00000000..6269add7 --- /dev/null +++ b/go1.15/arm/rootfs/compilers.yaml @@ -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++ diff --git a/go1.15/base/.dockerignore b/go1.15/base/.dockerignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/go1.15/base/.dockerignore @@ -0,0 +1 @@ +Makefile diff --git a/go1.15/base/Dockerfile.tmpl b/go1.15/base/Dockerfile.tmpl new file mode 100644 index 00000000..1dcf9de8 --- /dev/null +++ b/go1.15/base/Dockerfile.tmpl @@ -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.4 +ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz +ARG GOLANG_DOWNLOAD_SHA256=eb61005f0b932c93b424a3a4eaa67d72196c79129d9a3ea8578047683e2c80d5 + +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"] diff --git a/go1.15/base/Makefile b/go1.15/base/Makefile new file mode 100644 index 00000000..0a42375f --- /dev/null +++ b/go1.15/base/Makefile @@ -0,0 +1 @@ +include ../Makefile.common diff --git a/go1.15/base/rootfs/entrypoint.go b/go1.15/base/rootfs/entrypoint.go new file mode 100644 index 00000000..0e5c2985 --- /dev/null +++ b/go1.15/base/rootfs/entrypoint.go @@ -0,0 +1,175 @@ +// +build linux + +package main + +import ( + "fmt" + "io" + "io/ioutil" + "log" + "os" + "os/exec" + "sort" + "strings" + + "github.com/spf13/cobra" + "gopkg.in/yaml.v2" +) + +var rootCmd = &cobra.Command{ + Use: "crossbuild", + Short: "crossbuild is simple tool for cross-compiling Go binaries", + Long: `crossbuild is a containerized tool for cross-compiling Go binaries +by mounting the project inside of a container equipped with cross-compilers. + +The root of your project's repo should be mounted at the appropriate location +on the GOPATH which is set to /go. + +While executing the build command the following variables with be added to the +environment: GOOS, GOARCH, GOARM, PLATFORM_ID, CC, and CXX. +`, + RunE: doBuild, + SilenceUsage: true, +} + +func init() { + rootCmd.PersistentFlags().StringVarP(&buildCommand, "build-cmd", "c", + "make build", "Build command to execute.") + + rootCmd.PersistentFlags().StringSliceVarP(&platforms, "platforms", "p", nil, + "Target platform for the binary in GOOS/GOARCH format (e.g. windows/amd64).") + rootCmd.MarkPersistentFlagRequired("platforms") +} + +func main() { + log.SetFlags(0) + + if err := rootCmd.Execute(); err != nil { + log.Fatal(err) + } +} + +var ( + buildCommand string + platforms []string +) + +func doBuild(_ *cobra.Command, _ []string) error { + for _, p := range platforms { + env, err := buildEnvironment(p) + if err != nil { + return fmt.Errorf("failed constructing the build environment for %v: %v", p, err) + } + + if err = execBuildCommand(env); err != nil { + return fmt.Errorf("failed building for %v: %v", p, err) + } + } + + return nil +} + +func isDirEmpty(name string) (bool, error) { + f, err := os.Open(name) + if err != nil { + return false, err + } + defer f.Close() + + _, err = f.Readdirnames(1) + if err == io.EOF { + return true, nil + } + return false, err +} + +func buildEnvironment(platform string) (map[string]string, error) { + parts := strings.SplitN(platform, "/", 2) + if len(parts) != 2 { + return nil, fmt.Errorf("invalid platform %v", platform) + } + + platformID := strings.Join(parts, "-") + goos := parts[0] + arch := parts[1] + goarch := arch + goarm := "" + + if strings.HasPrefix(arch, "armv") { + goarch = "arm" + goarm = strings.TrimPrefix(arch, "armv") + } + + env := map[string]string{ + "GOOS": goos, + "GOARCH": goarch, + "GOARM": goarm, + "PLATFORM_ID": platformID, + } + + if err := loadCompilerSettings(goos, arch, env); err != nil { + return nil, fmt.Errorf("failed while loading compiler settings: %v", err) + } + + return env, nil +} + +type Compilers struct { + GOOS map[string]struct { + Arch map[string]struct { + Env map[string]string `yaml:",inline"` + } `yaml:",inline"` + } `yaml:",inline"` +} + +func loadCompilerSettings(goos, arch string, env map[string]string) error { + data, err := ioutil.ReadFile("/compilers.yaml") + if err != nil { + if os.IsNotExist(err) { + return nil + } + return fmt.Errorf("failed to read /compilers.yaml: %v", err) + } + + var compilers Compilers + if err = yaml.Unmarshal(data, &compilers); err != nil { + return fmt.Errorf("failed to parse /compilers.yaml: %v", err) + } + + arches, found := compilers.GOOS[goos] + if !found { + return fmt.Errorf("%v is not supported by this image", goos) + } + + settings, found := arches.Arch[arch] + if !found { + return fmt.Errorf("%v/%v is not supported by this image", goos, arch) + } + + for k, v := range settings.Env { + env[k] = v + } + + return nil +} + +func execBuildCommand(env map[string]string) error { + cmd := exec.Command("sh", "-c", buildCommand) + cmd.Env = os.Environ() + logEnv := make([]string, 0, len(env)) + for k, v := range env { + kv := k + "=" + v + cmd.Env = append(cmd.Env, kv) + logEnv = append(logEnv, kv) + } + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.Stdin = os.Stdin + + var b strings.Builder + sort.Strings(logEnv) + fmt.Fprintf(&b, ">> Building using: cmd='%v', env=[%v]", buildCommand, strings.Join(logEnv, ", ")) + + log.Println(b.String()) + return cmd.Run() +} diff --git a/go1.15/base/sources-debian7.list b/go1.15/base/sources-debian7.list new file mode 100644 index 00000000..18c86e1e --- /dev/null +++ b/go1.15/base/sources-debian7.list @@ -0,0 +1,2 @@ +deb http://archive.debian.org/debian wheezy main +deb http://archive.debian.org/debian-security wheezy/updates main diff --git a/go1.15/base/sources-debian8.list b/go1.15/base/sources-debian8.list new file mode 100644 index 00000000..d20d69a1 --- /dev/null +++ b/go1.15/base/sources-debian8.list @@ -0,0 +1,2 @@ +deb http://archive.debian.org/debian jessie main +deb http://security.debian.org/debian-security jessie/updates main diff --git a/go1.15/darwin/Dockerfile.tmpl b/go1.15/darwin/Dockerfile.tmpl new file mode 100644 index 00000000..c5a0048a --- /dev/null +++ b/go1.15/darwin/Dockerfile.tmpl @@ -0,0 +1,40 @@ +ARG REPOSITORY +ARG VERSION +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base + +RUN \ + apt-get update && apt-get install -y --no-install-recommends --allow-unauthenticated \ + clang \ + llvm \ + && rm -rf /var/lib/apt/lists/* + +ARG OSXCROSS_SDK_URL=https://s3.amazonaws.com/beats-files/deps/MacOSX10.11.sdk.tar.xz +ARG OSXCROSS_PATH=/usr/osxcross +ARG OSXCROSS_REV=3034f7149716d815bc473d0a7b35d17e4cf175aa +ARG SDK_VERSION=10.11 +ARG DARWIN_VERSION=15 +ARG OSX_VERSION_MIN=10.10 + +RUN \ + mkdir -p /tmp/osxcross && cd /tmp/osxcross \ + && curl -sSL "https://codeload.github.com/tpoechtrager/osxcross/tar.gz/${OSXCROSS_REV}" \ + | tar -C /tmp/osxcross --strip=1 -xzf - \ + && curl -sSLo "tarballs/MacOSX${SDK_VERSION}.sdk.tar.xz" "${OSXCROSS_SDK_URL}" \ + && UNATTENDED=yes ./build.sh >/dev/null \ + && mv target "${OSXCROSS_PATH}" \ + && rm -rf /tmp/osxcross "/usr/osxcross/SDK/MacOSX${SDK_VERSION}.sdk/usr/share/man" + +ENV PATH $OSXCROSS_PATH/bin:$PATH + +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" diff --git a/go1.15/darwin/Makefile b/go1.15/darwin/Makefile new file mode 100644 index 00000000..0a42375f --- /dev/null +++ b/go1.15/darwin/Makefile @@ -0,0 +1 @@ +include ../Makefile.common diff --git a/go1.15/darwin/rootfs/compilers.yaml b/go1.15/darwin/rootfs/compilers.yaml new file mode 100644 index 00000000..23645ab9 --- /dev/null +++ b/go1.15/darwin/rootfs/compilers.yaml @@ -0,0 +1,6 @@ +--- + +darwin: + amd64: + CC: o64-clang + CXX: o64-clang++ diff --git a/go1.15/main/.dockerignore b/go1.15/main/.dockerignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/go1.15/main/.dockerignore @@ -0,0 +1 @@ +Makefile diff --git a/go1.15/main/Dockerfile.tmpl b/go1.15/main/Dockerfile.tmpl new file mode 100644 index 00000000..24525ecf --- /dev/null +++ b/go1.15/main/Dockerfile.tmpl @@ -0,0 +1,34 @@ +ARG REPOSITORY +ARG VERSION +ARG TAG_EXTENSION= +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} + +RUN \ + dpkg --add-architecture i386 \ + && apt-get -o Acquire::Check-Valid-Until=false update \ + && apt-get install -y --no-install-recommends --allow-unauthenticated \ + clang \ + g++ \ + gcc \ + gcc-multilib \ + libc6-dev \ + libc6-dev-i386 \ + linux-libc-dev:i386 \ + mingw-w64 \ + mingw-w64-tools \ + patch \ + xz-utils \ + && 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" diff --git a/go1.15/main/Makefile b/go1.15/main/Makefile new file mode 100644 index 00000000..0a42375f --- /dev/null +++ b/go1.15/main/Makefile @@ -0,0 +1 @@ +include ../Makefile.common diff --git a/go1.15/main/rootfs/compilers.yaml b/go1.15/main/rootfs/compilers.yaml new file mode 100644 index 00000000..02af3c42 --- /dev/null +++ b/go1.15/main/rootfs/compilers.yaml @@ -0,0 +1,25 @@ +--- + +windows: + 386: + CC: i686-w64-mingw32-gcc + CXX: i686-w64-mingw32-g++ + amd64: + CC: x86_64-w64-mingw32-gcc + CXX: x86_64-w64-mingw32-g++ + +darwin: + 386: + CC: o32-clang + CXX: o32-clang++ + amd64: + CC: o64-clang + CXX: o64-clang++ + +linux: + 386: + CC: gcc + CXX: g++ + amd64: + CC: gcc + CXX: g++ diff --git a/go1.15/mips/.dockerignore b/go1.15/mips/.dockerignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/go1.15/mips/.dockerignore @@ -0,0 +1 @@ +Makefile diff --git a/go1.15/mips/Dockerfile.tmpl b/go1.15/mips/Dockerfile.tmpl new file mode 100644 index 00000000..25fe93d6 --- /dev/null +++ b/go1.15/mips/Dockerfile.tmpl @@ -0,0 +1,41 @@ +ARG REPOSITORY +ARG VERSION +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base + +RUN \ + dpkg --add-architecture mips64el \ + && apt-get update -qq \ + && apt-get install -qq -y \ + --no-install-recommends \ + --allow-unauthenticated \ + crossbuild-essential-mipsel \ + gcc-mips-linux-gnu \ + g++-mips-linux-gnu \ + gcc-6-mips64-linux-gnuabi64 \ + g++-6-mips64-linux-gnuabi64 \ + gcc-6-mips64el-linux-gnuabi64 \ + g++-6-mips64el-linux-gnuabi64 \ + librpm-dev:mips64el \ + libc-dev:mips64el \ + libpopt-dev:mips64el \ + linux-libc-dev:mips64el \ + libxml2-dev:mips64el \ + libxml2:mips64el \ + libicu-dev:mips64el \ + libicu57:mips64el \ + icu-devtools:mips64el \ + libsystemd-dev:mips64el \ + && 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" diff --git a/go1.15/mips/Makefile b/go1.15/mips/Makefile new file mode 100644 index 00000000..0a42375f --- /dev/null +++ b/go1.15/mips/Makefile @@ -0,0 +1 @@ +include ../Makefile.common diff --git a/go1.15/mips/rootfs/compilers.yaml b/go1.15/mips/rootfs/compilers.yaml new file mode 100644 index 00000000..7dff3130 --- /dev/null +++ b/go1.15/mips/rootfs/compilers.yaml @@ -0,0 +1,15 @@ +--- + +linux: + mips: + CC: mips-linux-gnu-gcc + CXX: mips-linux-gnu-g++ + mipsle: + CC: mipsel-linux-gnu-gcc + CXX: mipsel-linux-gnu-g++ + mips64: + CC: mips64-linux-gnuabi64-gcc-6 + CXX: mips64-linux-gnuabi64-g++-6 + mips64le: + CC: mips64el-linux-gnuabi64-gcc-6 + CXX: mips64el-linux-gnuabi64-g++-6 diff --git a/go1.15/ppc/.dockerignore b/go1.15/ppc/.dockerignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/go1.15/ppc/.dockerignore @@ -0,0 +1 @@ +Makefile diff --git a/go1.15/ppc/Dockerfile.tmpl b/go1.15/ppc/Dockerfile.tmpl new file mode 100644 index 00000000..acdc1870 --- /dev/null +++ b/go1.15/ppc/Dockerfile.tmpl @@ -0,0 +1,37 @@ +ARG REPOSITORY +ARG VERSION +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base + +RUN \ + dpkg --add-architecture ppc64el \ + && apt-get update -qq \ + && apt-get install -y -qq \ + --no-install-recommends \ + --allow-unauthenticated \ + g++-6-powerpc64-linux-gnu \ + gcc-6-powerpc64-linux-gnu \ + crossbuild-essential-ppc64el \ + librpm-dev:ppc64el \ + libc-dev:ppc64el \ + libpopt-dev:ppc64el \ + linux-libc-dev:ppc64el \ + libxml2-dev:ppc64el \ + libxml2:ppc64el \ + libicu-dev:ppc64el \ + libicu57:ppc64el \ + icu-devtools:ppc64el \ + libsystemd-dev:ppc64el \ + && 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" diff --git a/go1.15/ppc/Makefile b/go1.15/ppc/Makefile new file mode 100644 index 00000000..0a42375f --- /dev/null +++ b/go1.15/ppc/Makefile @@ -0,0 +1 @@ +include ../Makefile.common diff --git a/go1.15/ppc/rootfs/compilers.yaml b/go1.15/ppc/rootfs/compilers.yaml new file mode 100644 index 00000000..15ab651f --- /dev/null +++ b/go1.15/ppc/rootfs/compilers.yaml @@ -0,0 +1,9 @@ +--- + +linux: + ppc64: + CC: powerpc64-linux-gnu-gcc-6 + CXX: powerpc64-linux-gnu-g++-6 + ppc64le: + CC: powerpc64le-linux-gnu-gcc + CXX: powerpc64le-linux-gnu-g++ diff --git a/go1.15/s390x/.dockerignore b/go1.15/s390x/.dockerignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/go1.15/s390x/.dockerignore @@ -0,0 +1 @@ +Makefile diff --git a/go1.15/s390x/Dockerfile.tmpl b/go1.15/s390x/Dockerfile.tmpl new file mode 100644 index 00000000..0efefa28 --- /dev/null +++ b/go1.15/s390x/Dockerfile.tmpl @@ -0,0 +1,36 @@ +ARG REPOSITORY +ARG VERSION +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base + +RUN \ + dpkg --add-architecture s390x \ + && apt-get update -qq \ + && apt-get install -y -qq \ + --no-install-recommends \ + --allow-unauthenticated \ + g++-s390x-linux-gnu \ + gcc-s390x-linux-gnu \ + librpm-dev:s390x \ + libc-dev:s390x \ + libpopt-dev:s390x \ + linux-libc-dev:s390x \ + libxml2-dev:s390x \ + libxml2:s390x \ + libicu-dev:s390x \ + libicu57:s390x \ + icu-devtools:s390x \ + libsystemd-dev:s390x \ + && 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" diff --git a/go1.15/s390x/Makefile b/go1.15/s390x/Makefile new file mode 100644 index 00000000..0a42375f --- /dev/null +++ b/go1.15/s390x/Makefile @@ -0,0 +1 @@ +include ../Makefile.common diff --git a/go1.15/s390x/rootfs/compilers.yaml b/go1.15/s390x/rootfs/compilers.yaml new file mode 100644 index 00000000..22ae10ab --- /dev/null +++ b/go1.15/s390x/rootfs/compilers.yaml @@ -0,0 +1,6 @@ +--- + +linux: + s390x: + CC: s390x-linux-gnu-gcc + CXX: s390x-linux-gnu-g++ From 4ddc5cabdd0c58e756d88be6a3635402d8036128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Tue, 10 Nov 2020 10:26:08 +0100 Subject: [PATCH 04/21] tmp --- go1.15/mips/Dockerfile.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/go1.15/mips/Dockerfile.tmpl b/go1.15/mips/Dockerfile.tmpl index 25fe93d6..a612f615 100644 --- a/go1.15/mips/Dockerfile.tmpl +++ b/go1.15/mips/Dockerfile.tmpl @@ -2,6 +2,7 @@ ARG REPOSITORY ARG VERSION FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +RUN apt-get update RUN \ dpkg --add-architecture mips64el \ && apt-get update -qq \ From 065a22823e9c4c7214467a35c4d45a6ad62c78ec Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 18:16:46 +0100 Subject: [PATCH 05/21] feat: add test comment --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 989273d4..61dde2ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ pipeline { quietPeriod(10) } triggers { - issueCommentTrigger('(?i).*jenkins\\W+run\\W+(?:the\\W+)?tests(?:\\W+please)?.*') + issueCommentTrigger('(?i)(.*jenkins\\W+run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|/test)') } stages { stage('Checkout') { From 55db4c5b3670ecb59c1be854d88227b821516b64 Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 18:17:45 +0100 Subject: [PATCH 06/21] fix: set default Debian9 --- go1.14/Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go1.14/Makefile.common b/go1.14/Makefile.common index bee526f7..7525d209 100644 --- a/go1.14/Makefile.common +++ b/go1.14/Makefile.common @@ -3,7 +3,7 @@ include $(SELF_DIR)/../Makefile.common NAME := golang-crossbuild VERSION := 1.14.7 -DEBIAN_VERSION ?= 7 +DEBIAN_VERSION ?= 9 SUFFIX := -$(shell basename $(CURDIR)) TAG_EXTENSION ?= From 7478311328d1c282dc393fb9068814f27c2afdac Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 18:18:11 +0100 Subject: [PATCH 07/21] fix: restore other ARM compilers --- go1.14/arm/Dockerfile.tmpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/go1.14/arm/Dockerfile.tmpl b/go1.14/arm/Dockerfile.tmpl index febe3723..b4cedcf7 100644 --- a/go1.14/arm/Dockerfile.tmpl +++ b/go1.14/arm/Dockerfile.tmpl @@ -10,7 +10,11 @@ RUN \ --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 \ From f0d57d588bba3f823931e0c85a4c4cc99eab7fdb Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 18:18:41 +0100 Subject: [PATCH 08/21] fix: get sources list depending on the Debian version --- go1.14/base/Dockerfile.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go1.14/base/Dockerfile.tmpl b/go1.14/base/Dockerfile.tmpl index 2d25b754..bf51e0ca 100644 --- a/go1.14/base/Dockerfile.tmpl +++ b/go1.14/base/Dockerfile.tmpl @@ -1,9 +1,9 @@ ARG DEBIAN_VERSION FROM debian:${DEBIAN_VERSION} -ARG TAG_EXTENSION +ARG DEBIAN_VERSION # Replace sources.list in order to use archive.debian.org. -COPY sources${TAG_EXTENSION}.list /etc/apt/sources.list +COPY sources-debian${DEBIAN_VERSION}.list /etc/apt/sources.list RUN \ apt-get -o Acquire::Check-Valid-Until=false update \ From 27c82a64a6e50fcc3a8e31608d7d2f40301b0e52 Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 18:19:13 +0100 Subject: [PATCH 09/21] chore: minor changes --- go1.14/main/Dockerfile.tmpl | 4 ++-- go1.14/mips/Dockerfile.tmpl | 1 + go1.14/s390x/Dockerfile.tmpl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/go1.14/main/Dockerfile.tmpl b/go1.14/main/Dockerfile.tmpl index 86711f84..c3032650 100644 --- a/go1.14/main/Dockerfile.tmpl +++ b/go1.14/main/Dockerfile.tmpl @@ -1,12 +1,12 @@ ARG REPOSITORY ARG VERSION -ARG TAG_EXTENSION='' +ARG TAG_EXTENSION FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture i386 \ && apt-get -o Acquire::Check-Valid-Until=false update \ - && apt-get install -y --no-install-recommends --allow-unauthenticated \ + && apt-get install -qq -y --no-install-recommends --allow-unauthenticated \ clang \ g++ \ gcc \ diff --git a/go1.14/mips/Dockerfile.tmpl b/go1.14/mips/Dockerfile.tmpl index f03eb5fd..036ee196 100644 --- a/go1.14/mips/Dockerfile.tmpl +++ b/go1.14/mips/Dockerfile.tmpl @@ -3,6 +3,7 @@ ARG VERSION ARG TAG_EXTENSION='' FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} +RUN apt-get update RUN \ dpkg --add-architecture mips64el \ && apt-get -o Acquire::Check-Valid-Until=false update -qq \ diff --git a/go1.14/s390x/Dockerfile.tmpl b/go1.14/s390x/Dockerfile.tmpl index 41370c35..0a89b18c 100644 --- a/go1.14/s390x/Dockerfile.tmpl +++ b/go1.14/s390x/Dockerfile.tmpl @@ -6,7 +6,7 @@ FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture s390x \ && apt-get -o Acquire::Check-Valid-Until=false update -qq \ - && apt-get install -y \ + && apt-get install -y -qq \ --no-install-recommends \ --allow-unauthenticated \ g++-s390x-linux-gnu \ From 397dddfdb59777e04e60b2f05c9327051ce0d1ad Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 18:20:28 +0100 Subject: [PATCH 10/21] fix: support for go 1.15 --- go1.15/Makefile.debian10 | 14 +++++++++++ go1.15/Makefile.debian8 | 3 ++- go1.15/Makefile.debian9 | 2 +- go1.15/arm/Dockerfile.tmpl | 40 +++++++++++++------------------ go1.15/arm/rootfs/helloWorld.c | 5 ++++ go1.15/base/Dockerfile.tmpl | 7 +++--- go1.15/base/sources-debian10.list | 2 ++ go1.15/base/sources-debian8.list | 2 +- go1.15/base/sources-debian9.list | 2 ++ go1.15/darwin/Dockerfile.tmpl | 18 ++++++++++++-- go1.15/darwin/rootfs/helloWorld.c | 5 ++++ go1.15/main/Dockerfile.tmpl | 12 ++++++++-- go1.15/main/rootfs/helloWorld.c | 5 ++++ go1.15/mips/Dockerfile.tmpl | 22 +++++++++++++++-- go1.15/mips/rootfs/helloWorld.c | 5 ++++ go1.15/ppc/Dockerfile.tmpl | 24 ++++++++++++++++--- go1.15/ppc/rootfs/helloWorld.c | 5 ++++ go1.15/s390x/Dockerfile.tmpl | 22 +++++++++++++++-- go1.15/s390x/rootfs/helloWorld.c | 5 ++++ 19 files changed, 159 insertions(+), 41 deletions(-) create mode 100644 go1.15/Makefile.debian10 create mode 100644 go1.15/arm/rootfs/helloWorld.c create mode 100644 go1.15/base/sources-debian10.list create mode 100644 go1.15/base/sources-debian9.list create mode 100644 go1.15/darwin/rootfs/helloWorld.c create mode 100644 go1.15/main/rootfs/helloWorld.c create mode 100644 go1.15/mips/rootfs/helloWorld.c create mode 100644 go1.15/ppc/rootfs/helloWorld.c create mode 100644 go1.15/s390x/rootfs/helloWorld.c diff --git a/go1.15/Makefile.debian10 b/go1.15/Makefile.debian10 new file mode 100644 index 00000000..04126feb --- /dev/null +++ b/go1.15/Makefile.debian10 @@ -0,0 +1,14 @@ +IMAGES := base main darwin +DEBIAN_VERSION := 10 +TAG_EXTENSION := -debian10 + +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 diff --git a/go1.15/Makefile.debian8 b/go1.15/Makefile.debian8 index a9de1e2e..11834e52 100644 --- a/go1.15/Makefile.debian8 +++ b/go1.15/Makefile.debian8 @@ -1,10 +1,11 @@ -IMAGES := base main +IMAGES := base main darwin DEBIAN_VERSION := 8 TAG_EXTENSION := -debian8 export DEBIAN_VERSION TAG_EXTENSION build: + export |grep TAG_EXTENSION @$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;) # Requires login at https://docker.elastic.co:7000/. diff --git a/go1.15/Makefile.debian9 b/go1.15/Makefile.debian9 index d7eacbde..26265d60 100644 --- a/go1.15/Makefile.debian9 +++ b/go1.15/Makefile.debian9 @@ -1,4 +1,4 @@ -IMAGES := base main +IMAGES := base main arm darwin mips ppc s390x DEBIAN_VERSION := 9 TAG_EXTENSION := -debian9 diff --git a/go1.15/arm/Dockerfile.tmpl b/go1.15/arm/Dockerfile.tmpl index 9a29dd58..b4cedcf7 100644 --- a/go1.15/arm/Dockerfile.tmpl +++ b/go1.15/arm/Dockerfile.tmpl @@ -1,11 +1,10 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} 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 \ @@ -26,30 +25,25 @@ RUN \ 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 \ + librpm3:arm64 \ + librpmio3:arm64 \ + librpmbuild3:arm64 \ + librpmsign3:arm64 \ + libsqlite3-dev:arm64 \ + libnss3:arm64 \ + libsqlite3-0:arm64 \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && aarch64-linux-gnu-gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && file helloWorld | cut -d "," -f 2 | grep -c 'ARM aarch64'\ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.15/arm/rootfs/helloWorld.c b/go1.15/arm/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.15/arm/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.15/base/Dockerfile.tmpl b/go1.15/base/Dockerfile.tmpl index 1dcf9de8..f557876a 100644 --- a/go1.15/base/Dockerfile.tmpl +++ b/go1.15/base/Dockerfile.tmpl @@ -1,15 +1,14 @@ ARG DEBIAN_VERSION FROM debian:${DEBIAN_VERSION} -{{if or (eq .DEBIAN_VERSION "7") (eq .DEBIAN_VERSION "8") -}} +ARG DEBIAN_VERSION # Replace sources.list in order to use archive.debian.org. -COPY sources-debian{{.DEBIAN_VERSION}}.list /etc/apt/sources.list -{{- end}} +COPY sources-debian${DEBIAN_VERSION}.list /etc/apt/sources.list RUN \ apt-get -o Acquire::Check-Valid-Until=false update \ && apt-get dist-upgrade -y \ - && apt-get install -y --no-install-recommends --allow-unauthenticated \ + && apt-get install -qq -y --no-install-recommends --allow-unauthenticated \ build-essential \ ca-certificates \ curl \ diff --git a/go1.15/base/sources-debian10.list b/go1.15/base/sources-debian10.list new file mode 100644 index 00000000..bff91789 --- /dev/null +++ b/go1.15/base/sources-debian10.list @@ -0,0 +1,2 @@ +deb http://deb.debian.org/debian buster main +deb [arch=amd64,i386] http://security.debian.org/debian-security buster/updates main diff --git a/go1.15/base/sources-debian8.list b/go1.15/base/sources-debian8.list index d20d69a1..03a1b7fb 100644 --- a/go1.15/base/sources-debian8.list +++ b/go1.15/base/sources-debian8.list @@ -1,2 +1,2 @@ deb http://archive.debian.org/debian jessie main -deb http://security.debian.org/debian-security jessie/updates main +deb [arch=amd64,i386] http://security.debian.org/debian-security jessie/updates main diff --git a/go1.15/base/sources-debian9.list b/go1.15/base/sources-debian9.list new file mode 100644 index 00000000..449c0aa7 --- /dev/null +++ b/go1.15/base/sources-debian9.list @@ -0,0 +1,2 @@ +deb http://deb.debian.org/debian stretch main +deb [arch=amd64,i386] http://security.debian.org/debian-security stretch/updates main diff --git a/go1.15/darwin/Dockerfile.tmpl b/go1.15/darwin/Dockerfile.tmpl index c5a0048a..f1bf226a 100644 --- a/go1.15/darwin/Dockerfile.tmpl +++ b/go1.15/darwin/Dockerfile.tmpl @@ -1,9 +1,11 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ - apt-get update && apt-get install -y --no-install-recommends --allow-unauthenticated \ + apt-get -o Acquire::Check-Valid-Until=false update \ + && apt-get install -qq -y --no-install-recommends --allow-unauthenticated \ clang \ llvm \ && rm -rf /var/lib/apt/lists/* @@ -28,6 +30,18 @@ ENV PATH $OSXCROSS_PATH/bin:$PATH COPY rootfs / +# Basic test +RUN cd / \ + && o64-clang helloWorld.c -o helloWorld \ + && file helloWorld \ + && file helloWorld | grep -c 'Mach-O 64-bit x86_64' + +RUN cd / \ + && o32-clang helloWorld.c -o helloWorld \ + && file helloWorld \ + && file helloWorld | grep -c 'Mach-O i386' \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.15/darwin/rootfs/helloWorld.c b/go1.15/darwin/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.15/darwin/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.15/main/Dockerfile.tmpl b/go1.15/main/Dockerfile.tmpl index 24525ecf..c3032650 100644 --- a/go1.15/main/Dockerfile.tmpl +++ b/go1.15/main/Dockerfile.tmpl @@ -1,12 +1,12 @@ ARG REPOSITORY ARG VERSION -ARG TAG_EXTENSION= +ARG TAG_EXTENSION FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture i386 \ && apt-get -o Acquire::Check-Valid-Until=false update \ - && apt-get install -y --no-install-recommends --allow-unauthenticated \ + && apt-get install -qq -y --no-install-recommends --allow-unauthenticated \ clang \ g++ \ gcc \ @@ -22,6 +22,14 @@ RUN \ COPY rootfs / +# Basic test +RUN cd / \ + && gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && file helloWorld | cut -d "," -f 2 | grep -c 'x86-64' \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.15/main/rootfs/helloWorld.c b/go1.15/main/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.15/main/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.15/mips/Dockerfile.tmpl b/go1.15/mips/Dockerfile.tmpl index a612f615..036ee196 100644 --- a/go1.15/mips/Dockerfile.tmpl +++ b/go1.15/mips/Dockerfile.tmpl @@ -1,11 +1,12 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN apt-get update RUN \ dpkg --add-architecture mips64el \ - && apt-get update -qq \ + && apt-get -o Acquire::Check-Valid-Until=false update -qq \ && apt-get install -qq -y \ --no-install-recommends \ --allow-unauthenticated \ @@ -26,10 +27,27 @@ RUN \ libicu57:mips64el \ icu-devtools:mips64el \ libsystemd-dev:mips64el \ + librpm3:mips64el \ + librpmio3:mips64el \ + librpmbuild3:mips64el \ + librpmsign3:mips64el \ + libsqlite3-dev:mips64el \ + libnss3:mips64el \ + libsqlite3-0:mips64el \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && mips64el-linux-gnuabi64-gcc-6 helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && readelf -h helloWorld | grep -c 'MIPS R3000' \ + && readelf -h helloWorld | grep -c 'ELF64' \ + && readelf -h helloWorld | grep -c "little endian" \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.15/mips/rootfs/helloWorld.c b/go1.15/mips/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.15/mips/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.15/ppc/Dockerfile.tmpl b/go1.15/ppc/Dockerfile.tmpl index acdc1870..5fe2f40c 100644 --- a/go1.15/ppc/Dockerfile.tmpl +++ b/go1.15/ppc/Dockerfile.tmpl @@ -1,11 +1,12 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture ppc64el \ - && apt-get update -qq \ - && apt-get install -y -qq \ + && apt-get -o Acquire::Check-Valid-Until=false update -qq \ + && apt-get install -qq -y \ --no-install-recommends \ --allow-unauthenticated \ g++-6-powerpc64-linux-gnu \ @@ -21,10 +22,27 @@ RUN \ libicu57:ppc64el \ icu-devtools:ppc64el \ libsystemd-dev:ppc64el \ + librpm3:ppc64el \ + librpmio3:ppc64el \ + librpmbuild3:ppc64el \ + librpmsign3:ppc64el \ + libsqlite3-dev:ppc64el \ + libnss3:ppc64el \ + libsqlite3-0:ppc64el \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && powerpc64le-linux-gnu-gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && readelf -h helloWorld | grep -c 'PowerPC64' \ + && readelf -h helloWorld | grep -c 'ELF64' \ + && readelf -h helloWorld | grep -c "little endian" \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.15/ppc/rootfs/helloWorld.c b/go1.15/ppc/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.15/ppc/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} diff --git a/go1.15/s390x/Dockerfile.tmpl b/go1.15/s390x/Dockerfile.tmpl index 0efefa28..0a89b18c 100644 --- a/go1.15/s390x/Dockerfile.tmpl +++ b/go1.15/s390x/Dockerfile.tmpl @@ -1,10 +1,11 @@ ARG REPOSITORY ARG VERSION -FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base +ARG TAG_EXTENSION='' +FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ dpkg --add-architecture s390x \ - && apt-get update -qq \ + && apt-get -o Acquire::Check-Valid-Until=false update -qq \ && apt-get install -y -qq \ --no-install-recommends \ --allow-unauthenticated \ @@ -20,10 +21,27 @@ RUN \ libicu57:s390x \ icu-devtools:s390x \ libsystemd-dev:s390x \ + librpm3:s390x \ + librpmio3:s390x \ + librpmbuild3:s390x \ + librpmsign3:s390x \ + libsqlite3-dev:s390x \ + libnss3:s390x \ + libsqlite3-0:s390x \ && rm -rf /var/lib/apt/lists/* COPY rootfs / +# Basic test +RUN cd / \ + && s390x-linux-gnu-gcc helloWorld.c -o helloWorld \ + && file helloWorld \ + && readelf -h helloWorld \ + && readelf -h helloWorld | grep -c 'IBM S/390' \ + && readelf -h helloWorld | grep -c 'ELF64' \ + && readelf -h helloWorld | grep -c "big endian" \ + && rm helloWorld.c helloWorld + # Build-time metadata as defined at http://label-schema.org. ARG BUILD_DATE ARG IMAGE diff --git a/go1.15/s390x/rootfs/helloWorld.c b/go1.15/s390x/rootfs/helloWorld.c new file mode 100644 index 00000000..dcfb86bc --- /dev/null +++ b/go1.15/s390x/rootfs/helloWorld.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello, World!"); + return 0; +} From fe50a3cd3f4dee043f51434d8d251ecebedb258e Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Thu, 3 Dec 2020 18:30:05 +0100 Subject: [PATCH 11/21] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 90011083..bcb89690 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ build: $(MAKE) -C $(var) -f Makefile.debian7 $@; || echo '1' > ${status}; \ $(MAKE) -C $(var) -f Makefile.debian8 $@; || echo '1' > ${status}; \ $(MAKE) -C $(var) -f Makefile.debian9 $@; || echo '1' > ${status}; \ - $(MAKE) -C $(var) -f Makefile.debian10 $@; || echo '1' > ${status};) \ + $(MAKE) -C $(var) -f Makefile.debian10 $@; || echo '1' > ${status};) @make -C fpm $@ || echo '1' > ${status} exit $$(cat ${status}) From 9dcdb379b49dfeba33e242dad7eb544da3879f59 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Thu, 3 Dec 2020 18:30:52 +0100 Subject: [PATCH 12/21] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bcb89690..c659400e 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ push: $(MAKE) -C $(var) -f Makefile.debian7 $@ || echo '1' > ${status}; \ $(MAKE) -C $(var) -f Makefile.debian8 $@ || echo '1' > ${status}; \ $(MAKE) -C $(var) -f Makefile.debian9 $@ || echo '1' > ${status}; \ - $(MAKE) -C $(var) -f Makefile.debian10 $@ || echo '1' > ${status};) + $(MAKE) -C $(var) -f Makefile.debian10 $@ || echo '1' > ${status};) @make -C fpm $@ || echo '1' > ${status} exit $$(cat ${status}) From db609687021e6b008e4342bf9f72694ce9c80eba Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 18:40:50 +0100 Subject: [PATCH 13/21] fix: typo --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 61dde2ac..523c2df2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,7 +99,7 @@ pipeline { def buildImages(){ withGoEnv(){ dir("${env.BASE_DIR}"){ - sh 'make -c ${GO_FOLDER} -f ${MAKEFILE} build' + sh 'make -C ${GO_FOLDER} -f ${MAKEFILE} build' } } } From 3b0ec80a811232b3f7636ae09ced5794021e6295 Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 19:03:20 +0100 Subject: [PATCH 14/21] fix: push correct images --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 523c2df2..49639f7f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,13 +45,13 @@ pipeline { } axis { name 'GO_FOLDER' - values 'go1.10', 'go1.11', 'go1.12', 'go1.13', 'go1.14' + values 'go1.14', 'go1.15' } } stages { stage('Build') { steps { - withGithubNotify(context: 'Build') { + withGithubNotify(context: "Build ${GO_FOLDER} ${MAKEFILE}") { deleteDir() unstash 'source' buildImages() @@ -63,7 +63,7 @@ pipeline { REPOSITORY = "${env.STAGING_IMAGE}" } steps { - withGithubNotify(context: 'Staging') { + withGithubNotify(context: 'Staging ${GO_FOLDER} ${MAKEFILE}') { // It will use the already cached docker images that were created in the // Build stage. But it's required to retag them with the staging repo. buildImages() @@ -78,7 +78,7 @@ pipeline { stages { stage('Publish') { steps { - withGithubNotify(context: 'Publish') { + withGithubNotify(context: 'Publish ${GO_FOLDER} ${MAKEFILE}') { publishImages() } } @@ -107,6 +107,6 @@ def buildImages(){ def publishImages(){ dockerLogin(secret: "${env.DOCKER_REGISTRY_SECRET}", registry: "${env.REGISTRY}") dir("${env.BASE_DIR}"){ - sh(label: "push docker image to ${env.REPOSITORY}", script: 'make push') + sh(label: "push docker image to ${env.REPOSITORY}", script: 'make -C ${GO_FOLDER} -f ${MAKEFILE} push') } } From a6fa21905759a567b5ad0c09bdd03b3698a0a943 Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 20:29:57 +0100 Subject: [PATCH 15/21] fix: use single quotes --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 49639f7f..05dc1d10 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -63,7 +63,7 @@ pipeline { REPOSITORY = "${env.STAGING_IMAGE}" } steps { - withGithubNotify(context: 'Staging ${GO_FOLDER} ${MAKEFILE}') { + withGithubNotify(context: "Staging ${GO_FOLDER} ${MAKEFILE}") { // It will use the already cached docker images that were created in the // Build stage. But it's required to retag them with the staging repo. buildImages() @@ -78,7 +78,7 @@ pipeline { stages { stage('Publish') { steps { - withGithubNotify(context: 'Publish ${GO_FOLDER} ${MAKEFILE}') { + withGithubNotify(context: "Publish ${GO_FOLDER} ${MAKEFILE}") { publishImages() } } @@ -99,7 +99,7 @@ pipeline { def buildImages(){ withGoEnv(){ dir("${env.BASE_DIR}"){ - sh 'make -C ${GO_FOLDER} -f ${MAKEFILE} build' + sh "make -C ${GO_FOLDER} -f ${MAKEFILE} build" } } } @@ -107,6 +107,6 @@ def buildImages(){ def publishImages(){ dockerLogin(secret: "${env.DOCKER_REGISTRY_SECRET}", registry: "${env.REGISTRY}") dir("${env.BASE_DIR}"){ - sh(label: "push docker image to ${env.REPOSITORY}", script: 'make -C ${GO_FOLDER} -f ${MAKEFILE} push') + sh(label: "push docker image to ${env.REPOSITORY}", script: "make -C ${GO_FOLDER} -f ${MAKEFILE} push") } } From 248d0e7ffc8987fb5d43ea152a17634c081f585e Mon Sep 17 00:00:00 2001 From: kuisathaverat Date: Thu, 3 Dec 2020 20:32:44 +0100 Subject: [PATCH 16/21] fix: update go to 1.15.5 --- Jenkinsfile | 2 +- go1.15/Makefile.common | 2 +- go1.15/base/Dockerfile.tmpl | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 05dc1d10..ee52e1b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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.15.4' + GO_VERSION = '1.15.5' } options { timeout(time: 2, unit: 'HOURS') diff --git a/go1.15/Makefile.common b/go1.15/Makefile.common index 15a7575a..611908b7 100644 --- a/go1.15/Makefile.common +++ b/go1.15/Makefile.common @@ -2,7 +2,7 @@ SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) include $(SELF_DIR)/../Makefile.common NAME := golang-crossbuild -VERSION := 1.15.4 +VERSION := 1.15.5 DEBIAN_VERSION ?= 9 SUFFIX := -$(shell basename $(CURDIR)) TAG_EXTENSION ?= diff --git a/go1.15/base/Dockerfile.tmpl b/go1.15/base/Dockerfile.tmpl index f557876a..4d31136c 100644 --- a/go1.15/base/Dockerfile.tmpl +++ b/go1.15/base/Dockerfile.tmpl @@ -20,9 +20,9 @@ RUN \ bison \ && rm -rf /var/lib/apt/lists/* -ARG GOLANG_VERSION=1.15.4 +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=eb61005f0b932c93b424a3a4eaa67d72196c79129d9a3ea8578047683e2c80d5 +ARG GOLANG_DOWNLOAD_SHA256=9a58494e8da722c3aef248c9227b0e9c528c7318309827780f16220998180a0d RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \ && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ From ee52e771224ea38b8a7ba877bb2b21e14150c81e Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Tue, 5 Jan 2021 16:51:46 +0100 Subject: [PATCH 17/21] chore: refactor jenkinsfile --- Jenkinsfile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ee52e1b9..8956c03a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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.15.5' + GO_VERSION = '1.15.6' } options { timeout(time: 2, unit: 'HOURS') @@ -75,13 +75,9 @@ pipeline { when { branch 'master' } - stages { - stage('Publish') { - steps { - withGithubNotify(context: "Publish ${GO_FOLDER} ${MAKEFILE}") { - publishImages() - } - } + steps { + withGithubNotify(context: "Release ${GO_FOLDER} ${MAKEFILE}") { + publishImages() } } } From 9c6d1698ac0f9d77278b80d8aebfe5a8cfcbf975 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Tue, 5 Jan 2021 17:01:38 +0100 Subject: [PATCH 18/21] docs: update tags documentation --- README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c0ed0ee3..a72292ae 100644 --- a/README.md +++ b/README.md @@ -14,17 +14,20 @@ 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-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 +- `1.10.8-main`, `1.11.13-main`, `1.12.12-main`, `1.13.12-main`, `1.14.12-main`, `1.15.6-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.12-arm`, `1.15.6-arm` - linux/{armv5,armv6,armv7,arm64} +- `1.10.8-darwin`, `1.11.13-darwin`, `1.12.12-darwin`, `1.13.12-darwin`, `1.14.12-darwin` - darwin/{386} +- `1.10.8-darwin`, `1.11.13-darwin`, `1.12.12-darwin`, `1.13.12-darwin`, `1.14.12-darwin`, `1.15.6-darwin` - darwin/{amd64} +- `1.10.8-ppc`, `1.11.13-ppc`, `1.12.12-ppc`, `1.13.12-ppc`, `1.14.12-ppc`, `1.15.6-ppc` - linux/{ppc64,ppc64le} +- `1.10.8-mips`, `1.11.13-mips`, `1.12.12-mips`, `1.13.12-mips`, `1.14.12-mips`, `1.15.6-mips` - linux/{mips,mipsle,mips64,mips64le} +- `1.10.8-s390x`, `1.11.13-s390x`, `1.12.12-s390`, `1.13.12-s390`, `1.14.12-s390`, `1.15.6-s390` - linux/s390x +- `1.10.8-main-debian7`, `1.11.13-main-debian7`, `1.12.12-debian7`, `1.13.12-debian7`, `1.14.12-debian7`, `1.15.6-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-debian8`, `1.15.4-debian8` - 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.12-debian8`, `1.15.6-debian8` - linux/{amd64,386} and windows/{amd64,386} (Debian 8 uses glibc 2.19) +- `1.15.6-debian9` - linux/{amd64,386} and windows/{amd64,386} (Debian 9 uses glibc 2.24) +- `1.15.6-debian10` - linux/{amd64,386} and windows/{amd64,386} (Debian 10 uses glibc 2.28) ## Usage Example From a01af9084d58a7386c7200d12a27841abcc5d4e2 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Tue, 5 Jan 2021 17:02:45 +0100 Subject: [PATCH 19/21] chore: bump Go version to 1.15.6 --- go1.15/Makefile.common | 2 +- go1.15/base/Dockerfile.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go1.15/Makefile.common b/go1.15/Makefile.common index 611908b7..cbdb6a2e 100644 --- a/go1.15/Makefile.common +++ b/go1.15/Makefile.common @@ -2,7 +2,7 @@ SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) include $(SELF_DIR)/../Makefile.common NAME := golang-crossbuild -VERSION := 1.15.5 +VERSION := 1.15.6 DEBIAN_VERSION ?= 9 SUFFIX := -$(shell basename $(CURDIR)) TAG_EXTENSION ?= diff --git a/go1.15/base/Dockerfile.tmpl b/go1.15/base/Dockerfile.tmpl index 4d31136c..7d0aec81 100644 --- a/go1.15/base/Dockerfile.tmpl +++ b/go1.15/base/Dockerfile.tmpl @@ -20,9 +20,9 @@ RUN \ bison \ && rm -rf /var/lib/apt/lists/* -ARG GOLANG_VERSION=1.15.5 +ARG GOLANG_VERSION=1.15.6 ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz -ARG GOLANG_DOWNLOAD_SHA256=9a58494e8da722c3aef248c9227b0e9c528c7318309827780f16220998180a0d +ARG GOLANG_DOWNLOAD_SHA256=3918e6cc85e7eaaa6f859f1bdbaac772e7a825b0eb423c63d3ae68b21f84b844 RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \ && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ From c54ef1106f720b8d7a8a016c5d9b1c65e9147852 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Tue, 5 Jan 2021 17:03:05 +0100 Subject: [PATCH 20/21] feta: show GLIB version in logs --- go1.15/base/Dockerfile.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/go1.15/base/Dockerfile.tmpl b/go1.15/base/Dockerfile.tmpl index 7d0aec81..ae126c4b 100644 --- a/go1.15/base/Dockerfile.tmpl +++ b/go1.15/base/Dockerfile.tmpl @@ -37,6 +37,9 @@ WORKDIR $GOPATH COPY rootfs / +# show the GLIBC version +RUN ldd --version + WORKDIR / RUN go get -d . \ && go build -o /crossbuild /entrypoint.go \ From 565ac72f83d19abac0aceb966831763d264827a2 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Thu, 7 Jan 2021 11:06:42 +0100 Subject: [PATCH 21/21] chore: suggested change --- go1.14/main/Dockerfile.tmpl | 2 +- go1.15/main/Dockerfile.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go1.14/main/Dockerfile.tmpl b/go1.14/main/Dockerfile.tmpl index c3032650..ea5d9656 100644 --- a/go1.14/main/Dockerfile.tmpl +++ b/go1.14/main/Dockerfile.tmpl @@ -1,6 +1,6 @@ ARG REPOSITORY ARG VERSION -ARG TAG_EXTENSION +ARG TAG_EXTENSION='' FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \ diff --git a/go1.15/main/Dockerfile.tmpl b/go1.15/main/Dockerfile.tmpl index c3032650..ea5d9656 100644 --- a/go1.15/main/Dockerfile.tmpl +++ b/go1.15/main/Dockerfile.tmpl @@ -1,6 +1,6 @@ ARG REPOSITORY ARG VERSION -ARG TAG_EXTENSION +ARG TAG_EXTENSION='' FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} RUN \