mirror of https://github.com/docker/cli.git
commit
aa949f2ad5
|
@ -2,41 +2,6 @@ version: 2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
lint:
|
|
||||||
working_directory: /work
|
|
||||||
docker: [{image: 'docker:20.10-git'}]
|
|
||||||
environment:
|
|
||||||
DOCKER_BUILDKIT: 1
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker:
|
|
||||||
version: 20.10.6
|
|
||||||
reusable: true
|
|
||||||
exclusive: false
|
|
||||||
- run:
|
|
||||||
name: "Docker version"
|
|
||||||
command: docker version
|
|
||||||
- run:
|
|
||||||
name: "Docker info"
|
|
||||||
command: docker info
|
|
||||||
- run:
|
|
||||||
name: "Shellcheck - build image"
|
|
||||||
command: |
|
|
||||||
docker build --progress=plain -f dockerfiles/Dockerfile.shellcheck --tag cli-validator:$CIRCLE_BUILD_NUM .
|
|
||||||
- run:
|
|
||||||
name: "Shellcheck"
|
|
||||||
command: |
|
|
||||||
docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
|
|
||||||
make shellcheck
|
|
||||||
- run:
|
|
||||||
name: "Lint - build image"
|
|
||||||
command: |
|
|
||||||
docker build --progress=plain -f dockerfiles/Dockerfile.lint --tag cli-linter:$CIRCLE_BUILD_NUM .
|
|
||||||
- run:
|
|
||||||
name: "Lint"
|
|
||||||
command: |
|
|
||||||
docker run --rm cli-linter:$CIRCLE_BUILD_NUM
|
|
||||||
|
|
||||||
cross:
|
cross:
|
||||||
working_directory: /work
|
working_directory: /work
|
||||||
docker: [{image: 'docker:20.10-git'}]
|
docker: [{image: 'docker:20.10-git'}]
|
||||||
|
@ -147,7 +112,6 @@ workflows:
|
||||||
version: 2
|
version: 2
|
||||||
ci:
|
ci:
|
||||||
jobs:
|
jobs:
|
||||||
- lint
|
|
||||||
- cross
|
- cross
|
||||||
- test
|
- test
|
||||||
- validate
|
- validate
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: validate
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- '[0-9]+.[0-9]{2}'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- lint
|
||||||
|
- shellcheck
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Run
|
||||||
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
8
Makefile
8
Makefile
|
@ -25,10 +25,6 @@ test-coverage: ## run test coverage
|
||||||
fmt:
|
fmt:
|
||||||
go list -f {{.Dir}} ./... | xargs gofmt -w -s -d
|
go list -f {{.Dir}} ./... | xargs gofmt -w -s -d
|
||||||
|
|
||||||
.PHONY: lint
|
|
||||||
lint: ## run all the lint tools
|
|
||||||
gometalinter --config gometalinter.json ./...
|
|
||||||
|
|
||||||
.PHONY: binary
|
.PHONY: binary
|
||||||
binary:
|
binary:
|
||||||
docker buildx bake binary
|
docker buildx bake binary
|
||||||
|
@ -71,10 +67,6 @@ manpages: ## generate man pages from go source and markdown
|
||||||
yamldocs: ## generate documentation YAML files consumed by docs repo
|
yamldocs: ## generate documentation YAML files consumed by docs repo
|
||||||
scripts/docs/generate-yaml.sh
|
scripts/docs/generate-yaml.sh
|
||||||
|
|
||||||
.PHONY: shellcheck
|
|
||||||
shellcheck: ## run shellcheck validation
|
|
||||||
scripts/validate/shellcheck
|
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help: ## print this help
|
help: ## print this help
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
|
@ -61,3 +61,15 @@ target "cross" {
|
||||||
target "dynbinary-cross" {
|
target "dynbinary-cross" {
|
||||||
inherits = ["dynbinary", "_all_platforms"]
|
inherits = ["dynbinary", "_all_platforms"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target "lint" {
|
||||||
|
dockerfile = "./dockerfiles/Dockerfile.lint"
|
||||||
|
target = "lint"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "shellcheck" {
|
||||||
|
dockerfile = "./dockerfiles/Dockerfile.shellcheck"
|
||||||
|
target = "shellcheck"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
|
@ -11,9 +11,7 @@ DOCKER_CLI_GO_BUILD_CACHE ?= y
|
||||||
|
|
||||||
DEV_DOCKER_IMAGE_NAME = docker-cli-dev$(IMAGE_TAG)
|
DEV_DOCKER_IMAGE_NAME = docker-cli-dev$(IMAGE_TAG)
|
||||||
BINARY_NATIVE_IMAGE_NAME = docker-cli-native$(IMAGE_TAG)
|
BINARY_NATIVE_IMAGE_NAME = docker-cli-native$(IMAGE_TAG)
|
||||||
LINTER_IMAGE_NAME = docker-cli-lint$(IMAGE_TAG)
|
|
||||||
CROSS_IMAGE_NAME = docker-cli-cross$(IMAGE_TAG)
|
CROSS_IMAGE_NAME = docker-cli-cross$(IMAGE_TAG)
|
||||||
VALIDATE_IMAGE_NAME = docker-cli-shell-validate$(IMAGE_TAG)
|
|
||||||
E2E_IMAGE_NAME = docker-cli-e2e$(IMAGE_TAG)
|
E2E_IMAGE_NAME = docker-cli-e2e$(IMAGE_TAG)
|
||||||
E2E_ENGINE_VERSION ?=
|
E2E_ENGINE_VERSION ?=
|
||||||
CACHE_VOLUME_NAME := docker-cli-dev-cache
|
CACHE_VOLUME_NAME := docker-cli-dev-cache
|
||||||
|
@ -32,17 +30,6 @@ build_docker_image:
|
||||||
# build dockerfile from stdin so that we don't send the build-context; source is bind-mounted in the development environment
|
# build dockerfile from stdin so that we don't send the build-context; source is bind-mounted in the development environment
|
||||||
cat ./dockerfiles/Dockerfile.dev | docker build ${DOCKER_BUILD_ARGS} --build-arg=GO_VERSION -t $(DEV_DOCKER_IMAGE_NAME) -
|
cat ./dockerfiles/Dockerfile.dev | docker build ${DOCKER_BUILD_ARGS} --build-arg=GO_VERSION -t $(DEV_DOCKER_IMAGE_NAME) -
|
||||||
|
|
||||||
# build docker image having the linting tools (dockerfiles/Dockerfile.lint)
|
|
||||||
.PHONY: build_linter_image
|
|
||||||
build_linter_image:
|
|
||||||
# build dockerfile from stdin so that we don't send the build-context; source is bind-mounted in the development environment
|
|
||||||
cat ./dockerfiles/Dockerfile.lint | docker build ${DOCKER_BUILD_ARGS} --build-arg=GO_VERSION -t $(LINTER_IMAGE_NAME) -
|
|
||||||
|
|
||||||
.PHONY: build_shell_validate_image
|
|
||||||
build_shell_validate_image:
|
|
||||||
# build dockerfile from stdin so that we don't send the build-context; source is bind-mounted in the development environment
|
|
||||||
cat ./dockerfiles/Dockerfile.shellcheck | docker build --build-arg=GO_VERSION -t $(VALIDATE_IMAGE_NAME) -
|
|
||||||
|
|
||||||
.PHONY: build_binary_native_image
|
.PHONY: build_binary_native_image
|
||||||
build_binary_native_image:
|
build_binary_native_image:
|
||||||
# build dockerfile from stdin so that we don't send the build-context; source is bind-mounted in the development environment
|
# build dockerfile from stdin so that we don't send the build-context; source is bind-mounted in the development environment
|
||||||
|
@ -92,8 +79,8 @@ dev: build_docker_image ## start a build container in interactive mode for in-co
|
||||||
shell: dev ## alias for dev
|
shell: dev ## alias for dev
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: build_linter_image ## run linters
|
lint: ## run linters
|
||||||
$(DOCKER_RUN) -it $(LINTER_IMAGE_NAME)
|
docker buildx bake lint
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
fmt: ## run gofmt
|
fmt: ## run gofmt
|
||||||
|
@ -120,8 +107,8 @@ yamldocs: build_docker_image ## generate documentation YAML files consumed by do
|
||||||
$(DOCKER_RUN) -it $(DEV_DOCKER_IMAGE_NAME) make yamldocs
|
$(DOCKER_RUN) -it $(DEV_DOCKER_IMAGE_NAME) make yamldocs
|
||||||
|
|
||||||
.PHONY: shellcheck
|
.PHONY: shellcheck
|
||||||
shellcheck: build_shell_validate_image ## run shellcheck validation
|
shellcheck: ## run shellcheck validation
|
||||||
$(DOCKER_RUN) -it $(VALIDATE_IMAGE_NAME) make shellcheck
|
docker buildx bake shellcheck
|
||||||
|
|
||||||
.PHONY: test-e2e
|
.PHONY: test-e2e
|
||||||
test-e2e: test-e2e-non-experimental test-e2e-experimental test-e2e-connhelper-ssh ## run all e2e tests
|
test-e2e: test-e2e-non-experimental test-e2e-experimental test-e2e-connhelper-ssh ## run all e2e tests
|
||||||
|
|
|
@ -1,24 +1,16 @@
|
||||||
# syntax=docker/dockerfile:1.3
|
# syntax=docker/dockerfile:1.3
|
||||||
|
|
||||||
ARG GO_VERSION=1.16.6
|
ARG GO_VERSION=1.16.6
|
||||||
ARG GOLANGCI_LINTER_SHA="v1.21.0"
|
ARG GOLANGCI_LINT_VERSION=v1.23.8
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-alpine AS build
|
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
|
||||||
ENV CGO_ENABLED=0
|
|
||||||
RUN apk add --no-cache git
|
|
||||||
ARG GOLANGCI_LINTER_SHA
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
--mount=type=cache,target=/go/pkg/mod \
|
|
||||||
go get github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINTER_SHA}
|
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-alpine AS lint
|
FROM golang:${GO_VERSION}-alpine AS lint
|
||||||
ENV GO111MODULE=off
|
ENV GO111MODULE=off
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
|
|
||||||
COPY --from=build /go/bin/golangci-lint /usr/local/bin
|
|
||||||
WORKDIR /go/src/github.com/docker/cli
|
|
||||||
ENV GOGC=75
|
ENV GOGC=75
|
||||||
ENTRYPOINT ["/usr/local/bin/golangci-lint"]
|
WORKDIR /go/src/github.com/docker/cli
|
||||||
CMD ["run", "--config=.golangci.yml"]
|
COPY --from=golangci-lint /usr/bin/golangci-lint /usr/bin/golangci-lint
|
||||||
COPY . .
|
RUN --mount=type=bind,target=. \
|
||||||
|
--mount=type=cache,target=/root/.cache \
|
||||||
|
golangci-lint run
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
FROM koalaman/shellcheck-alpine:v0.7.1
|
# syntax=docker/dockerfile:1.3
|
||||||
RUN apk add --no-cache bash make
|
|
||||||
|
FROM koalaman/shellcheck-alpine:v0.7.1 AS shellcheck
|
||||||
WORKDIR /go/src/github.com/docker/cli
|
WORKDIR /go/src/github.com/docker/cli
|
||||||
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
|
RUN --mount=type=bind,target=. \
|
||||||
COPY . .
|
set -eo pipefail; \
|
||||||
|
find scripts/ contrib/completion/bash -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
shellcheck contrib/completion/bash/docker
|
|
||||||
find scripts/ -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck
|
|
Loading…
Reference in New Issue