diff --git a/.travis.yml b/.travis.yml index c92cc009d..4009b62af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,6 @@ branches: env: global: - - GOLANGCI_VERSION=v1.21.0 - GO111MODULE=on - GOSEC_VERSION=2.0.0 - TEST_COVERAGE=stdout @@ -66,6 +65,7 @@ jobs: - pip install --user --upgrade pip - pip install --user yamllint # install golangci-lint + - export GOLANGCI_VERSION=$(source build.env ; echo ${GOLANGCI_VERSION}) - curl -sf "https://install.goreleaser.com/github.com/golangci/golangci-lint.sh" | bash -s -- -b $GOPATH/bin "${GOLANGCI_VERSION}" diff --git a/Makefile b/Makefile index bb2b962f8..9a5c0de1d 100644 --- a/Makefile +++ b/Makefile @@ -137,13 +137,13 @@ containerized-test: .test-container-id $(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):devel > .devel-container-id # create a (cached) container image with dependencied for testing cephcsi -.test-container-id: scripts/Dockerfile.test +.test-container-id: 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) 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 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) + $(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 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 index 6fcdf0bba..408b95f2d 100644 --- a/build.env +++ b/build.env @@ -12,3 +12,6 @@ # standard Golang options GOLANG_VERSION=1.13.9 GO111MODULE=on + +# static checks and linters +GOLANGCI_VERSION=v1.21.0 diff --git a/scripts/Dockerfile.test b/scripts/Dockerfile.test index 9f7e133a9..d67d6645f 100644 --- a/scripts/Dockerfile.test +++ b/scripts/Dockerfile.test @@ -10,7 +10,6 @@ FROM fedora:latest -ARG GOLANGCI_VERSION=v1.21.0 ARG GOSEC_VERSION=2.0.0 ARG GOPATH=/go @@ -19,7 +18,10 @@ ENV \ GO111MODULE=on \ PATH="${GOPATH}/bin:/opt/commitlint/node_modules/.bin:${PATH}" -RUN dnf -y install \ +COPY build.env / + +RUN source /build.env \ + && dnf -y install \ git \ make \ golang \