Enable dependency validation
Re-enable dependency validation using vndr instead of godep Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
a685e3fc98
commit
acad7c43a8
3 changed files with 15 additions and 29 deletions
|
@ -71,9 +71,7 @@ commands, such as `go test`, should work per package (please see
|
||||||
A `Makefile` has been provided as a convenience to support repeatable builds.
|
A `Makefile` has been provided as a convenience to support repeatable builds.
|
||||||
Please install the following into `GOPATH` for it to work:
|
Please install the following into `GOPATH` for it to work:
|
||||||
|
|
||||||
go get github.com/tools/godep github.com/golang/lint/golint
|
go get github.com/golang/lint/golint
|
||||||
|
|
||||||
**TODO(stevvooe):** Add a `make setup` command to Makefile to run this. Have to think about how to interact with Godeps properly.
|
|
||||||
|
|
||||||
Once these commands are available in the `GOPATH`, run `make` to get a full
|
Once these commands are available in the `GOPATH`, run `make` to get a full
|
||||||
build:
|
build:
|
||||||
|
@ -105,8 +103,8 @@ build:
|
||||||
+ /Users/sday/go/src/github.com/docker/distribution/bin/registry-api-descriptor-template
|
+ /Users/sday/go/src/github.com/docker/distribution/bin/registry-api-descriptor-template
|
||||||
+ binaries
|
+ binaries
|
||||||
|
|
||||||
The above provides a repeatable build using the contents of the vendored
|
The above provides a repeatable build using the contents of the vendor
|
||||||
Godeps directory. This includes formatting, vetting, linting, building,
|
directory. This includes formatting, vetting, linting, building,
|
||||||
testing and generating tagged binaries. We can verify this worked by running
|
testing and generating tagged binaries. We can verify this worked by running
|
||||||
the registry binary generated in the "./bin" directory:
|
the registry binary generated in the "./bin" directory:
|
||||||
|
|
||||||
|
|
23
Makefile
23
Makefile
|
@ -35,7 +35,7 @@ PKGS=$(shell go list -tags "${DOCKER_BUILDTAGS}" ./... | grep -v ^github.com/doc
|
||||||
|
|
||||||
# Resolving binary dependencies for specific targets
|
# Resolving binary dependencies for specific targets
|
||||||
GOLINT=$(shell which golint || echo '')
|
GOLINT=$(shell which golint || echo '')
|
||||||
GODEP=$(shell which godep || echo '')
|
VNDR=$(shell which vndr || echo '')
|
||||||
|
|
||||||
${PREFIX}/bin/registry: $(GOFILES)
|
${PREFIX}/bin/registry: $(GOFILES)
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
|
@ -86,24 +86,13 @@ clean:
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
@rm -rf "${PREFIX}/bin/registry" "${PREFIX}/bin/digest" "${PREFIX}/bin/registry-api-descriptor-template"
|
@rm -rf "${PREFIX}/bin/registry" "${PREFIX}/bin/digest" "${PREFIX}/bin/registry-api-descriptor-template"
|
||||||
|
|
||||||
dep-save:
|
dep-validate:
|
||||||
@echo "+ $@"
|
|
||||||
$(if $(GODEP), , \
|
|
||||||
$(error Please install godep: go get github.com/tools/godep))
|
|
||||||
@$(GODEP) save $(PKGS)
|
|
||||||
|
|
||||||
dep-restore:
|
|
||||||
@echo "+ $@"
|
|
||||||
$(if $(GODEP), , \
|
|
||||||
$(error Please install godep: go get github.com/tools/godep))
|
|
||||||
@$(GODEP) restore -v
|
|
||||||
|
|
||||||
dep-validate: dep-restore
|
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
|
$(if $(VNDR), , \
|
||||||
|
$(error Please install vndr: go get github.com/lk4d4/vndr))
|
||||||
@rm -Rf .vendor.bak
|
@rm -Rf .vendor.bak
|
||||||
@mv vendor .vendor.bak
|
@mv vendor .vendor.bak
|
||||||
@rm -Rf Godeps
|
@$(VNDR)
|
||||||
@$(GODEP) save ./...
|
|
||||||
@test -z "$$(diff -r vendor .vendor.bak 2>&1 | tee /dev/stderr)" || \
|
@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)
|
(echo >&2 "+ inconsistent dependencies! what you have in vendor.conf does not match with what you have in vendor" && false)
|
||||||
@rm -Rf .vendor.bak
|
@rm -Rf .vendor.bak
|
||||||
|
|
13
circle.yml
13
circle.yml
|
@ -34,7 +34,7 @@ dependencies:
|
||||||
|
|
||||||
override:
|
override:
|
||||||
# Install dependencies for every copied clone/go version
|
# Install dependencies for every copied clone/go version
|
||||||
- gvm use stable && go get github.com/tools/godep:
|
- gvm use stable && go get github.com/lk4d4/vndr:
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
post:
|
post:
|
||||||
|
@ -49,14 +49,13 @@ test:
|
||||||
# - gvm use old && go version
|
# - gvm use old && go version
|
||||||
- gvm use stable && go version
|
- gvm use stable && go version
|
||||||
|
|
||||||
# todo(richard): replace with a more robust vendoring solution. Removed due to a fundamental disagreement in godep philosophies.
|
|
||||||
# Ensure validation of dependencies
|
# Ensure validation of dependencies
|
||||||
# - gvm use stable && if test -n "`git diff --stat=1000 master | grep -Ei \"vendor|godeps\"`"; then make dep-validate; fi:
|
- gvm use stable && if test -n "`git diff --stat=1000 master | grep -E \"^[[:space:]]*vendor\"`"; then make dep-validate; fi:
|
||||||
# pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
# First thing: build everything. This will catch compile errors, and it's
|
# First thing: build everything. This will catch compile errors, and it's
|
||||||
# also necessary for go vet to work properly (see #807).
|
# also necessary for go vet to work properly (see #807).
|
||||||
- gvm use stable && godep go install $(go list ./... | grep -v "/vendor/"):
|
- gvm use stable && go install $(go list ./... | grep -v "/vendor/"):
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
# FMT
|
# FMT
|
||||||
|
@ -73,12 +72,12 @@ test:
|
||||||
|
|
||||||
override:
|
override:
|
||||||
# Test stable, and report
|
# Test stable, and report
|
||||||
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; godep go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/$PACKAGE/coverage.out -coverpkg=$(./coverpkg.sh $PACKAGE $ROOT_PACKAGE) $PACKAGE':
|
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/$PACKAGE/coverage.out -coverpkg=$(./coverpkg.sh $PACKAGE $ROOT_PACKAGE) $PACKAGE':
|
||||||
timeout: 1000
|
timeout: 1000
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
# Test stable with race
|
# Test stable with race
|
||||||
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | grep -v "registry/handlers" | grep -v "registry/storage/driver" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; godep go test -race -tags "$DOCKER_BUILDTAGS" -test.short $PACKAGE':
|
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | grep -v "registry/handlers" | grep -v "registry/storage/driver" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; go test -race -tags "$DOCKER_BUILDTAGS" -test.short $PACKAGE':
|
||||||
timeout: 1000
|
timeout: 1000
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
post:
|
post:
|
||||||
|
|
Loading…
Reference in a new issue