Merge pull request #2168 from selansen/circle2.0
Migration from CircleCI1.0 to CircleCI2.0
This commit is contained in:
commit
8dd7572a4c
7 changed files with 113 additions and 73 deletions
73
libnetwork/.circleci/config.yml
Normal file
73
libnetwork/.circleci/config.yml
Normal file
|
@ -0,0 +1,73 @@
|
|||
version: 2
|
||||
|
||||
defaults: &defaults
|
||||
working_directory: ~/go/src/github.com/docker/libnetwork
|
||||
docker:
|
||||
- image: 'circleci/golang:1.10'
|
||||
environment:
|
||||
dockerbuildargs: -f Dockerfile.ci .
|
||||
dockerargs: --privileged -e CIRCLECI
|
||||
|
||||
jobs:
|
||||
builder:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker:
|
||||
reusable: true
|
||||
exclusive: false
|
||||
- run: make builder
|
||||
|
||||
build:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker:
|
||||
reusable: true
|
||||
exclusive: false
|
||||
- run: make build
|
||||
|
||||
lint:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker:
|
||||
reusable: true
|
||||
exclusive: false
|
||||
- run: make check
|
||||
|
||||
cross:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker:
|
||||
reusable: true
|
||||
exclusive: false
|
||||
- run: make cross
|
||||
|
||||
unit-tests:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker:
|
||||
reusable: true
|
||||
exclusive: false
|
||||
- run: make unit-tests
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
ci:
|
||||
jobs:
|
||||
- builder
|
||||
- build:
|
||||
requires:
|
||||
- builder
|
||||
- lint:
|
||||
requires:
|
||||
- builder
|
||||
- cross:
|
||||
requires:
|
||||
- builder
|
||||
- unit-tests:
|
||||
requires:
|
||||
- builder
|
|
@ -1 +0,0 @@
|
|||
*
|
|
@ -1,10 +1,11 @@
|
|||
FROM golang:1.10
|
||||
RUN apt-get update && apt-get -y install iptables
|
||||
|
||||
RUN go get github.com/tools/godep \
|
||||
github.com/golang/lint/golint \
|
||||
RUN go get github.com/golang/lint/golint \
|
||||
golang.org/x/tools/cmd/cover \
|
||||
github.com/mattn/goveralls \
|
||||
github.com/gordonklaus/ineffassign \
|
||||
github.com/client9/misspell/cmd/misspell \
|
||||
honnef.co/go/tools/cmd/gosimple
|
||||
|
||||
WORKDIR /go/src/github.com/docker/libnetwork
|
||||
|
|
13
libnetwork/Dockerfile.ci
Normal file
13
libnetwork/Dockerfile.ci
Normal file
|
@ -0,0 +1,13 @@
|
|||
FROM golang:1.10
|
||||
RUN apt-get update && apt-get -y install iptables
|
||||
|
||||
RUN go get github.com/golang/lint/golint \
|
||||
golang.org/x/tools/cmd/cover \
|
||||
github.com/mattn/goveralls \
|
||||
github.com/gordonklaus/ineffassign \
|
||||
github.com/client9/misspell/cmd/misspell \
|
||||
honnef.co/go/tools/cmd/gosimple
|
||||
|
||||
WORKDIR /go/src/github.com/docker/libnetwork
|
||||
|
||||
COPY . .
|
|
@ -1,27 +1,24 @@
|
|||
.PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-code check-format run-tests integration-tests check-local coveralls circle-ci-cross circle-ci-build circle-ci-check circle-ci
|
||||
.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
|
||||
dockerbuildargs ?= - < Dockerfile.build
|
||||
dockerargs ?= --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
|
||||
build_image=libnetworkbuild
|
||||
dockerargs = --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
|
||||
container_env = -e "INSIDECONTAINER=-incontainer=true"
|
||||
docker = docker run --rm -it ${dockerargs} $$EXTRA_ARGS ${container_env} ${build_image}
|
||||
ciargs = -e CIRCLECI -e "COVERALLS_TOKEN=$$COVERALLS_TOKEN" -e "INSIDECONTAINER=-incontainer=true"
|
||||
cidocker = docker run ${dockerargs} ${ciargs} $$EXTRA_ARGS ${container_env} ${build_image}
|
||||
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 integration-tests clean
|
||||
all: build check clean
|
||||
|
||||
all-local: build-local check-local integration-tests-local clean
|
||||
all-local: build-local check-local clean
|
||||
|
||||
${build_image}.created:
|
||||
builder:
|
||||
docker build -t ${build_image} ${dockerbuildargs}
|
||||
|
||||
build: builder
|
||||
@echo "🐳 $@"
|
||||
docker build -f Dockerfile.build -t ${build_image} .
|
||||
touch ${build_image}.created
|
||||
|
||||
build: ${build_image}.created
|
||||
@echo "🐳 $@"
|
||||
@${docker} ./wrapmake.sh build-local
|
||||
@${docker} make build-local
|
||||
|
||||
build-local:
|
||||
@echo "🐳 $@"
|
||||
|
@ -47,15 +44,11 @@ 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: ${build_image}.created
|
||||
cross: builder
|
||||
@mkdir -p "bin"
|
||||
@for platform in ${CROSS_PLATFORMS}; do \
|
||||
EXTRA_ARGS="-e GOOS=$${platform%/*} -e GOARCH=$${platform##*/}" ; \
|
||||
|
@ -68,16 +61,22 @@ cross-local:
|
|||
go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
|
||||
go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
|
||||
|
||||
check: ${build_image}.created
|
||||
@${docker} ./wrapmake.sh check-local
|
||||
check: builder
|
||||
@${docker} make check-local
|
||||
|
||||
check-local: check-code check-format
|
||||
|
||||
check-code: lint gosimple vet ineffassign
|
||||
|
||||
check-format: fmt misspell
|
||||
|
||||
run-tests:
|
||||
unit-tests: builder
|
||||
${docker} make unit-tests-local
|
||||
|
||||
unit-tests-local:
|
||||
@echo "🐳 Running tests... "
|
||||
@echo "mode: count" > coverage.coverprofile
|
||||
@go build -o "bin/docker-proxy" ./cmd/proxy
|
||||
@for dir in $$( find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -not -path './vendor/*' -type d); do \
|
||||
if ls $$dir/*.go &> /dev/null; then \
|
||||
pushd . &> /dev/null ; \
|
||||
|
@ -94,17 +93,6 @@ run-tests:
|
|||
done
|
||||
@echo "Done running tests"
|
||||
|
||||
check-local: check-format check-code run-tests
|
||||
|
||||
integration-tests: ./bin/dnet
|
||||
@./test/integration/dnet/run-integration-tests.sh
|
||||
|
||||
./bin/dnet:
|
||||
make build
|
||||
|
||||
coveralls:
|
||||
-@goveralls -service circleci -coverprofile=coverage.coverprofile -repotoken $$COVERALLS_TOKEN
|
||||
|
||||
# Depends on binaries because vet will silently fail if it can not load compiled imports
|
||||
vet: ## run go vet
|
||||
@echo "🐳 $@"
|
||||
|
@ -112,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 "🐳 $@"
|
||||
|
@ -131,23 +119,5 @@ gosimple: ## run gosimple
|
|||
@echo "🐳 $@"
|
||||
@test -z "$$(gosimple . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)"
|
||||
|
||||
# CircleCI's Docker fails when cleaning up using the --rm flag
|
||||
# The following targets are a workaround for this
|
||||
circle-ci-cross: ${build_image}.created
|
||||
@mkdir -p "bin"
|
||||
@for platform in ${CROSS_PLATFORMS}; do \
|
||||
EXTRA_ARGS="-e GOOS=$${platform%/*} -e GOARCH=$${platform##*/}" ; \
|
||||
echo "$${platform}..." ; \
|
||||
${cidocker} make cross-local ; \
|
||||
done
|
||||
|
||||
circle-ci-check: ${build_image}.created
|
||||
@${cidocker} make check-local coveralls
|
||||
|
||||
circle-ci-build: ${build_image}.created
|
||||
@${cidocker} make build-local
|
||||
|
||||
circle-ci: circle-ci-build circle-ci-check circle-ci-cross integration-tests
|
||||
|
||||
shell: ${build_image}.created
|
||||
shell: builder
|
||||
@${docker} ${SHELL}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
machine:
|
||||
environment:
|
||||
GODIST: "go1.7.1.linux-amd64.tar.gz"
|
||||
services:
|
||||
- docker
|
||||
|
||||
dependencies:
|
||||
override:
|
||||
- sudo apt-get update; sudo apt-get install -y iptables zookeeperd
|
||||
- go get golang.org/x/tools/cmd/goimports
|
||||
|
||||
test:
|
||||
override:
|
||||
- make circle-ci
|
||||
post:
|
||||
- bash <(curl -s https://codecov.io/bash) -C "$(git log --format="%H" -n 1)"
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue