build: move GOLANG_VERSION to build.env

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-06-22 12:19:37 +02:00 committed by mergify[bot]
parent c9ad904331
commit f83a065c8a
4 changed files with 24 additions and 5 deletions

View File

@ -143,7 +143,7 @@ containerized-test: .test-container-id
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id $(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id
image-cephcsi: 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 push-image-cephcsi: image-cephcsi
$(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH) $(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH)

14
build.env Normal file
View File

@ -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

View File

@ -6,7 +6,6 @@ FROM ${BASE_IMAGE} as builder
LABEL stage="build" LABEL stage="build"
ARG GOLANG_VERSION=1.13.9
ARG CSI_IMAGE_NAME=quay.io/cephcsi/cephcsi ARG CSI_IMAGE_NAME=quay.io/cephcsi/cephcsi
ARG CSI_IMAGE_VERSION=canary ARG CSI_IMAGE_VERSION=canary
ARG GO_ARCH ARG GO_ARCH
@ -14,7 +13,10 @@ ARG SRC_DIR
ARG GIT_COMMIT ARG GIT_COMMIT
ARG GOROOT=/usr/local/go 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 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 RUN dnf install libcephfs-devel librados-devel librbd-devel /usr/bin/cc make -y

View File

@ -7,8 +7,11 @@ ENV GOPATH=/go \
GO111MODULE=on \ GO111MODULE=on \
PATH="${GOROOT}/bin:${GOPATH}/bin:${PATH}" PATH="${GOROOT}/bin:${GOPATH}/bin:${PATH}"
RUN mkdir -p /usr/local/go && \ COPY build.env /
curl https://storage.googleapis.com/golang/go1.13.9.linux-amd64.tar.gz | tar xzf - -C ${GOROOT} --strip-components=1
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 \ RUN dnf -y install \
git \ git \