build: Run validate headers in build step

Signed-off-by: Chris Crone <christopher.crone@docker.com>
This commit is contained in:
Chris Crone 2020-12-15 15:54:53 +01:00
Родитель 2fa5610a91
Коммит 97db9e6999
2 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -27,6 +27,7 @@ ARG GOLANGCI_LINT_VERSION=v1.33.0-alpine
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS builder
WORKDIR /go/src/github.com/docker/hub-tool
RUN apk add --no-cache \
bash \
git \
make
@ -51,6 +52,14 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/.cache/golangci-lint \
make -f builder.Makefile lint
####
# VALIDATE HEADERS
####
FROM builder AS validate-headers
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go get -u github.com/kunalkushwaha/ltag && ./scripts/validate/fileheader
####
# CHECK GO MOD
####

Просмотреть файл

@ -111,9 +111,7 @@ lint: ## Run the go linter
.PHONY: validate-headers
validate-headers: ## Validate files license header
docker run --rm -v $(CURDIR):/work -w /work \
golang:${GO_VERSION} \
bash -c 'go get -u github.com/kunalkushwaha/ltag && ./scripts/validate/fileheader'
@docker build $(BUILD_ARGS) . --target validate-headers
.PHONY: validate-go-mod
validate-go-mod: ## Validate go.mod and go.sum are up-to-date