ci: install arch specific go in Dockerfile.test

Instead of installing the amd64 on all the
platforms, install architecture specific go
version in test dockerfile.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-12-14 09:46:47 +05:30 committed by mergify[bot]
parent 8a3fe53e87
commit e743e06748
2 changed files with 6 additions and 2 deletions

View File

@ -212,10 +212,11 @@ else
endif
ifeq ($(USE_PULLED_IMAGE),no)
.test-container-id: GOARCH ?= $(shell go env GOARCH 2>/dev/null)
# create a (cached) container image with dependencies for testing cephcsi
.test-container-id: .container-cmd build.env scripts/Dockerfile.test
[ ! -f .test-container-id ] || $(CONTAINER_CMD) rmi $(CSI_IMAGE_NAME):test
$(CONTAINER_CMD) build $(CPUSET) -t $(CSI_IMAGE_NAME):test -f ./scripts/Dockerfile.test .
$(CONTAINER_CMD) build $(CPUSET) --build-arg GOARCH=$(GOARCH) -t $(CSI_IMAGE_NAME):test -f ./scripts/Dockerfile.test .
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id
else
# create the .test-container-id file based on the pulled image

View File

@ -12,6 +12,7 @@ FROM registry.fedoraproject.org/fedora:latest
ARG GOPATH=/go
ARG GOROOT=/usr/local/go
ARG GOARCH
ENV \
GOPATH=${GOPATH} \
@ -22,6 +23,8 @@ ENV \
COPY build.env /
RUN source /build.env \
&& \
( test -n "${GOARCH}" && exit 0; echo -e "\n\nMissing GOARCH argument for building image, install Golang or run: make containerized-test GOARCH=amd64\n\n"; exit 1 ) \
&& dnf -y install \
git \
make \
@ -41,7 +44,7 @@ RUN source /build.env \
&& dnf -y clean all \
&& gem install mdl \
&& mkdir -p ${GOROOT} \
&& curl https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz \
&& curl https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${GOARCH}.tar.gz \
| tar xzf - -C ${GOROOT} --strip-components=1 \
&& curl -sf "https://install.goreleaser.com/github.com/golangci/golangci-lint.sh" \
| bash -s -- -b ${GOPATH}/bin "${GOLANGCI_VERSION}" \