From 59401e277b15d0676c2d958bdddd318a44c1da64 Mon Sep 17 00:00:00 2001 From: Olivier Gambier Date: Mon, 21 Mar 2016 18:04:27 -0700 Subject: [PATCH] Dependency validation enforce Signed-off-by: Olivier Gambier --- .drone.yml | 38 -------------------------------------- Makefile | 15 +++++++++++++-- circle.yml | 4 ++++ 3 files changed, 17 insertions(+), 40 deletions(-) delete mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index d943e19ff..000000000 --- a/.drone.yml +++ /dev/null @@ -1,38 +0,0 @@ -image: dmp42/go:stable - -script: - # To be spoofed back into the test image - - go get github.com/modocache/gover - - - go get -t ./... - - # Go fmt - - test -z "$(gofmt -s -l -w . | tee /dev/stderr)" - # Go lint - - test -z "$(golint ./... | tee /dev/stderr)" - # Go vet - - go vet ./... - # Go test - - go test -v -race -cover ./... - # Helper to concatenate reports - - gover - # Send to coverall - - goveralls -service drone.io -coverprofile=gover.coverprofile -repotoken {{COVERALLS_TOKEN}} - - # Do we want these as well? - # - go get code.google.com/p/go.tools/cmd/goimports - # - test -z "$(goimports -l -w ./... | tee /dev/stderr)" - # http://labix.org/gocheck - -notify: - email: - recipients: - - distribution@docker.com - - slack: - team: docker - channel: "#dt" - username: mom - token: {{SLACK_TOKEN}} - on_success: true - on_failure: true diff --git a/Makefile b/Makefile index de8c0a41b..689696ac8 100644 --- a/Makefile +++ b/Makefile @@ -87,11 +87,22 @@ clean: @rm -rf "${PREFIX}/bin/registry" "${PREFIX}/bin/digest" "${PREFIX}/bin/registry-api-descriptor-template" dep-save: + @echo "+ $@" $(if $(GODEP), , \ $(error Please install godep: go get github.com/tools/godep)) - $(GODEP) save $(PKGS) + @$(GODEP) save $(PKGS) dep-restore: + @echo "+ $@" $(if $(GODEP), , \ $(error Please install godep: go get github.com/tools/godep)) - $(GODEP) restore -v \ No newline at end of file + @$(GODEP) restore -v + +dep-validate: dep-restore + @echo "+ $@" + @rm -Rf .vendor.bak + @mv vendor .vendor.bak + @rm -Rf Godeps + @$(GODEP) save ./... + @test -z "$$(diff -r vendor .vendor.bak 2>&1 | tee /dev/stderr)" || \ + (echo >&2 "+ borked dependencies! what you have in Godeps/Godeps.json does not match with what you have in vendor" && false) diff --git a/circle.yml b/circle.yml index f0e753c75..9832ac794 100644 --- a/circle.yml +++ b/circle.yml @@ -49,6 +49,10 @@ test: # - gvm use old && go version - gvm use stable && go version + # Ensure validation of dependencies + - gvm use stable && make dep-validate: + pwd: $BASE_STABLE + # First thing: build everything. This will catch compile errors, and it's # also necessary for go vet to work properly (see #807). - gvm use stable && godep go install $(go list ./... | grep -v "/vendor/"):