diff --git a/.gitignore b/.gitignore index 4094126..6d55f9c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ mesos-consul build/ .idea/ + +vendor +bin/ diff --git a/.travis.yml b/.travis.yml index 068525e..5d33905 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,15 @@ language: go go: - - 1.6 + - 1.7.x - tip -install: go get -v -t ./.... +go_import_path: github.com/CiscoCloud/mesos-consul -script: go test -v ./... +install: + - go get -v github.com/Masterminds/glide + - cd $GOPATH/src/github.com/Masterminds/glide && git checkout tags/v0.12.3 && go install && cd - + - glide install + - make vendor + +script: make test diff --git a/Dockerfile b/Dockerfile index 725b134..71cd559 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,13 @@ -FROM gliderlabs/alpine:3.1 +FROM golang:1.7.5-alpine3.5 MAINTAINER Chris Aubuchon COPY . /go/src/github.com/CiscoCloud/mesos-consul -RUN apk add --update go git mercurial \ +RUN apk add --update make git glide \ && cd /go/src/github.com/CiscoCloud/mesos-consul \ - && export GOPATH=/go \ - && go get \ + && make vendor \ && go build -o /bin/mesos-consul \ && rm -rf /go \ - && apk del --purge go git mercurial + && apk del --purge make git glide ENTRYPOINT [ "/bin/mesos-consul" ] diff --git a/Makefile b/Makefile index 10265a8..2a35edb 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,19 @@ -TEST?=./... +TEST?=$$(glide nv) NAME = $(shell awk -F\" '/^const Name/ { print $$2 }' main.go) VERSION = $(shell awk -F\" '/^const Version/ { print $$2 }' main.go) DEPS = $(shell go list -f '{{range .TestImports}}{{.}} {{end}}' ./...) -all: deps build +all: build -deps: - go get -d -v ./... - echo $(DEPS) | xargs -n1 go get -d - -updatedeps: - go get -u -v ./... - echo $(DEPS) | xargs -n1 go get -d - -build: deps +build: @mkdir -p bin/ go build -o bin/$(NAME) -test: deps +test: go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4 go vet $(TEST) -xcompile: deps test +xcompile: test @rm -rf build/ @mkdir -p build gox \ @@ -42,4 +34,11 @@ package: xcompile echo $$f; \ done -.PHONY: all deps updatedeps build test xcompile package +vendor: + glide install --strip-vendor + glide update --strip-vendor + +vendor-clean: + -rm -rf vendor/ + +.PHONY: all updatedeps build test xcompile package vendor vendor-clean diff --git a/glide.lock b/glide.lock new file mode 100644 index 0000000..b8c8fba --- /dev/null +++ b/glide.lock @@ -0,0 +1,44 @@ +hash: 7afd14062efc92eb00fbac34aa5cc20a0f4a60eb08ae763fdcbeaa3d34da4a8a +updated: 2017-04-03T15:24:09.796014116-05:00 +imports: +- name: github.com/gogo/protobuf + version: d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8 + subpackages: + - proto +- name: github.com/golang/glog + version: 23def4e6c14b4da8ac2ed8007337bc5eb5007998 +- name: github.com/hashicorp/consul + version: 9103e77f574254016406ee512d601ad6de6e1efd + subpackages: + - api +- name: github.com/hashicorp/go-cleanhttp + version: ad28ea4487f05916463e2423a55166280e8254b5 +- name: github.com/hashicorp/serf + version: f679d7594a349263f6118db40d87122d3a474e7d + subpackages: + - coordinate +- name: github.com/mesos/mesos-go + version: 7228b13084ce3ea645dbf7c8ecb5704301a6eadf + subpackages: + - detector + - detector/zoo + - mesosproto + - mesosutil + - upid +- name: github.com/ogier/pflag + version: 45c278ab3607870051a2ea9040bb85fcb8557481 +- name: github.com/samuel/go-zookeeper + version: 1d7be4effb13d2d908342d349d71a284a7542693 + subpackages: + - zk +- name: github.com/sirupsen/logrus + version: 7f4b1adc791766938c29457bed0703fb9134421a +- name: golang.org/x/net + version: b4690f45fa1cafc47b1c280c2e75116efe40cc13 + subpackages: + - context +- name: golang.org/x/sys + version: 30237cf4eefd639b184d1f2cb77a581ea0be8947 + subpackages: + - unix +testImports: [] diff --git a/glide.yaml b/glide.yaml new file mode 100644 index 0000000..e3ac43b --- /dev/null +++ b/glide.yaml @@ -0,0 +1,14 @@ +package: github.com/CiscoCloud/mesos-consul +import: +- package: github.com/hashicorp/consul + subpackages: + - api +- package: github.com/mesos/mesos-go + version: mesos-0.26.0 + subpackages: + - detector + - detector/zoo + - mesosproto + - upid +- package: github.com/ogier/pflag +- package: github.com/sirupsen/logrus diff --git a/mesos/mesos.go b/mesos/mesos.go index 7c59eeb..cd4fa19 100644 --- a/mesos/mesos.go +++ b/mesos/mesos.go @@ -13,16 +13,10 @@ import ( "github.com/CiscoCloud/mesos-consul/registry" "github.com/CiscoCloud/mesos-consul/state" - consulapi "github.com/hashicorp/consul/api" proto "github.com/mesos/mesos-go/mesosproto" log "github.com/sirupsen/logrus" ) -type CacheEntry struct { - service *consulapi.AgentServiceRegistration - isRegistered bool -} - type Mesos struct { Registry registry.Registry Agents map[string]string