Further makefile cleanup

- cleaned the make check
- local build do not require context

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
This commit is contained in:
Flavio Crisciani 2018-06-16 10:50:38 -07:00
parent fbf02c3794
commit 48196df4a2
3 changed files with 12 additions and 21 deletions

View File

@ -5,7 +5,7 @@ defaults: &defaults
docker: docker:
- image: 'circleci/golang:1.10' - image: 'circleci/golang:1.10'
environment: environment:
Dockerfile: Dockerfile.ci dockerbuildargs: -f Dockerfile.ci .
dockerargs: --privileged -e CIRCLECI dockerargs: --privileged -e CIRCLECI
jobs: jobs:
@ -34,7 +34,7 @@ jobs:
- setup_remote_docker: - setup_remote_docker:
reusable: true reusable: true
exclusive: false exclusive: false
- run: make check-lint - run: make check
cross: cross:
<<: *defaults <<: *defaults

View File

@ -1,6 +1,6 @@
.PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-code check-format unit-tests check-local .PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-local check-code check-format unit-tests
SHELL=/bin/bash SHELL=/bin/bash
Dockerfile ?= Dockerfile.build dockerbuildargs ?= - < Dockerfile.build
dockerargs ?= --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork dockerargs ?= --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
build_image=libnetworkbuild build_image=libnetworkbuild
container_env = -e "INSIDECONTAINER=-incontainer=true" container_env = -e "INSIDECONTAINER=-incontainer=true"
@ -9,12 +9,12 @@ CROSS_PLATFORMS = linux/amd64 linux/386 linux/arm windows/amd64
PACKAGES=$(shell go list ./... | grep -v /vendor/) PACKAGES=$(shell go list ./... | grep -v /vendor/)
export PATH := $(CURDIR)/bin:$(PATH) export PATH := $(CURDIR)/bin:$(PATH)
all: ${build_image}.created build check clean all: build check clean
all-local: build-local check-local clean all-local: build-local check-local clean
builder: builder:
docker build -f ${Dockerfile} -t ${build_image} . docker build -t ${build_image} ${dockerbuildargs}
build: builder build: builder
@echo "🐳 $@" @echo "🐳 $@"
@ -44,14 +44,10 @@ push-images: build-images
clean: clean:
@echo "🐳 $@" @echo "🐳 $@"
@if [ -d bin ]; then \ @if [ -d bin ]; then \
echo "Removing dnet and proxy binaries"; \ echo "Removing binaries"; \
rm -rf bin; \ rm -rf bin; \
fi fi
force-clean: clean
@echo "🐳 $@"
@rm -rf ${build_image}.created
cross: builder cross: builder
@mkdir -p "bin" @mkdir -p "bin"
@for platform in ${CROSS_PLATFORMS}; do \ @for platform in ${CROSS_PLATFORMS}; do \
@ -68,12 +64,7 @@ cross-local:
check: builder check: builder
@${docker} make check-local @${docker} make check-local
check-lint: builder check-local: check-code check-format
@${docker} make check-local-lint
check-local-lint: check-format check-code
check-local: check-format check-code unit-tests-local
check-code: lint gosimple vet ineffassign check-code: lint gosimple vet ineffassign
@ -90,7 +81,7 @@ unit-tests-local:
if ls $$dir/*.go &> /dev/null; then \ if ls $$dir/*.go &> /dev/null; then \
pushd . &> /dev/null ; \ pushd . &> /dev/null ; \
cd $$dir ; \ cd $$dir ; \
go test ${INSIDECONTAINER} -test.v -test.parallel 5 -covermode=count -coverprofile=./profile.tmp ; \ go test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
ret=$$? ;\ ret=$$? ;\
if [ $$ret -ne 0 ]; then exit $$ret; fi ;\ if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
popd &> /dev/null; \ popd &> /dev/null; \
@ -109,7 +100,7 @@ vet: ## run go vet
misspell: misspell:
@echo "🐳 $@" @echo "🐳 $@"
@test -z "$$(find . -type f | grep -v vendor/ | grep -v bin/ | grep -v .git/ | grep -v MAINTAINERS | xargs misspell | tee /dev/stderr)" @test -z "$$(find . -type f | grep -v vendor/ | grep "\.go\|\.md" | xargs misspell -error | tee /dev/stderr)"
fmt: ## run go fmt fmt: ## run go fmt
@echo "🐳 $@" @echo "🐳 $@"
@ -128,5 +119,5 @@ gosimple: ## run gosimple
@echo "🐳 $@" @echo "🐳 $@"
@test -z "$$(gosimple . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)" @test -z "$$(gosimple . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)"
shell: ${build_image}.created shell: builder
@${docker} ${SHELL} @${docker} ${SHELL}

View File

@ -41,7 +41,7 @@ func (nDB *NetworkDB) handleNodeEvent(nEvent *NodeEvent) bool {
// If the node is not known from memberlist we cannot process save any state of it else if it actually // If the node is not known from memberlist we cannot process save any state of it else if it actually
// dies we won't receive any notification and we will remain stuck with it // dies we won't receive any notification and we will remain stuck with it
if _, ok := nDB.nodes[nEvent.NodeName]; !ok { if _, ok := nDB.nodes[nEvent.NodeName]; !ok {
logrus.Error("node: %s is unknown to memberlist", nEvent.NodeName) logrus.Errorf("node: %s is unknown to memberlist", nEvent.NodeName)
return false return false
} }