build: move GOLANGCI_VERSION to build.env

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-06-22 14:06:43 +02:00 committed by mergify[bot]
parent 33dc861f23
commit bc2ac1ccac
4 changed files with 10 additions and 5 deletions

View File

@ -19,7 +19,6 @@ branches:
env: env:
global: global:
- GOLANGCI_VERSION=v1.21.0
- GO111MODULE=on - GO111MODULE=on
- GOSEC_VERSION=2.0.0 - GOSEC_VERSION=2.0.0
- TEST_COVERAGE=stdout - TEST_COVERAGE=stdout
@ -66,6 +65,7 @@ jobs:
- pip install --user --upgrade pip - pip install --user --upgrade pip
- pip install --user yamllint - pip install --user yamllint
# install golangci-lint # install golangci-lint
- export GOLANGCI_VERSION=$(source build.env ; echo ${GOLANGCI_VERSION})
- curl -sf - curl -sf
"https://install.goreleaser.com/github.com/golangci/golangci-lint.sh" "https://install.goreleaser.com/github.com/golangci/golangci-lint.sh"
| bash -s -- -b $GOPATH/bin "${GOLANGCI_VERSION}" | bash -s -- -b $GOPATH/bin "${GOLANGCI_VERSION}"

View File

@ -137,13 +137,13 @@ containerized-test: .test-container-id
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):devel > .devel-container-id $(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):devel > .devel-container-id
# create a (cached) container image with dependencied for testing cephcsi # 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 [ ! -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) -t $(CSI_IMAGE_NAME):test -f ./scripts/Dockerfile.test .
$(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 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 push-image-cephcsi: image-cephcsi
$(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH) $(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH)

View File

@ -12,3 +12,6 @@
# standard Golang options # standard Golang options
GOLANG_VERSION=1.13.9 GOLANG_VERSION=1.13.9
GO111MODULE=on GO111MODULE=on
# static checks and linters
GOLANGCI_VERSION=v1.21.0

View File

@ -10,7 +10,6 @@
FROM fedora:latest FROM fedora:latest
ARG GOLANGCI_VERSION=v1.21.0
ARG GOSEC_VERSION=2.0.0 ARG GOSEC_VERSION=2.0.0
ARG GOPATH=/go ARG GOPATH=/go
@ -19,7 +18,10 @@ ENV \
GO111MODULE=on \ GO111MODULE=on \
PATH="${GOPATH}/bin:/opt/commitlint/node_modules/.bin:${PATH}" PATH="${GOPATH}/bin:/opt/commitlint/node_modules/.bin:${PATH}"
RUN dnf -y install \ COPY build.env /
RUN source /build.env \
&& dnf -y install \
git \ git \
make \ make \
golang \ golang \