Skip to content

Commit 04c7b9d

Browse files
committed
ci: add protolint validation
Signed-off-by: Justin Chadwell <[email protected]>
1 parent c540262 commit 04c7b9d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

docker-bake.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ target "lint" {
9393
{ name = "labs", tags = "dfrunsecurity", target = "golangci-lint" },
9494
{ name = "nydus", tags = "nydus", target = "golangci-lint" },
9595
{ name = "yaml", tags = "", target = "yamllint" },
96+
{ name = "proto", tags = "", target = "protolint" },
9697
]
9798
}
9899
}

hack/dockerfiles/lint.Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
# syntax=docker/dockerfile-upstream:master
22

33
ARG GO_VERSION=1.20
4+
ARG PROTOLINT_VERSION=0.45.0
5+
ARG GOLANGCI_LINT_VERSION=1.52.2
46

5-
FROM golang:${GO_VERSION}-alpine AS base
7+
FROM golang:${GO_VERSION}-alpine AS golang-base
8+
FROM yoheimuta/protolint:${PROTOLINT_VERSION} AS protolint-base
9+
10+
FROM golang-base AS base
611
ENV GOFLAGS="-buildvcs=false"
12+
ARG GOLANGCI_LINT_VERSION
713
RUN apk add --no-cache gcc musl-dev yamllint
8-
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2
14+
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION}
15+
COPY --link --from=protolint-base /usr/local/bin/protolint /usr/local/bin/protolint
916
WORKDIR /go/src/github.com/moby/buildkit
1017

1118
FROM base as golangci-lint
@@ -20,6 +27,12 @@ RUN --mount=target=/go/src/github.com/moby/buildkit --mount=target=/root/.cache,
2027
yamllint -c .yamllint.yml --strict . && \
2128
touch /yamllint.done
2229

30+
FROM base as protolint
31+
RUN --mount=target=/go/src/github.com/moby/buildkit \
32+
protolint lint . && \
33+
touch /protolint.done
34+
2335
FROM scratch
2436
COPY --link --from=golangci-lint /golangci-lint.done /
2537
COPY --link --from=yamllint /yamllint.done /
38+
COPY --link --from=protolint /protolint.done /

0 commit comments

Comments
 (0)