diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 0000000..f6bfc65 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,130 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/auth0-community/go-auth0" + packages = ["."] + revision = "3de339a55934c49fa256181e63b9ecf0234c15b7" + +[[projects]] + name = "github.com/davecgh/go-spew" + packages = ["spew"] + revision = "6d212800a42e8ab5c146b8ace3490ee17e5225f9" + +[[projects]] + branch = "master" + name = "github.com/gin-contrib/sse" + packages = ["."] + revision = "22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae" + +[[projects]] + name = "github.com/gin-gonic/gin" + packages = [".","binding","render"] + revision = "d459835d2b077e44f7c9b453505ee29881d5d12d" + version = "v1.2" + +[[projects]] + name = "github.com/go-errors/errors" + packages = ["."] + revision = "8fa88b06e5974e97fbf9899a7f86a344bfd1f105" + +[[projects]] + name = "github.com/golang/protobuf" + packages = ["proto"] + revision = "130e6b02ab059e7b717a096f397c5b60111cae74" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/golang-lru" + packages = [".","simplelru"] + revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6" + +[[projects]] + name = "github.com/mattn/go-isatty" + packages = ["."] + revision = "a5cdd64afdee435007ee3e9f6ed4684af949d568" + +[[projects]] + name = "github.com/ory/ladon" + packages = [".","compiler","manager/memory"] + revision = "8128aeca0a774620b4f3be9fb2a1f7c53eac662c" + version = "v0.8.5" + +[[projects]] + name = "github.com/pborman/uuid" + packages = ["."] + revision = "e790cca94e6cc75c7064b1332e63811d4aae1a53" + version = "v1.1" + +[[projects]] + name = "github.com/pkg/errors" + packages = ["."] + revision = "645ef00459ed84a119197bfb8d8205042c6df63d" + version = "v0.8.0" + +[[projects]] + name = "github.com/pmezard/go-difflib" + packages = ["difflib"] + revision = "d8ed2627bdf02c080bf22230dbb337003b7aba2d" + +[[projects]] + name = "github.com/sirupsen/logrus" + packages = ["."] + revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e" + version = "v1.0.3" + +[[projects]] + name = "github.com/stretchr/objx" + packages = ["."] + revision = "cbeaeb16a013161a98496fad62933b1d21786672" + +[[projects]] + name = "github.com/stretchr/testify" + packages = ["assert","mock","require"] + revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0" + version = "v1.1.4" + +[[projects]] + name = "github.com/ugorji/go" + packages = ["codec"] + revision = "54210f4e076c57f351166f0ed60e67d3fca57a36" + +[[projects]] + branch = "master" + name = "go.mozilla.org/mozlogrus" + packages = ["."] + revision = "a4ca0c1ee1cb5e580348b1e1aac9bd3e5f07f26d" + +[[projects]] + name = "golang.org/x/crypto" + packages = ["ed25519","ed25519/internal/edwards25519","ssh/terminal"] + revision = "9419663f5a44be8b34ca85f08abc5fe1be11f8a3" + +[[projects]] + name = "golang.org/x/sys" + packages = ["unix","windows"] + revision = "6faef541c73732f438fb660a212750a9ba9f9362" + +[[projects]] + name = "gopkg.in/go-playground/validator.v8" + packages = ["."] + revision = "5f1438d3fca68893a817e4a66806cea46a9e4ebf" + version = "v8.18.2" + +[[projects]] + name = "gopkg.in/square/go-jose.v2" + packages = [".","cipher","json","jwt"] + revision = "f8f38de21b4dcd69d0413faf231983f5fd6634b1" + version = "v2.1.3" + +[[projects]] + name = "gopkg.in/yaml.v2" + packages = ["."] + revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "07a2200fcb41c7086e2701672735d5624f415b92ef410fbca16ef98a5169ec46" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 0000000..481f003 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,45 @@ +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + + +[[constraint]] + name = "github.com/gin-gonic/gin" + version = "1.2.0" + +[[constraint]] + name = "github.com/ory/ladon" + version = "0.8.5" + +[[constraint]] + name = "github.com/sirupsen/logrus" + version = "1.0.3" + +[[constraint]] + name = "github.com/stretchr/testify" + version = "1.1.4" + +[[constraint]] + branch = "master" + name = "go.mozilla.org/mozlogrus" + +[[constraint]] + name = "gopkg.in/square/go-jose.v2" + version = "2.1.3" diff --git a/Makefile b/Makefile index 9e818f7..352f0ef 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,33 @@ GO_LINT := $(GOPATH)/bin/golint -GO_GLIDE := $(GOPATH)/bin/glide +GO_DEP := $(GOPATH)/bin/dep GO_BINDATA := $(GOPATH)/bin/go-bindata +GO_PACKAGE := $(GOPATH)/src/github.com/mozilla/doorman DATA_FILES := ./utilities/openapi.yaml ./utilities/contribute.yaml SRC := *.go ./config/*.go ./utilities/*.go ./doorman/*.go PACKAGES := ./ ./config/ ./utilities/ ./doorman/ -main: vendor utilities/bindata.go $(SRC) +main: vendor utilities/bindata.go $(SRC) $(GO_PACKAGE) CGO_ENABLED=0 go build -o main *.go clean: rm -f main coverage.txt utilities/bindata.go vendor -vendor: $(GO_GLIDE) glide.lock glide.yaml - $(GO_GLIDE) install +$(GOPATH): + mkdir -p $(GOPATH) -$(GO_GLIDE): - go get github.com/Masterminds/glide +$(GO_PACKAGE): $(GOPATH) + mkdir -p $(shell dirname ${GO_PACKAGE}) + if [ ! -e $(GOPACKAGE) ]; then ln -sf $$PWD $(GO_PACKAGE); fi -$(GO_BINDATA): +$(GO_DEP): $(GOPATH) $(GO_PACKAGE) + go get -u github.com/golang/dep/cmd/dep + +$(GO_BINDATA): $(GOPATH) go get github.com/jteeuwen/go-bindata/... +vendor: $(GO_DEP) Gopkg.lock Gopkg.toml + $(GO_DEP) ensure + utilities/bindata.go: $(GO_BINDATA) $(DATA_FILES) $(GO_BINDATA) -o utilities/bindata.go -pkg utilities $(DATA_FILES) diff --git a/circle.yml b/circle.yml index 5fef66c..066a249 100644 --- a/circle.yml +++ b/circle.yml @@ -6,22 +6,50 @@ # DOCKER_PASS # machine: + environment: + + # make some env vars to save typing + # GWS should already exists on the ubuntu trusty build image + GWS: "$HOME/.go_workspace" + A: "$GWS/src/github.com/$CIRCLE_PROJECT_USERNAME" + B: "$A/$CIRCLE_PROJECT_REPONAME" + + # Use to install Custom golang from https://golang.org/dl/ + GODIST: "go1.9.linux-amd64.tar.gz" + GODIST_HASH: "d70eadefce8e160638a9a6db97f7192d8463069ab33138893ad3bf31b0650a79" + services: - docker + # install custom golang + post: + - mkdir -p download + - test -e download/$GODIST || curl -o download/$GODIST https://storage.googleapis.com/golang/$GODIST + # verify it + - echo "$GODIST_HASH download/$GODIST" | sha256sum -c + - sudo rm -rf /usr/local/go + + - sudo tar -C /usr/local -xzf download/$GODIST + dependencies: cache_directories: - "~/docker" + - "~/download" pre: - sudo apt-get update; sudo apt-get install pigz override: + - mkdir -p $GWS/pkg $GWS/bin $A + - ln -fs $HOME/$CIRCLE_PROJECT_REPONAME $A + + - echo 'export GOPATH=$GWS' >> ~/.circlerc + - docker info # Build the container, using Circle's Docker cache. Only use 1 image per # day to keep the cache size down. - - I="image-$(date +%j).gz"; if [[ -e ~/docker/$I ]]; then echo "Loading $I"; pigz -d -c ~/docker/$I | docker load; fi + - I="image-$(date +%j).gz"; if [ -e "~/docker/$I" ]; then echo "Loading $I"; pigz -d -c "~/docker/$I" | docker load || rm -f "~/docker/$I"; fi # create a version.json - > @@ -35,11 +63,18 @@ dependencies: > version.json # build the actual deployment container + - go version + - cd "$B" && make - docker build --pull -t app . # Clean up any old images; save the new one. - I="image-$(date +%j).gz"; mkdir -p ~/docker; rm ~/docker/*; docker save app | pigz --fast -c > ~/docker/$I; ls -l ~/docker +test: + override: + - git checkout version.json + - cd "$B" && make test + # appropriately tag and push the container to dockerhub deployment: hub_latest: diff --git a/glide.lock b/glide.lock deleted file mode 100644 index bc5065e..0000000 --- a/glide.lock +++ /dev/null @@ -1,83 +0,0 @@ -hash: ae50f8a875f9a6ba47924fc6d6b3824fe768c3558c881cc5fa085bfe352d0e86 -updated: 2017-11-14T16:52:11.280879928+01:00 -imports: -- name: github.com/auth0-community/go-auth0 - version: 3de339a55934c49fa256181e63b9ecf0234c15b7 -- name: github.com/davecgh/go-spew - version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 - subpackages: - - spew -- name: github.com/gin-contrib/sse - version: 22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae -- name: github.com/gin-gonic/gin - version: d459835d2b077e44f7c9b453505ee29881d5d12d - subpackages: - - binding - - render -- name: github.com/go-errors/errors - version: 8fa88b06e5974e97fbf9899a7f86a344bfd1f105 -- name: github.com/golang/protobuf - version: 130e6b02ab059e7b717a096f397c5b60111cae74 - subpackages: - - proto -- name: github.com/hashicorp/golang-lru - version: 0a025b7e63adc15a622f29b0b2c4c3848243bbf6 - subpackages: - - simplelru -- name: github.com/jteeuwen/go-bindata - version: bbd0c6e271208dce66d8fda4bc536453cd27fc4a - subpackages: - - '...' -- name: github.com/mattn/go-isatty - version: a5cdd64afdee435007ee3e9f6ed4684af949d568 -- name: github.com/ory/ladon - version: 8128aeca0a774620b4f3be9fb2a1f7c53eac662c - subpackages: - - compiler - - manager/memory -- name: github.com/pborman/uuid - version: e790cca94e6cc75c7064b1332e63811d4aae1a53 -- name: github.com/pkg/errors - version: 645ef00459ed84a119197bfb8d8205042c6df63d -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/sirupsen/logrus - version: f006c2ac4710855cf0f916dd6b77acf6b048dc6e -- name: github.com/stretchr/testify - version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 - subpackages: - - assert - - mock - - require -- name: github.com/ugorji/go - version: 54210f4e076c57f351166f0ed60e67d3fca57a36 - subpackages: - - codec -- name: go.mozilla.org/mozlogrus - version: a4ca0c1ee1cb5e580348b1e1aac9bd3e5f07f26d -- name: golang.org/x/crypto - version: 9419663f5a44be8b34ca85f08abc5fe1be11f8a3 - subpackages: - - ed25519 - - ed25519/internal/edwards25519 - - ssh/terminal -- name: golang.org/x/sys - version: 6faef541c73732f438fb660a212750a9ba9f9362 - subpackages: - - unix - - windows -- name: gopkg.in/go-playground/validator.v8 - version: 5f1438d3fca68893a817e4a66806cea46a9e4ebf -- name: gopkg.in/square/go-jose.v2 - version: f8f38de21b4dcd69d0413faf231983f5fd6634b1 - subpackages: - - cipher - - json - - jwt -- name: gopkg.in/yaml.v2 - version: eb3733d160e74a9c7e442f435eb3bea458e1d19f -testImports: -- name: github.com/stretchr/objx - version: cbeaeb16a013161a98496fad62933b1d21786672 diff --git a/glide.yaml b/glide.yaml deleted file mode 100644 index aadd1ed..0000000 --- a/glide.yaml +++ /dev/null @@ -1,24 +0,0 @@ -package: github.com/mozilla/doorman -import: -- package: github.com/gin-gonic/gin - version: ^1.2.0 -- package: gopkg.in/yaml.v2 -- package: github.com/stretchr/testify - version: ^1.1.4 - subpackages: - - assert - - require -- package: github.com/sirupsen/logrus - version: ^1.0.3 -- package: go.mozilla.org/mozlogrus -- package: github.com/ory/ladon - version: ~0.8.5 -- package: github.com/hashicorp/golang-lru -- package: github.com/jteeuwen/go-bindata - version: ^3.0.7 - subpackages: - - '...' -- package: github.com/auth0-community/go-auth0 -- package: gopkg.in/square/go-jose.v2 - version: ^2.1.3 -- package: github.com/go-errors/errors