From f83a065c8ad7a0bbaebf63bac133476b00ec43b7 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 22 Jun 2020 12:19:37 +0200 Subject: [PATCH] build: move GOLANG_VERSION to build.env Signed-off-by: Niels de Vos --- Makefile | 2 +- build.env | 14 ++++++++++++++ deploy/cephcsi/image/Dockerfile | 6 ++++-- scripts/Dockerfile.devel | 7 +++++-- 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 build.env diff --git a/Makefile b/Makefile index e0e785faf..bb2b962f8 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,7 @@ containerized-test: .test-container-id $(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id image-cephcsi: - $(CONTAINER_CMD) build $(CPUSET) -t $(CSI_IMAGE) -f deploy/cephcsi/image/Dockerfile . --build-arg GOLANG_VERSION=1.13.8 --build-arg CSI_IMAGE_NAME=$(CSI_IMAGE_NAME) --build-arg CSI_IMAGE_VERSION=$(CSI_IMAGE_VERSION) --build-arg GIT_COMMIT=$(GIT_COMMIT) --build-arg GO_ARCH=$(GOARCH) $(BASE_IMAGE_ARG) + $(CONTAINER_CMD) build $(CPUSET) -t $(CSI_IMAGE) -f deploy/cephcsi/image/Dockerfile . --build-arg CSI_IMAGE_NAME=$(CSI_IMAGE_NAME) --build-arg CSI_IMAGE_VERSION=$(CSI_IMAGE_VERSION) --build-arg GIT_COMMIT=$(GIT_COMMIT) --build-arg --build-arg GO_ARCH=$(GOARCH) $(BASE_IMAGE_ARG) push-image-cephcsi: image-cephcsi $(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH) diff --git a/build.env b/build.env new file mode 100644 index 000000000..6fcdf0bba --- /dev/null +++ b/build.env @@ -0,0 +1,14 @@ +# +# build.env +# +# Environment file used by scripts and tools. All (default) versions used for +# building, testing and deploying Ceph-CSI are listed here. +# +# The format should be source-able by shell scripts, but do not assume only +# shell scripts consume this file. Variables that reference variables may not +# get proporly expanded. +# + +# standard Golang options +GOLANG_VERSION=1.13.9 +GO111MODULE=on diff --git a/deploy/cephcsi/image/Dockerfile b/deploy/cephcsi/image/Dockerfile index de8da539d..c8438f768 100644 --- a/deploy/cephcsi/image/Dockerfile +++ b/deploy/cephcsi/image/Dockerfile @@ -6,7 +6,6 @@ FROM ${BASE_IMAGE} as builder LABEL stage="build" -ARG GOLANG_VERSION=1.13.9 ARG CSI_IMAGE_NAME=quay.io/cephcsi/cephcsi ARG CSI_IMAGE_VERSION=canary ARG GO_ARCH @@ -14,7 +13,10 @@ ARG SRC_DIR ARG GIT_COMMIT ARG GOROOT=/usr/local/go -RUN mkdir -p ${GOROOT} && \ +COPY build.env / + +RUN source /build.env && \ + mkdir -p ${GOROOT} && \ curl https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz | tar xzf - -C ${GOROOT} --strip-components=1 RUN dnf install libcephfs-devel librados-devel librbd-devel /usr/bin/cc make -y diff --git a/scripts/Dockerfile.devel b/scripts/Dockerfile.devel index 4c998b735..0c1494ae4 100644 --- a/scripts/Dockerfile.devel +++ b/scripts/Dockerfile.devel @@ -7,8 +7,11 @@ ENV GOPATH=/go \ GO111MODULE=on \ PATH="${GOROOT}/bin:${GOPATH}/bin:${PATH}" -RUN mkdir -p /usr/local/go && \ - curl https://storage.googleapis.com/golang/go1.13.9.linux-amd64.tar.gz | tar xzf - -C ${GOROOT} --strip-components=1 +COPY build.env / + +RUN source /build.env \ + && mkdir -p /usr/local/go \ + && curl https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz | tar xzf - -C ${GOROOT} --strip-components=1 RUN dnf -y install \ git \