mirror of https://github.com/docker/cli.git
commit
0a613971b9
5
Makefile
5
Makefile
|
@ -2,7 +2,7 @@
|
||||||
# github.com/docker/cli
|
# github.com/docker/cli
|
||||||
#
|
#
|
||||||
|
|
||||||
.PHONY: build clean cross
|
.PHONY: build clean cross test lint
|
||||||
|
|
||||||
# build the CLI
|
# build the CLI
|
||||||
build: clean
|
build: clean
|
||||||
|
@ -17,6 +17,9 @@ clean:
|
||||||
test:
|
test:
|
||||||
@go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
|
@go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
|
||||||
|
|
||||||
|
lint:
|
||||||
|
@gometalinter --config gometalinter.json ./...
|
||||||
|
|
||||||
# build the CLI for multiple architectures
|
# build the CLI for multiple architectures
|
||||||
cross: clean
|
cross: clean
|
||||||
@gox -output build/docker-{{.OS}}-{{.Arch}} \
|
@gox -output build/docker-{{.OS}}-{{.Arch}} \
|
||||||
|
|
|
@ -7,4 +7,11 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- setup_remote_docker
|
- setup_remote_docker
|
||||||
- run: docker build -f dockerfiles/Dockerfile.ci .
|
- run:
|
||||||
|
name: "Lint"
|
||||||
|
command: |
|
||||||
|
docker build -f dockerfiles/Dockerfile.lint --tag cli-linter .
|
||||||
|
docker run cli-linter
|
||||||
|
- run:
|
||||||
|
name: "Build and Unit Test"
|
||||||
|
command: docker build -f dockerfiles/Dockerfile.ci .
|
||||||
|
|
|
@ -13,21 +13,21 @@ type arguments struct {
|
||||||
|
|
||||||
func TestParseExec(t *testing.T) {
|
func TestParseExec(t *testing.T) {
|
||||||
valids := map[*arguments]*types.ExecConfig{
|
valids := map[*arguments]*types.ExecConfig{
|
||||||
&arguments{
|
{
|
||||||
execCmd: []string{"command"},
|
execCmd: []string{"command"},
|
||||||
}: {
|
}: {
|
||||||
Cmd: []string{"command"},
|
Cmd: []string{"command"},
|
||||||
AttachStdout: true,
|
AttachStdout: true,
|
||||||
AttachStderr: true,
|
AttachStderr: true,
|
||||||
},
|
},
|
||||||
&arguments{
|
{
|
||||||
execCmd: []string{"command1", "command2"},
|
execCmd: []string{"command1", "command2"},
|
||||||
}: {
|
}: {
|
||||||
Cmd: []string{"command1", "command2"},
|
Cmd: []string{"command1", "command2"},
|
||||||
AttachStdout: true,
|
AttachStdout: true,
|
||||||
AttachStderr: true,
|
AttachStderr: true,
|
||||||
},
|
},
|
||||||
&arguments{
|
{
|
||||||
options: execOptions{
|
options: execOptions{
|
||||||
interactive: true,
|
interactive: true,
|
||||||
tty: true,
|
tty: true,
|
||||||
|
@ -42,7 +42,7 @@ func TestParseExec(t *testing.T) {
|
||||||
Tty: true,
|
Tty: true,
|
||||||
Cmd: []string{"command"},
|
Cmd: []string{"command"},
|
||||||
},
|
},
|
||||||
&arguments{
|
{
|
||||||
options: execOptions{
|
options: execOptions{
|
||||||
detach: true,
|
detach: true,
|
||||||
},
|
},
|
||||||
|
@ -54,7 +54,7 @@ func TestParseExec(t *testing.T) {
|
||||||
Detach: true,
|
Detach: true,
|
||||||
Cmd: []string{"command"},
|
Cmd: []string{"command"},
|
||||||
},
|
},
|
||||||
&arguments{
|
{
|
||||||
options: execOptions{
|
options: execOptions{
|
||||||
tty: true,
|
tty: true,
|
||||||
interactive: true,
|
interactive: true,
|
||||||
|
|
|
@ -6,29 +6,38 @@
|
||||||
|
|
||||||
+.PHONY: build_docker_image build clean cross dev
|
+.PHONY: build_docker_image build clean cross dev
|
||||||
|
|
||||||
DEV_DOCKER_IMAGE_NAME = docker_cli_dev
|
DEV_DOCKER_IMAGE_NAME = docker-cli-dev
|
||||||
|
LINTER_IMAGE_NAME = docker-cli-lint
|
||||||
|
MOUNTS = -v `pwd`:/go/src/github.com/docker/cli
|
||||||
|
|
||||||
# build docker image (dockerfiles/Dockerfile.build)
|
# build docker image (dockerfiles/Dockerfile.build)
|
||||||
build_docker_image:
|
build_docker_image:
|
||||||
@docker build -q -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.build .
|
@docker build -q -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.build .
|
||||||
|
|
||||||
|
.PHONY: builder_linter_image
|
||||||
|
build_linter_image:
|
||||||
|
@docker build -q -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint .
|
||||||
|
|
||||||
# build executable using a container
|
# build executable using a container
|
||||||
build: build_docker_image
|
build: build_docker_image
|
||||||
@echo "WARNING: this will drop a Linux executable on your host (not a macOS of Windows one)"
|
@echo "WARNING: this will drop a Linux executable on your host (not a macOS of Windows one)"
|
||||||
@docker run --rm -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) make build
|
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make build
|
||||||
|
|
||||||
# clean build artifacts using a container
|
# clean build artifacts using a container
|
||||||
clean: build_docker_image
|
clean: build_docker_image
|
||||||
@docker run --rm -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) make clean
|
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean
|
||||||
|
|
||||||
# run go test
|
# run go test
|
||||||
test: build_docker_image
|
test: build_docker_image
|
||||||
@docker run --rm -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) make test
|
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test
|
||||||
|
|
||||||
# build the CLI for multiple architectures using a container
|
# build the CLI for multiple architectures using a container
|
||||||
cross: build_docker_image
|
cross: build_docker_image
|
||||||
@docker run --rm -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) make cross
|
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make cross
|
||||||
|
|
||||||
# start container in interactive mode for in-container development
|
# start container in interactive mode for in-container development
|
||||||
dev: build_docker_image
|
dev: build_docker_image
|
||||||
@docker run -ti -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) ash
|
@docker run -ti $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) ash
|
||||||
|
|
||||||
|
lint: build_linter_image
|
||||||
|
@docker run -ti $(MOUNTS) $(LINTER_IMAGE_NAME)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
FROM golang:1.8-alpine
|
||||||
|
|
||||||
|
RUN apk add -U git
|
||||||
|
|
||||||
|
RUN go get -u gopkg.in/alecthomas/gometalinter.v1 && \
|
||||||
|
mv /go/bin/gometalinter.v1 /usr/local/bin/gometalinter && \
|
||||||
|
gometalinter --install
|
||||||
|
|
||||||
|
WORKDIR /go/src/github.com/docker/cli
|
||||||
|
COPY . .
|
||||||
|
ENTRYPOINT ["/usr/local/bin/gometalinter"]
|
||||||
|
CMD ["--config=gometalinter.json", "./..."]
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"Vendor": true,
|
||||||
|
"Sort": ["linter", "severity"],
|
||||||
|
"Exclude": ["cli/compose/schema/bindata.go"],
|
||||||
|
|
||||||
|
"DisableAll": true,
|
||||||
|
"Enable": ["gofmt", "vet"]
|
||||||
|
}
|
Loading…
Reference in New Issue