Преглед на файлове

Further makefile cleanup

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

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
Flavio Crisciani преди 7 години
родител
ревизия
48196df4a2
променени са 3 файла, в които са добавени 12 реда и са изтрити 21 реда
  1. 2 2
      libnetwork/.circleci/config.yml
  2. 9 18
      libnetwork/Makefile
  3. 1 1
      libnetwork/networkdb/delegate.go

+ 2 - 2
libnetwork/.circleci/config.yml

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

+ 9 - 18
libnetwork/Makefile

@@ -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
-Dockerfile ?= Dockerfile.build
+dockerbuildargs ?= - < Dockerfile.build
 dockerargs ?= --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
 build_image=libnetworkbuild
 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/)
 export PATH := $(CURDIR)/bin:$(PATH)
 
-all: ${build_image}.created build check clean
+all: build check clean
 
 all-local: build-local check-local clean
 
 builder:
-	docker build -f ${Dockerfile} -t ${build_image} .
+	docker build -t ${build_image} ${dockerbuildargs}
 
 build: builder
 	@echo "🐳 $@"
@@ -44,14 +44,10 @@ push-images: build-images
 clean:
 	@echo "🐳 $@"
 	@if [ -d bin ]; then \
-		echo "Removing dnet and proxy binaries"; \
+		echo "Removing binaries"; \
 		rm -rf bin; \
 	fi
 
-force-clean: clean
-	@echo "🐳 $@"
-	@rm -rf ${build_image}.created
-
 cross: builder
 	@mkdir -p "bin"
 	@for platform in ${CROSS_PLATFORMS}; do \
@@ -68,12 +64,7 @@ cross-local:
 check: builder
 	@${docker} make check-local
 
-check-lint: builder
-	@${docker} make check-local-lint
-
-check-local-lint: check-format check-code
-
-check-local: check-format check-code unit-tests-local
+check-local: check-code check-format
 
 check-code: lint gosimple vet ineffassign
 
@@ -90,7 +81,7 @@ unit-tests-local:
 	if ls $$dir/*.go &> /dev/null; then \
 		pushd . &> /dev/null ; \
 		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=$$? ;\
 		if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
 		popd &> /dev/null; \
@@ -109,7 +100,7 @@ vet: ## run go vet
 
 misspell:
 	@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
 	@echo "🐳 $@"
@@ -128,5 +119,5 @@ gosimple: ## run gosimple
 	@echo "🐳 $@"
 	@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}

+ 1 - 1
libnetwork/networkdb/delegate.go

@@ -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
 	// dies we won't receive any notification and we will remain stuck with it
 	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
 	}