File tree Expand file tree Collapse file tree 7 files changed +77
-40
lines changed Expand file tree Collapse file tree 7 files changed +77
-40
lines changed Original file line number Diff line number Diff line change 77 docker : [{image: 'docker:20.10-git'}]
88 environment :
99 DOCKER_BUILDKIT : 1
10+ BUILDX_VERSION : " v0.6.0"
11+ BUILDKIT_PROGRESS : " plain"
12+ DISABLE_WARN_OUTSIDE_CONTAINER : 1
1013 steps :
1114 - checkout
1215 - setup_remote_docker :
@@ -19,23 +22,19 @@ jobs:
1922 - run :
2023 name : " Docker info"
2124 command : docker info
22- - run :
23- name : " Shellcheck - build image"
24- command : |
25- docker build --progress=plain -f dockerfiles/Dockerfile.shellcheck --tag cli-validator:$CIRCLE_BUILD_NUM .
25+ - run : apk add make curl
26+ - run : mkdir -vp ~/.docker/cli-plugins/
27+ - run : curl -fsSL --output ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-amd64
28+ - run : chmod a+x ~/.docker/cli-plugins/docker-buildx
29+ - run : docker buildx version
2630 - run :
2731 name : " Shellcheck"
2832 command : |
29- docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
30- make shellcheck
31- - run :
32- name : " Lint - build image"
33- command : |
34- docker build --progress=plain -f dockerfiles/Dockerfile.lint --tag cli-linter:$CIRCLE_BUILD_NUM .
33+ make shellcheck
3534 - run :
3635 name : " Lint"
3736 command : |
38- docker run --rm cli-linter:$CIRCLE_BUILD_NUM
37+ make lint
3938
4039 cross :
4140 working_directory : /work
Original file line number Diff line number Diff line change 1+ name : validate
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - ' master'
8+ tags :
9+ - ' v*'
10+ pull_request :
11+ branches :
12+ - ' master'
13+
14+ jobs :
15+ lint :
16+ runs-on : ubuntu-latest
17+ strategy :
18+ fail-fast : false
19+ matrix :
20+ target :
21+ - lint
22+ - shellcheck
23+ steps :
24+ -
25+ name : Checkout
26+ uses : actions/checkout@v2
27+ -
28+ name : Run
29+ uses : docker/bake-action@v1
30+ with :
31+ targets : ${{ matrix.target }}
Original file line number Diff line number Diff line change 2727
2828.PHONY : lint
2929lint : # # run all the lint tools
30- gometalinter --config gometalinter.json ./...
30+ docker buildx bake lint
3131
3232.PHONY : binary
3333binary :
@@ -73,7 +73,7 @@ yamldocs: ## generate documentation YAML files consumed by docs repo
7373
7474.PHONY : shellcheck
7575shellcheck : # # run shellcheck validation
76- scripts/validate/ shellcheck
76+ docker buildx bake shellcheck
7777
7878.PHONY : help
7979help : # # print this help
Original file line number Diff line number Diff line change @@ -61,3 +61,15 @@ target "cross" {
6161target "dynbinary-cross" {
6262 inherits = [" dynbinary" , " _all_platforms" ]
6363}
64+
65+ target "lint" {
66+ dockerfile = " ./dockerfiles/Dockerfile.lint"
67+ target = " lint"
68+ output = [" type=cacheonly" ]
69+ }
70+
71+ target "shellcheck" {
72+ dockerfile = " ./dockerfiles/Dockerfile.shellcheck"
73+ target = " shellcheck"
74+ output = [" type=cacheonly" ]
75+ }
Original file line number Diff line number Diff line change 11# syntax=docker/dockerfile:1.3
22
33ARG GO_VERSION=1.13.15
4- ARG GOLANGCI_LINTER_SHA=" v1.21.0"
4+ ARG GOLANGCI_LINT_VERSION= v1.21.0
55
6- FROM golang:${GO_VERSION}-alpine AS build
7- ENV CGO_ENABLED=0
8- RUN apk add --no-cache git
9- ARG GOLANGCI_LINTER_SHA
10- ARG GO111MODULE=on
11- RUN --mount=type=cache,target=/root/.cache/go-build \
12- --mount=type=cache,target=/go/pkg/mod \
13- go get github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINTER_SHA}
14-
15- FROM golang:${GO_VERSION}-alpine AS lint
16- ENV CGO_ENABLED=0
17- ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
18- COPY --from=build /go/bin/golangci-lint /usr/local/bin
6+ FROM golang:${GO_VERSION}-alpine AS base
197WORKDIR /go/src/github.com/docker/cli
20- ENV GOGC=75
21- ENTRYPOINT ["/usr/local/bin/golangci-lint"]
22- CMD ["run", "--config=.golangci.yml"]
23- COPY . .
8+
9+ FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
10+
11+ FROM base AS lint
12+ ENV CGO_ENABLED=0
13+ ENV GOGC=75
14+ RUN --mount=type=bind,target=. \
15+ --mount=type=cache,target=/root/.cache/go-build \
16+ --mount=type=cache,target=/root/.cache/golangci-lint \
17+ --mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
18+ golangci-lint run --config .golangci.yml ./...
Original file line number Diff line number Diff line change 1- FROM koalaman/shellcheck-alpine:v0.7.1
2- RUN apk add --no-cache bash make
1+ # syntax=docker/dockerfile:1.3
2+
3+ FROM koalaman/shellcheck-alpine:v0.7.1 AS base
4+ RUN apk add --no-cache bash
35WORKDIR /go/src/github.com/docker/cli
4- ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
5- COPY . .
6+
7+ FROM base AS shellcheck
8+ RUN --mount=type=bind,target=. \
9+ shellcheck contrib/completion/bash/docker \
10+ && find scripts/ -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments