From 63aa3efb1158a8d155eae968ff0a5b093bb8aa3d Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Tue, 24 Jan 2017 20:49:25 +0100 Subject: [PATCH] Added glide for vendoring dependencies. - Docker to 1.13.x --- .gitignore | 2 + CONTRIBUTING.md | 22 ++---- circle.yml | 2 + container/trust.go | 12 +-- glide.lock | 186 +++++++++++++++++++++++++++++++++++++++++++++ glide.yaml | 28 +++++++ 6 files changed, 229 insertions(+), 23 deletions(-) create mode 100644 glide.lock create mode 100644 glide.yaml diff --git a/.gitignore b/.gitignore index 03e7faa..40e981a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ watchtower +vendor +.glide \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d75c60..3d427fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,21 +16,9 @@ cd watchtower ## Building and testing watchtower is a go application and is built with go commands. The following commands assume that you are at the root level of your repo. ```bash -go get ./... # analyzes and retrieves package dependencies -go build # compiles and packages an executable binary, watchtower -go test # runs tests -./watchtower # runs the application (outside of a container) +go get -u github.com/Masterminds/glide # installs glide for vendoring +glide install # retrieves package dependencies +go build # compiles and packages an executable binary, watchtower +go test # runs tests +./watchtower # runs the application (outside of a container) ``` - -### Building the docker image -watchtower is packaged and distributed as a docker image. A [golang-builder](https://github.com/CenturyLinkLabs/golang-builder) is used to package the go code and its -dependencies as a minimally-sized application. The application binary is then layered into to a minimal docker image (see `Dockerfile`), so that the entire image is <10MB. -See `circle.yml` for further details.The following commands assume that you are at the root level of your repo (i.e. `watchtower/`). - -```bash -docker pull centurylink/golang-builder:latest # download the builder -docker run -v $(pwd):/src centurylink/golang-builder:latest # build the minimal binary -docker build -t /watchtower:latest . # build the docker image -docker run -v /var/run/docker.sock:/var/run/docker.sock /watchtower # run the application (inside of a container) -``` - diff --git a/circle.yml b/circle.yml index d854e4c..cd239b4 100644 --- a/circle.yml +++ b/circle.yml @@ -5,7 +5,9 @@ machine: dependencies: override: - docker pull centurylink/golang-builder:latest + - go get -u github.com/Masterminds/glide test: override: + - glide install - docker run -v $(pwd):/src centurylink/golang-builder:latest --test diff --git a/container/trust.go b/container/trust.go index b064032..a472649 100644 --- a/container/trust.go +++ b/container/trust.go @@ -4,13 +4,14 @@ import ( "errors" "os" "strings" + log "github.com/Sirupsen/logrus" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/reference" "github.com/docker/docker/cli/command" - "github.com/docker/docker/cli/config" - "github.com/docker/docker/cli/config/configfile" - "github.com/docker/docker/cli/config/credentials" + "github.com/docker/docker/cliconfig" + "github.com/docker/docker/cliconfig/configfile" + "github.com/docker/docker/cliconfig/credentials" ) /** @@ -35,7 +36,7 @@ func EncodedEnvAuth(ref string) (string, error) { username := os.Getenv("REPO_USER") password := os.Getenv("REPO_PASS") if username != "" && password != "" { - auth := types.AuthConfig { + auth := types.AuthConfig{ Username: username, Password: password, } @@ -58,7 +59,7 @@ func EncodedConfigAuth(ref string) (string, error) { if configDir == "" { configDir = "/" } - configFile, err := config.Load(configDir) + configFile, err := cliconfig.Load(configDir) if err != nil { log.Errorf("Unable to find default config file %s", err) return "", err @@ -80,7 +81,6 @@ func ParseServerAddress(ref string) (string, error) { } parts := strings.Split(repository, "/") return parts[0], nil - } // CredentialsStore returns a new credentials store based diff --git a/glide.lock b/glide.lock new file mode 100644 index 0000000..7ae50d9 --- /dev/null +++ b/glide.lock @@ -0,0 +1,186 @@ +hash: 9ddd729b207d71ce16ae9a0282ac87a046b9161ac4f15b108e86a03367172516 +updated: 2017-01-24T20:45:43.1914053+01:00 +imports: +- name: github.com/Azure/go-ansiterm + version: 388960b655244e76e24c75f48631564eaefade62 + subpackages: + - winterm +- name: github.com/davecgh/go-spew + version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 + subpackages: + - spew +- name: github.com/docker/distribution + version: 28602af35aceda2f8d571bad7ca37a54cf0250bc + subpackages: + - context + - digest + - reference + - registry/api/errcode + - registry/api/v2 + - registry/client + - registry/client/auth + - registry/client/auth/challenge + - registry/client/transport + - registry/storage/cache + - registry/storage/cache/memory + - uuid +- name: github.com/docker/docker + version: 49bf474f9ed7ce7143a59d1964ff7b7fd9b52178 + subpackages: + - api + - api/server/httputils + - api/types + - api/types/blkiodev + - api/types/container + - api/types/events + - api/types/filters + - api/types/mount + - api/types/network + - api/types/reference + - api/types/registry + - api/types/strslice + - api/types/swarm + - api/types/time + - api/types/versions + - api/types/volume + - cli/command + - cli/flags + - cliconfig + - cliconfig/configfile + - cliconfig/credentials + - client + - daemon/graphdriver + - dockerversion + - image + - image/v1 + - layer + - oci + - opts + - pkg/archive + - pkg/chrootarchive + - pkg/fileutils + - pkg/homedir + - pkg/httputils + - pkg/idtools + - pkg/ioutils + - pkg/jsonlog + - pkg/jsonmessage + - pkg/longpath + - pkg/mount + - pkg/parsers/kernel + - pkg/plugingetter + - pkg/plugins + - pkg/plugins/transport + - pkg/pools + - pkg/promise + - pkg/random + - pkg/reexec + - pkg/stringid + - pkg/system + - pkg/tarsum + - pkg/term + - pkg/term/windows + - pkg/tlsconfig + - pkg/useragent + - plugin/v2 + - reference + - registry +- name: github.com/docker/docker-credential-helpers + version: f72c04f1d8e71959a6d103f808c50ccbad79b9fd + subpackages: + - client + - credentials +- name: github.com/docker/go-connections + version: 4ccf312bf1d35e5dbda654e57a9be4c3f3cd0366 + subpackages: + - nat + - sockets + - tlsconfig +- name: github.com/docker/go-units + version: 8a7beacffa3009a9ac66bad506b18ffdd110cf97 +- name: github.com/docker/libtrust + version: 9cbd2a1374f46905c68a4eb3694a130610adc62a +- name: github.com/golang/protobuf + version: 1f49d83d9aa00e6ce4fc8258c71cc7786aec968a + subpackages: + - proto +- name: github.com/gorilla/context + version: 1ea25387ff6f684839d82767c1733ff4d4d15d0a +- name: github.com/gorilla/mux + version: 0eeaf8392f5b04950925b8a69fe70f110fa7cbfc +- name: github.com/inconshreveable/mousetrap + version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 +- name: github.com/mattn/go-shellwords + version: f4e566c536cf69158e808ec28ef4182a37fdc981 +- name: github.com/Microsoft/go-winio + version: 24a3e3d3fc7451805e09d11e11e95d9a0a4f205e +- name: github.com/opencontainers/runc + version: 2f7393a47307a16f8cee44a37b262e8b81021e3e + repo: https://github.com/docker/runc.git + subpackages: + - libcontainer/configs + - libcontainer/devices + - libcontainer/system + - libcontainer/user +- name: github.com/opencontainers/runtime-spec + version: 1c7c27d043c2a5e513a44084d2b10d77d1402b8c + subpackages: + - specs-go +- name: github.com/pkg/errors + version: 839d9e913e063e28dfd0e6c7b7512793e0a48be9 +- name: github.com/pmezard/go-difflib + version: d8ed2627bdf02c080bf22230dbb337003b7aba2d + subpackages: + - difflib +- name: github.com/robfig/cron + version: 9585fd555638e77bba25f25db5c44b41f264aeb7 +- name: github.com/Sirupsen/logrus + version: d26492970760ca5d33129d2d799e34be5c4782eb +- name: github.com/spf13/cobra + version: a3c09249f1a24a9d951f2738fb9b9256b8b42fa5 + repo: https://github.com/dnephin/cobra.git +- name: github.com/spf13/pflag + version: dabebe21bf790f782ea4c7bbd2efc430de182afd +- name: github.com/stretchr/objx + version: cbeaeb16a013161a98496fad62933b1d21786672 +- name: github.com/stretchr/testify + version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 + subpackages: + - assert + - mock +- name: github.com/urfave/cli + version: 0bdeddeeb0f650497d603c4ad7b20cfe685682f6 +- name: github.com/vbatts/tar-split + version: d3f1b54304d656376e58f9406a9cb4775799a357 + subpackages: + - archive/tar + - tar/asm + - tar/storage +- name: golang.org/x/net + version: 2beffdc2e92c8a3027590f898fe88f69af48a3f8 + repo: https://github.com/tonistiigi/net.git + subpackages: + - context + - context/ctxhttp + - http2 + - http2/hpack + - internal/timeseries + - proxy + - trace +- name: golang.org/x/sys + version: 8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9 + subpackages: + - unix + - windows +- name: google.golang.org/grpc + version: b1a2821ca5a4fd6b6e48ddfbb7d6d7584d839d21 + subpackages: + - codes + - credentials + - grpclog + - internal + - metadata + - naming + - peer + - transport +testImports: [] diff --git a/glide.yaml b/glide.yaml new file mode 100644 index 0000000..18be0e1 --- /dev/null +++ b/glide.yaml @@ -0,0 +1,28 @@ +package: github.com/stffabi/watchtower +import: +- package: github.com/Sirupsen/logrus + version: ~0.11.x +- package: github.com/docker/docker + version: ~1.13.x + subpackages: + - api/types + - api/types/container + - api/types/network + - api/types/reference + - cli/command + - cliconfig + - cliconfig/configfile + - cliconfig/credentials + - client +- package: github.com/stretchr/testify + version: ~1.1.4 + subpackages: + - mock +- package: github.com/urfave/cli + version: ~1.19.1 +- package: golang.org/x/net + repo: https://github.com/tonistiigi/net.git + subpackages: + - context +- package: github.com/robfig/cron + version: 9585fd555638e77bba25f25db5c44b41f264aeb7