From 5d16df9f6da517e25bf82bc8e64608535d442da2 Mon Sep 17 00:00:00 2001 From: Connor McCormick <22061955+cnrmck@users.noreply.github.com> Date: Mon, 16 Jul 2018 17:53:44 +0000 Subject: [PATCH 01/20] Fix confusing word --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5bc2100..84d7062 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ docker run -d \ v2tec/watchtower container_to_watch --debug ``` -If you mount the config file as described below, be sure to also prepend the url for the registry when starting up your watched image (you can omit the https://). Here is a complete docker-compose.yml file that starts up a docker container from a private repo at dockerhub and monitors it with watchtower. Note the command argument changing the interval to 30s rather than the default 5 minutes. +If you mount the config file as described above, be sure to also prepend the url for the registry when starting up your watched image (you can omit the https://). Here is a complete docker-compose.yml file that starts up a docker container from a private repo at dockerhub and monitors it with watchtower. Note the command argument changing the interval to 30s rather than the default 5 minutes. ```json version: "3" @@ -93,7 +93,7 @@ docker run --rm v2tec/watchtower --help * `--host, -h` Docker daemon socket to connect to. Defaults to "unix:///var/run/docker.sock" but can be pointed at a remote Docker host by specifying a TCP endpoint as "tcp://hostname:port". The host value can also be provided by setting the `DOCKER_HOST` environment variable. * `--interval, -i` Poll interval (in seconds). This value controls how frequently watchtower will poll for new images. Defaults to 300 seconds (5 minutes). -* `--schedule, -s` [Cron expression](https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format) in 6 fields (rather than the traditional 5) which defines when and how often to check for new images. Either `--interval` or the schedule expression could be defined, but not both. An example: `--schedule "0 0 4 * * *" ` +* `--schedule, -s` [Cron expression](https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format) in 6 fields (rather than the traditional 5) which defines when and how often to check for new images. Either `--interval` or the schedule expression could be defined, but not both. An example: `--schedule "0 0 4 * * *" ` * `--no-pull` Do not pull new images. When this flag is specified, watchtower will not attempt to pull new images from the registry. Instead it will only monitor the local image cache for changes. Use this option if you are building new images directly on the Docker host without pushing them to a registry. * `--stop-timeout` Timeout before the container is forcefully stopped. When set, this option will change the default (`10s`) wait time to the given value. An example: `--stop-timeout 30s` will set the timeout to 30 seconds. * `--label-enable` Watch containers where the `com.centurylinklabs.watchtower.enable` label is set to true. From b72a5bf9e76112a53072359f178eb9f14ec68b2d Mon Sep 17 00:00:00 2001 From: Connor McCormick <22061955+cnrmck@users.noreply.github.com> Date: Mon, 16 Jul 2018 17:55:57 +0000 Subject: [PATCH 02/20] Add documentation for how to pass env variables --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 84d7062..895e59e 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,18 @@ docker run -d \ If pulling images from private Docker registries, supply registry authentication credentials with the environment variables `REPO_USER` and `REPO_PASS` or by mounting the host's docker config file into the container (at the root of the container filesystem `/`). +Passing environment variables: +```bash +docker run -d \ + --name watchtower \ + -e REPO_USER=username \ + -e REPO_PASS=password \ + -v /var/run/docker.sock:/var/run/docker.sock \ + v2tec/watchtower container_to_watch --debug +``` +Also check out [this Stack Overflow answer](https://stackoverflow.com/a/30494145/7872793) for more options on how to pass environment variables. + +Mounting the host's docker config file: ```bash docker run -d \ --name watchtower \ From 9ffe960274b58ce91953ba58df2076a1ea9435a6 Mon Sep 17 00:00:00 2001 From: Connor McCormick <22061955+cnrmck@users.noreply.github.com> Date: Mon, 16 Jul 2018 18:00:52 +0000 Subject: [PATCH 03/20] Add reminder to pull proper image for ARM users --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 895e59e..0ee0cc8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Every few minutes watchtower will pull the latest *centurylink/wetty-cli* image ## Usage -Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `v2tec/watchtower` image. +Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `v2tec/watchtower` image. If you are using ARM based architecture, pull the appropriate `v2tec/watchtower:armhf-` image from the [v2tec Docker Hub](https://hub.docker.com/r/v2tec/watchtower/tags/). Since the watchtower code needs to interact with the Docker API in order to monitor the running containers, you need to mount */var/run/docker.sock* into the container with the -v flag when you run it. From df77d482fb5c6a7940fb57f28af5538003a700bd Mon Sep 17 00:00:00 2001 From: Scott Albertson Date: Fri, 16 Nov 2018 21:06:18 -0800 Subject: [PATCH 04/20] Add a "Reviewed by Hound" badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5bc2100..ff15d3b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![GoDoc](https://godoc.org/github.com/v2tec/watchtower?status.svg)](https://godoc.org/github.com/v2tec/watchtower) [![](https://images.microbadger.com/badges/image/v2tec/watchtower.svg)](https://microbadger.com/images/v2tec/watchtower "Get your own image badge on microbadger.com") [![Go Report Card](https://goreportcard.com/badge/github.com/v2tec/watchtower)](https://goreportcard.com/report/github.com/v2tec/watchtower) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) A process for watching your Docker containers and automatically restarting them whenever their base image is refreshed. From daeeee976198a422730f11780b526a353e5b60d2 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Tue, 2 Apr 2019 21:00:24 +0200 Subject: [PATCH 05/20] switch refs in readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ff15d3b..190c2b6 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Watchtower -[![Circle CI](https://circleci.com/gh/v2tec/watchtower.svg?style=shield)](https://circleci.com/gh/v2tec/watchtower) -[![GoDoc](https://godoc.org/github.com/v2tec/watchtower?status.svg)](https://godoc.org/github.com/v2tec/watchtower) -[![](https://images.microbadger.com/badges/image/v2tec/watchtower.svg)](https://microbadger.com/images/v2tec/watchtower "Get your own image badge on microbadger.com") -[![Go Report Card](https://goreportcard.com/badge/github.com/v2tec/watchtower)](https://goreportcard.com/report/github.com/v2tec/watchtower) +[![Circle CI](https://circleci.com/gh/containrrr/watchtower.svg?style=shield)](https://circleci.com/gh/containrrr/watchtower) +[![GoDoc](https://godoc.org/github.com/containrrr/watchtower?status.svg)](https://godoc.org/github.com/containrrr/watchtower) +[![](https://images.microbadger.com/badges/image/containrrr/watchtower.svg)](https://microbadger.com/images/containrrr/watchtower "Get your own image badge on microbadger.com") +[![Go Report Card](https://goreportcard.com/badge/github.com/containrrr/watchtower)](https://goreportcard.com/report/github.com/containrrr/watchtower) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) A process for watching your Docker containers and automatically restarting them whenever their base image is refreshed. From aaaddc8902de745ffd4a18dce762b4402d587818 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Wed, 3 Apr 2019 18:16:54 +0200 Subject: [PATCH 06/20] change push dir for image --- dockerfile/push_containers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile/push_containers.sh b/dockerfile/push_containers.sh index 0ee059f..d231f87 100644 --- a/dockerfile/push_containers.sh +++ b/dockerfile/push_containers.sh @@ -47,7 +47,7 @@ push_all() { push_docker ${IMAGE_NAME_VERSION} ${1}latest } -IMAGE_NAME=v2tec/watchtower +IMAGE_NAME=containrrr/watchtower push_all ${IMAGE_NAME}: push_all ${IMAGE_NAME}:armhf- push_all ${IMAGE_NAME}:arm64v8- From ab299b59f8e227647674421e4374d0bc4377a678 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Wed, 3 Apr 2019 21:02:05 +0200 Subject: [PATCH 07/20] change repo paths --- README.md | 30 +++++++++++++++--------------- actions/check.go | 2 +- actions/update.go | 2 +- container/filters_test.go | 2 +- glide.yaml | 2 +- goreleaser.yml | 6 +++--- main.go | 8 ++++---- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 268c611..89ce03f 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,14 @@ For example, let's say you were running watchtower along with an instance of *ce $ docker ps CONTAINER ID IMAGE STATUS PORTS NAMES 967848166a45 centurylink/wetty-cli Up 10 minutes 0.0.0.0:8080->3000/tcp wetty -6cc4d2a9d1a5 v2tec/watchtower Up 15 minutes watchtower +6cc4d2a9d1a5 containrrr/watchtower Up 15 minutes watchtower ``` Every few minutes watchtower will pull the latest *centurylink/wetty-cli* image and compare it to the one that was used to run the "wetty" container. If it sees that the image has changed it will stop/remove the "wetty" container and then restart it using the new image and the same `docker run` options that were used to start the container initially (in this case, that would include the `-p 8080:3000` port mapping). ## Usage -Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `v2tec/watchtower` image. If you are using ARM based architecture, pull the appropriate `v2tec/watchtower:armhf-` image from the [v2tec Docker Hub](https://hub.docker.com/r/v2tec/watchtower/tags/). +Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `containrrr/watchtower` image. If you are using ARM based architecture, pull the appropriate `containrrr/watchtower:armhf-` image from the [v2tec Docker Hub](https://hub.docker.com/r/containrrr/watchtower/tags/). Since the watchtower code needs to interact with the Docker API in order to monitor the running containers, you need to mount */var/run/docker.sock* into the container with the -v flag when you run it. @@ -37,7 +37,7 @@ Run the `watchtower` container with the following command: docker run -d \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ - v2tec/watchtower + containrrr/watchtower ``` If pulling images from private Docker registries, supply registry authentication credentials with the environment variables `REPO_USER` and `REPO_PASS` @@ -50,7 +50,7 @@ docker run -d \ -e REPO_USER=username \ -e REPO_PASS=password \ -v /var/run/docker.sock:/var/run/docker.sock \ - v2tec/watchtower container_to_watch --debug + containrrr/watchtower container_to_watch --debug ``` Also check out [this Stack Overflow answer](https://stackoverflow.com/a/30494145/7872793) for more options on how to pass environment variables. @@ -60,7 +60,7 @@ docker run -d \ --name watchtower \ -v /home//.docker/config.json:/config.json \ -v /var/run/docker.sock:/var/run/docker.sock \ - v2tec/watchtower container_to_watch --debug + containrrr/watchtower container_to_watch --debug ``` If you mount the config file as described above, be sure to also prepend the url for the registry when starting up your watched image (you can omit the https://). Here is a complete docker-compose.yml file that starts up a docker container from a private repo at dockerhub and monitors it with watchtower. Note the command argument changing the interval to 30s rather than the default 5 minutes. @@ -74,7 +74,7 @@ services: - "443:3443" - "80:3080" watchtower: - image: v2tec/watchtower + image: containrrr/watchtower volumes: - /var/run/docker.sock:/var/run/docker.sock - /root/.docker/config.json:/config.json @@ -89,7 +89,7 @@ By default, watchtower will monitor all containers running within the Docker dae docker run -d \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ - v2tec/watchtower nginx redis + containrrr/watchtower nginx redis ``` In the example above, watchtower will only monitor the containers named "nginx" and "redis" for updates -- all of the other running containers will be ignored. @@ -101,7 +101,7 @@ When no arguments are specified, watchtower will monitor all running containers. Any of the options described below can be passed to the watchtower process by setting them after the image name in the `docker run` string: ```bash -docker run --rm v2tec/watchtower --help +docker run --rm containrrr/watchtower --help ``` * `--host, -h` Docker daemon socket to connect to. Defaults to "unix:///var/run/docker.sock" but can be pointed at a remote Docker host by specifying a TCP endpoint as "tcp://hostname:port". The host value can also be provided by setting the `DOCKER_HOST` environment variable. @@ -175,7 +175,7 @@ By default, watchtower is set-up to monitor the local Docker daemon (the same da ```bash docker run -d \ --name watchtower \ - v2tec/watchtower --host "tcp://10.0.1.2:2375" + containrrr/watchtower --host "tcp://10.0.1.2:2375" ``` or @@ -184,7 +184,7 @@ or docker run -d \ --name watchtower \ -e DOCKER_HOST="tcp://10.0.1.2:2375" \ - v2tec/watchtower + containrrr/watchtower ``` Note in both of the examples above that it is unnecessary to mount the */var/run/docker.sock* into the watchtower container. @@ -202,12 +202,12 @@ docker run -d \ --name watchtower \ -e DOCKER_HOST=$DOCKER_HOST \ -v $DOCKER_CERT_PATH:/etc/ssl/docker \ - v2tec/watchtower --tlsverify + containrrr/watchtower --tlsverify ``` ## Updating Watchtower -If watchtower is monitoring the same Docker daemon under which the watchtower container itself is running (i.e. if you volume-mounted */var/run/docker.sock* into the watchtower container) then it has the ability to update itself. If a new version of the *v2tec/watchtower* image is pushed to the Docker Hub, your watchtower will pull down the new image and restart itself automatically. +If watchtower is monitoring the same Docker daemon under which the watchtower container itself is running (i.e. if you volume-mounted */var/run/docker.sock* into the watchtower container) then it has the ability to update itself. If a new version of the *containrrr/watchtower* image is pushed to the Docker Hub, your watchtower will pull down the new image and restart itself automatically. ## Notifications @@ -246,7 +246,7 @@ docker run -d \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=fromaddress@gmail.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=app_password \ - v2tec/watchtower + containrrr/watchtower ``` ### Notifications through Slack webhook @@ -266,7 +266,7 @@ docker run -d \ -e WATCHTOWER_NOTIFICATIONS=slack \ -e WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL="https://hooks.slack.com/services/xxx/yyyyyyyyyyyyyyy" \ -e WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=watchtower-server-1 \ - v2tec/watchtower + containrrr/watchtower ``` ### Notifications via MSTeams incoming webhook @@ -286,5 +286,5 @@ docker run -d \ -e WATCHTOWER_NOTIFICATIONS=msteams \ -e WATCHTOWER_NOTIFICATION_MSTEAMS_HOOK_URL="https://outlook.office.com/webhook/xxxxxxxx@xxxxxxx/IncomingWebhook/yyyyyyyy/zzzzzzzzzz" \ -e WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA=true \ - v2tec/watchtower + containrrr/watchtower ``` diff --git a/actions/check.go b/actions/check.go index 5354dd7..2517dc2 100644 --- a/actions/check.go +++ b/actions/check.go @@ -3,7 +3,7 @@ package actions import ( "sort" - "github.com/v2tec/watchtower/container" + "github.com/containrrr/watchtower/container" ) // CheckPrereqs will ensure that there are not multiple instances of the diff --git a/actions/update.go b/actions/update.go index 4d488a5..4f1e307 100644 --- a/actions/update.go +++ b/actions/update.go @@ -5,7 +5,7 @@ import ( "time" log "github.com/sirupsen/logrus" - "github.com/v2tec/watchtower/container" + "github.com/containrrr/watchtower/container" ) var ( diff --git a/container/filters_test.go b/container/filters_test.go index 25a0118..0db0a62 100644 --- a/container/filters_test.go +++ b/container/filters_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/v2tec/watchtower/container/mocks" + "github.com/containrrr/watchtower/container/mocks" ) func TestWatchtowerContainersFilter(t *testing.T) { diff --git a/glide.yaml b/glide.yaml index 20ef77d..bd9ed6d 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,4 +1,4 @@ -package: github.com/v2tec/watchtower +package: github.com/containrrr/watchtower import: - package: github.com/sirupsen/logrus version: ~0.11.x diff --git a/goreleaser.yml b/goreleaser.yml index fed2baa..c0ea4c3 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -58,7 +58,7 @@ dockers: goarch: amd64 goarm: '' binary: watchtower - image: v2tec/watchtower + image: containrrr/watchtower dockerfile: dockerfile/amd64/Dockerfile tag_templates: - '{{ .Version }}' @@ -67,7 +67,7 @@ dockers: goarch: arm goarm: 6 binary: watchtower - image: v2tec/watchtower + image: containrrr/watchtower dockerfile: dockerfile/armhf/Dockerfile tag_templates: - 'armhf-{{ .Version }}' @@ -76,7 +76,7 @@ dockers: goarch: arm64 goarm: '' binary: watchtower - image: v2tec/watchtower + image: containrrr/watchtower dockerfile: dockerfile/arm64v8/Dockerfile tag_templates: - 'arm64v8-{{ .Version }}' diff --git a/main.go b/main.go index 2b6fba5..c686b65 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -package main // import "github.com/v2tec/watchtower" +package main // import "github.com/containrrr/watchtower" import ( "os" @@ -11,9 +11,9 @@ import ( "github.com/robfig/cron" log "github.com/sirupsen/logrus" "github.com/urfave/cli" - "github.com/v2tec/watchtower/actions" - "github.com/v2tec/watchtower/container" - "github.com/v2tec/watchtower/notifications" + "github.com/containrrr/watchtower/actions" + "github.com/containrrr/watchtower/container" + "github.com/containrrr/watchtower/notifications" ) // DockerAPIMinVersion is the version of the docker API, which is minimally required by From c03b6c4235c823a31d9e54f3d5637a961f3f6614 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 4 Apr 2019 16:17:50 +0200 Subject: [PATCH 08/20] Fixing name of Docker Hub account --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89ce03f..c0dfbf2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Every few minutes watchtower will pull the latest *centurylink/wetty-cli* image ## Usage -Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `containrrr/watchtower` image. If you are using ARM based architecture, pull the appropriate `containrrr/watchtower:armhf-` image from the [v2tec Docker Hub](https://hub.docker.com/r/containrrr/watchtower/tags/). +Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `containrrr/watchtower` image. If you are using ARM based architecture, pull the appropriate `containrrr/watchtower:armhf-` image from the [containrrr Docker Hub](https://hub.docker.com/r/containrrr/watchtower/tags/). Since the watchtower code needs to interact with the Docker API in order to monitor the running containers, you need to mount */var/run/docker.sock* into the container with the -v flag when you run it. From 1b82da1ab77bf47e2243da15403a58a300c4324f Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Thu, 4 Apr 2019 23:08:44 +0200 Subject: [PATCH 09/20] Setup a working pipeline * add tests to ensure function even after switching docker client api version * switch docker client api version to remove import of Sirupsen and get rid of the casing workaround * migrate from glide to dep to go modules * rewrite ci workflow * only run publish on version tags * only run build on branches * update goreleaser config * disable automated latest tag push * remove dependency to v2tec/docker-gobuilder * remove dead code and files * add golands .idea folder to gitignore * add label to released docker images * add test reporting, add some unit tests * change test output dir * fix goreleaser versions * add debug output for circleci and goreleaser * disable cgo --- .circleci/config.yml | 116 ++++++++++++++++++++ .gitignore | 3 +- actions/update.go | 5 +- circle.yml | 28 ----- container/client.go | 2 + container/container.go | 14 ++- container/container_test.go | 25 +++++ container/trust.go | 17 +-- container/trust_test.go | 60 +++++++++++ dockerfile/push_containers.sh | 53 ---------- glide.lock | 193 ---------------------------------- glide.yaml | 33 ------ go.mod | 53 ++++++++++ go.sum | 148 ++++++++++++++++++++++++++ goreleaser.yml | 61 ++++------- notifications/smtp.go | 1 + 16 files changed, 450 insertions(+), 362 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml create mode 100644 container/container_test.go create mode 100644 container/trust_test.go delete mode 100644 dockerfile/push_containers.sh delete mode 100644 glide.lock delete mode 100644 glide.yaml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..82031be --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,116 @@ +version: 2.1 + +executors: + go: + docker: + - image: circleci/golang:latest + working_directory: ~/repo + +workflows: + version: 2 + ci: + jobs: + - checkout: + filters: + branches: + only: /.*/ + tags: + only: /.*/ + - linting: + requires: + - checkout + filters: + branches: + only: /.*/ + tags: + only: /.*/ + - testing: + requires: + - checkout + filters: + branches: + only: /.*/ + tags: + only: /.*/ + - build: + requires: + - testing + - linting + filters: + tags: + ignore: /^v[0-9]+(\.[0-9]+)*$/ + branches: + only: /.*/ + - publishing: + requires: + - testing + - linting + filters: + branches: + ignore: /.*/ + tags: + only: /^v[0-9]+(\.[0-9]+)*$/ +jobs: + checkout: + executor: go + steps: + - checkout + - persist_to_workspace: + paths: + - . + root: ~/repo + linting: + executor: go + steps: + - attach_workspace: + at: . + - run: go build . + - run: go get -u golang.org/x/lint/golint + - run: golint -set_exit_status ./... + testing: + executor: go + steps: + - attach_workspace: + at: . + - run: mkdir -p /tmp/test-results + - run: go build ./... + - run: go get gotest.tools/gotestsum + - run: gotestsum --junitfile /tmp/test-results/unit-tests.xml + - store_test_results: + path: /tmp/test-results + build: + executor: go + steps: + - attach_workspace: + at: . + - setup_remote_docker + - run: + name: Install Goreleaser + command: | + cd .. && \ + wget https://github.com/goreleaser/goreleaser/releases/download/v0.104.1/goreleaser_Linux_x86_64.tar.gz && \ + tar -xvf goreleaser_Linux_x86_64.tar.gz && \ + ./goreleaser -v + - run: + name: Execute goreleaser + command: ../goreleaser --snapshot --skip-publish --debug + publishing: + executor: go + steps: + - attach_workspace: + at: . + - setup_remote_docker + - run: + name: Install Goreleaser + command: | + cd .. && \ + wget https://github.com/goreleaser/goreleaser/releases/download/v0.104.1/goreleaser_Linux_x86_64.tar.gz && \ + tar -xvf goreleaser_Linux_x86_64.tar.gz && \ + ./goreleaser -v + - run: + name: Login to docker hub + command: | + echo "$DOCKER_PASS" | docker login -u $DOCKER_USER --password-stdin + - run: + name: Execute goreleaser + command: CGO_ENABLED=${CGO_ENABLED:-0} ../goreleaser --debug \ No newline at end of file diff --git a/.gitignore b/.gitignore index e43f117..79e0afc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ watchtower vendor .glide -dist \ No newline at end of file +dist +.idea \ No newline at end of file diff --git a/actions/update.go b/actions/update.go index 4f1e307..e631b1a 100644 --- a/actions/update.go +++ b/actions/update.go @@ -4,12 +4,12 @@ import ( "math/rand" "time" - log "github.com/sirupsen/logrus" "github.com/containrrr/watchtower/container" + log "github.com/sirupsen/logrus" ) var ( - letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ) // Update looks at the running Docker containers to see if any of the images @@ -45,6 +45,7 @@ func Update(client container.Client, filter container.Filter, cleanup bool, noRe container := containers[i] if container.IsWatchtower() { + log.Debugf("This is the watchtower container %s", containers[i].Name()) continue } diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 6cbcc39..0000000 --- a/circle.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: v2tec/gobuilder:0.5.0_go1.7.4-glide0.12.3-goreleaser0.59.0-docker17.05.0 - working_directory: /src - steps: - - checkout - - setup_remote_docker: - version: 17.05.0-ce - - run: git fetch --tags - - run: | - docker login -u $DOCKER_USER -p $DOCKER_PASS - IS_RELEASE=$(if [ "$CIRCLE_TAG" != "" ] ; then echo release; else echo ci; fi;) - /build.sh $IS_RELEASE || exit 1 - chmod 755 /src/dockerfile/push_containers.sh - if [ "$CIRCLE_TAG" != "" ] ; then /src/dockerfile/push_containers.sh $CIRCLE_TAG; fi; - - - store_artifacts: - path: /src/dist/ -workflows: - version: 2 - build-deploy: - jobs: - - build: - filters: - tags: - only: /.*/ \ No newline at end of file diff --git a/container/client.go b/container/client.go index 476e3ca..47e4776 100644 --- a/container/client.go +++ b/container/client.go @@ -187,6 +187,8 @@ func (client dockerClient) IsContainerStale(c Container) (bool, error) { var opts types.ImagePullOptions // ImagePullOptions can take a RegistryAuth arg to authenticate against a private registry auth, err := EncodedAuth(imageName) + log.Infof("Got auth value: %s", auth) + log.Infof("Got image name: %s", imageName) if err != nil { log.Debugf("Error loading authentication credentials %s", err) return false, err diff --git a/container/container.go b/container/container.go index 7453507..7c4d948 100644 --- a/container/container.go +++ b/container/container.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" "strings" - + log "github.com/sirupsen/logrus" "github.com/docker/docker/api/types" dockercontainer "github.com/docker/docker/api/types/container" ) @@ -102,8 +102,9 @@ func (c Container) Links() []string { // identified by the presence of the "com.centurylinklabs.watchtower" label in // the container metadata. func (c Container) IsWatchtower() bool { - val, ok := c.containerInfo.Config.Labels[watchtowerLabel] - return ok && val == "true" + log.Debugf("Checking if %s is a watchtower instance.", c.Name()) + wasWatchtower := ContainsWatchtowerLabel(c.containerInfo.Config.Labels) + return wasWatchtower } // StopSignal returns the custom stop signal (if any) that is encoded in the @@ -182,3 +183,10 @@ func (c Container) hostConfig() *dockercontainer.HostConfig { return hostConfig } + +// ContainsWatchtowerLabel takes a map of labels and values and tells +// the consumer whether it contains a valid watchtower instance label +func ContainsWatchtowerLabel(labels map[string]string) bool { + val, ok := labels[watchtowerLabel] + return ok && val == "true" +} \ No newline at end of file diff --git a/container/container_test.go b/container/container_test.go new file mode 100644 index 0000000..e3a7f94 --- /dev/null +++ b/container/container_test.go @@ -0,0 +1,25 @@ +package container + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestContainsWatchtowerLabel_ShouldReturnTrueIfTheWatchtowerLabelExistsOnTheContainer(t *testing.T) { + labelMap := map[string]string { + "com.centurylinklabs.watchtower": "true", + } + assert.True(t, ContainsWatchtowerLabel(labelMap)) +} + +func TestContainsWatchtowerLabel_ShouldReturnFalseIfTheWatchtowerLabelDoesntExistOnTheContainer(t *testing.T) { + labelMap := map[string]string { + "com.containrrr.watchtower": "lost", + } + assert.False(t, ContainsWatchtowerLabel(labelMap)) +} + +func TestContainsWatchtowerLabel_ShouldReturnFalseIfLabelsIsEmpty(t *testing.T) { + labelMap := map[string]string {} + assert.False(t, ContainsWatchtowerLabel(labelMap)) +} diff --git a/container/trust.go b/container/trust.go index e388302..92ab696 100644 --- a/container/trust.go +++ b/container/trust.go @@ -5,12 +5,12 @@ import ( "os" "strings" + "github.com/docker/cli/cli/command" + cliconfig "github.com/docker/cli/cli/config" + "github.com/docker/cli/cli/config/configfile" + "github.com/docker/cli/cli/config/credentials" + "github.com/docker/distribution/reference" "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/reference" - "github.com/docker/docker/cli/command" - "github.com/docker/docker/cliconfig" - "github.com/docker/docker/cliconfig/configfile" - "github.com/docker/docker/cliconfig/credentials" log "github.com/sirupsen/logrus" ) @@ -67,12 +67,15 @@ func EncodedConfigAuth(ref string) (string, error) { return EncodeAuth(auth) } +// ParseServerAddress extracts the server part from a container image ref func ParseServerAddress(ref string) (string, error) { - repository, _, err := reference.Parse(ref) + + parsedRef, err := reference.Parse(ref) if err != nil { return ref, err } - parts := strings.Split(repository, "/") + + parts := strings.Split(parsedRef.String(), "/") return parts[0], nil } diff --git a/container/trust_test.go b/container/trust_test.go new file mode 100644 index 0000000..481ce64 --- /dev/null +++ b/container/trust_test.go @@ -0,0 +1,60 @@ +package container + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestEncodedEnvAuth_ShouldReturnAnErrorIfRepoEnvsAreUnset(t *testing.T) { + os.Unsetenv("REPO_USER") + os.Unsetenv("REPO_PASS") + _, err := EncodedEnvAuth("") + assert.Error(t, err) +} +func TestEncodedEnvAuth_ShouldReturnAuthHashIfRepoEnvsAreSet(t *testing.T) { + expectedHash := "eyJ1c2VybmFtZSI6ImNvbnRhaW5ycnItdXNlciIsInBhc3N3b3JkIjoiY29udGFpbnJyci1wYXNzIn0=" + + os.Setenv("REPO_USER", "containrrr-user") + os.Setenv("REPO_PASS", "containrrr-pass") + config, _ := EncodedEnvAuth("") + + assert.Equal(t, config, expectedHash) +} + +func TestEncodedConfigAuth_ShouldReturnAnErrorIfFileIsNotPresent(t *testing.T) { + os.Setenv("DOCKER_CONFIG", "/dev/null/should-fail") + _, err := EncodedConfigAuth("") + assert.Error(t, err) +} + +/* + * TODO: + * This part only confirms that it still works in the same way as it did + * with the old version of the docker api client sdk. I'd say that + * ParseServerAddress likely needs to be elaborated a bit to default to + * dockerhub in case no server address was provided. + * + * ++ @simskij, 2019-04-04 + */ + +func TestParseServerAddress_ShouldReturnErrorIfPassedEmptyString(t *testing.T) { + _, err := ParseServerAddress("") + assert.Error(t, err) +} + +func TestParseServerAddress_ShouldReturnTheRepoNameIfPassedAFullyQualifiedImageName(t *testing.T) { + val, _ := ParseServerAddress("github.com/containrrrr/config") + assert.Equal(t, val, "github.com") +} + +func TestParseServerAddress_ShouldReturnTheOrganizationPartIfPassedAnImageNameMissingServerName(t *testing.T) { + val, _ := ParseServerAddress("containrrr/config") + assert.Equal(t, val, "containrrr") +} + +func TestParseServerAddress_ShouldReturnTheServerNameIfPassedAFullyQualifiedImageName(t *testing.T) { + val, _ := ParseServerAddress("github.com/containrrrr/config") + assert.Equal(t, val, "github.com") +} diff --git a/dockerfile/push_containers.sh b/dockerfile/push_containers.sh deleted file mode 100644 index d231f87..0000000 --- a/dockerfile/push_containers.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -PROGNAME=$(basename $0) -VERSION_BUILD=$1 - -function error_exit -{ - echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2 - exit 1 -} - -if [ "$1" = "" ]; then - error_exit "Please provide version as first argument." -fi - -SEMVER=${VERSION_BUILD#*v} -VERSION=`echo $SEMVER | awk '{split($0,a,"."); print a[1]}'` -BUILD=`echo $SEMVER | awk '{split($0,a,"."); print a[2]}'` -PATCH=`echo $SEMVER | awk '{split($0,a,"."); print a[3]}'` - -if [ "${VERSION}" = "" ]; then - echo "Please provide a semantic version." - exit 1 -fi - -if [ "${BUILD}" = "" ]; then - BUILD='0' -fi - -if [ "${PATCH}" = "" ]; then - PATCH='0' -fi - -push_docker() { - echo " -> push $1 $2" - docker tag $1 $2 || exit 1 - docker push $2 || exit 1 -} - -push_all() { - IMAGE_NAME_VERSION=${1}${VERSION}.${BUILD}.${PATCH} - echo "Pulling $IMAGE_NAME_VERSION..." - docker pull ${IMAGE_NAME_VERSION} || exit 1 - echo "Pushing $IMAGE_NAME_VERSION..." - push_docker ${IMAGE_NAME_VERSION} ${1}${VERSION}.${BUILD} - push_docker ${IMAGE_NAME_VERSION} ${1}${VERSION} - push_docker ${IMAGE_NAME_VERSION} ${1}latest -} - -IMAGE_NAME=containrrr/watchtower -push_all ${IMAGE_NAME}: -push_all ${IMAGE_NAME}:armhf- -push_all ${IMAGE_NAME}:arm64v8- diff --git a/glide.lock b/glide.lock deleted file mode 100644 index a4dcf44..0000000 --- a/glide.lock +++ /dev/null @@ -1,193 +0,0 @@ -hash: 23bcd62f9352c61d3aebc85a59f7ebbfaf80bc0201f45037cdea65820673ddeb -updated: 2018-03-01T13:21:55.8472118+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: 092cba3727bb9b4a2f0e922cd6c0f93ea270e363 - 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: ecb4cb2dd420ada7df7f2593d6c25441f65f69f2 - 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/johntdyer/slack-go - version: 95fac1160b220c5abcf8b0ef88e9c3cb213c09f4 -- name: github.com/johntdyer/slackrus - version: 3992f319fd0ac349483279ef74742cd787841cba -- name: github.com/mattn/go-shellwords - version: f4e566c536cf69158e808ec28ef4182a37fdc981 -- name: github.com/Microsoft/go-winio - version: fff283ad5116362ca252298cfc9b95828956d85d -- name: github.com/opencontainers/runc - version: 9df8b306d01f59d3a8029be411de015b7304dd8f - 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: ba1b36c82c5e05c4f912a88eab0dcd91a171688f - repo: https://github.com/sirupsen/logrus.git -- name: github.com/sirupsen/logrus - version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f -- 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 deleted file mode 100644 index bd9ed6d..0000000 --- a/glide.yaml +++ /dev/null @@ -1,33 +0,0 @@ -package: github.com/containrrr/watchtower -import: -- package: github.com/sirupsen/logrus - version: ~0.11.x -- package: github.com/Sirupsen/logrus - repo: https://github.com/sirupsen/logrus.git - 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 -- package: github.com/johntdyer/slackrus - version: 3992f31 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..005ed9b --- /dev/null +++ b/go.mod @@ -0,0 +1,53 @@ +module github.com/containrrr/watchtower + +go 1.12 + +require ( + github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 + github.com/Microsoft/go-winio v0.4.12 + github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 + github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 + github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 + github.com/davecgh/go-spew v1.1.1 + github.com/docker/cli v0.0.0-20190327152802-57b27434ea29 + github.com/docker/distribution v2.7.1+incompatible + github.com/docker/docker v0.0.0-20190404075923-dbe4a30928d4 + github.com/docker/docker-credential-helpers v0.6.1 + github.com/docker/go v1.5.1-1 + github.com/docker/go-connections v0.4.0 + github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82 + github.com/docker/go-units v0.3.3 + github.com/gogo/protobuf v1.2.1 + github.com/golang/protobuf v1.3.1 + github.com/gorilla/mux v1.7.0 + github.com/hashicorp/go-version v1.1.0 + github.com/inconshreveable/mousetrap v1.0.0 + github.com/johntdyer/slack-go v0.0.0-20180213144715-95fac1160b22 + github.com/johntdyer/slackrus v0.0.0-20180518184837-f7aae3243a07 + github.com/konsorten/go-windows-terminal-sequences v1.0.2 + github.com/matttproud/golang_protobuf_extensions v1.0.1 + github.com/miekg/pkcs11 v0.0.0-20190401114359-553cfdd26aaa + github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c + github.com/opencontainers/go-digest v1.0.0-rc1 + github.com/opencontainers/image-spec v1.0.1 + github.com/opencontainers/runc v0.1.1 + github.com/pkg/errors v0.8.1 + github.com/pmezard/go-difflib v1.0.0 + github.com/prometheus/client_golang v0.9.2 + github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 + github.com/prometheus/common v0.2.0 + github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872 + github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 + github.com/sirupsen/logrus v1.4.1 + github.com/spf13/cobra v0.0.3 + github.com/spf13/pflag v1.0.3 + github.com/stretchr/objx v0.1.1 + github.com/stretchr/testify v1.3.0 + github.com/theupdateframework/notary v0.6.1 + github.com/urfave/cli v1.20.0 + golang.org/x/crypto v0.0.0-20190403202508-8e1b8d32e692 + golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b + golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e + google.golang.org/genproto v0.0.0-20190401181712-f467c93bbac2 + google.golang.org/grpc v1.19.1 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b7346ab --- /dev/null +++ b/go.sum @@ -0,0 +1,148 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Microsoft/go-winio v0.4.12 h1:xAfWHN1IrQ0NJ9TBC0KBZoqLjzDTr1ML+4MywiUOryc= +github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= +github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI= +github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 h1:4BX8f882bXEDKfWIf0wa8HRvpnBoPszJJXL+TVbBw4M= +github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/cli v0.0.0-20190327152802-57b27434ea29 h1:ciaXDHaWQda0nvevWqcjtXX/buQY3e0lga1vq8Batq0= +github.com/docker/cli v0.0.0-20190327152802-57b27434ea29/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v0.0.0-20190404075923-dbe4a30928d4 h1:34LfsqlE2kEvmGP9qbRoPvOWkmluYGzmlvWVTzwvT0A= +github.com/docker/docker v0.0.0-20190404075923-dbe4a30928d4/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.6.1 h1:Dq4iIfcM7cNtddhLVWe9h4QDjsi4OER3Z8voPu/I52g= +github.com/docker/docker-credential-helpers v0.6.1/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= +github.com/docker/go v1.5.1-1 h1:hr4w35acWBPhGBXlzPoHpmZ/ygPjnmFVxGxxGnMyP7k= +github.com/docker/go v1.5.1-1/go.mod h1:CADgU4DSXK5QUlFslkQu2yW2TKzFZcXq/leZfM0UH5Q= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82 h1:X0fj836zx99zFu83v/M79DuBn84IL/Syx1SY6Y5ZEMA= +github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= +github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U= +github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/hashicorp/go-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0= +github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/johntdyer/slack-go v0.0.0-20180213144715-95fac1160b22 h1:jKUP9TQ0c7X3w6+IPyMit07RE42MtTWNd77sN2cHngQ= +github.com/johntdyer/slack-go v0.0.0-20180213144715-95fac1160b22/go.mod h1:u0Jo4f2dNlTJeeOywkM6bLwxq6gC3pZ9rEFHn3AhTdk= +github.com/johntdyer/slackrus v0.0.0-20180518184837-f7aae3243a07 h1:+kBG/8rjCa6vxJZbUjAiE4MQmBEBYc8nLEb51frnvBY= +github.com/johntdyer/slackrus v0.0.0-20180518184837-f7aae3243a07/go.mod h1:j1kV/8f3jowErEq4XyeypkCdvg5EeHkf0YCKCcq5Ybo= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/pkcs11 v0.0.0-20190401114359-553cfdd26aaa/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE= +github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872 h1:0aNv3xC7DmQoy1/x1sMh18g+fihWW68LL13i8ao9kl4= +github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 h1:x7xEyJDP7Hv3LVgvWhzioQqbC/KtuUhTigKlH/8ehhE= +github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/theupdateframework/notary v0.6.1 h1:7wshjstgS9x9F5LuB1L5mBI2xNMObWqjz+cjWoom6l0= +github.com/theupdateframework/notary v0.6.1/go.mod h1:MOfgIfmox8s7/7fduvB2xyPPMJCrjRLRizA8OFwpnKY= +github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190403202508-8e1b8d32e692 h1:GRhHqDOgeDr6QDTtq9gn2O4iKvm5dsbfqD/TXb0KLX0= +golang.org/x/crypto v0.0.0-20190403202508-8e1b8d32e692/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b h1:/zjbcJPEGAyu6Is/VBOALsgdi4z9+kz/Vtdm6S+beD0= +golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190401181712-f467c93bbac2 h1:8FyEBtGg6Px24p+H2AkuVWqhj4+R9fo+fZD17mg+lzk= +google.golang.org/genproto v0.0.0-20190401181712-f467c93bbac2/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1 h1:TrBcJ1yqAl1G++wO39nD/qtgpsW9/1+QGrluyMGEYgM= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/goreleaser.yml b/goreleaser.yml index c0ea4c3..20c763e 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -1,39 +1,16 @@ -# Build customization build: - # Path to main.go file. - # Default is `main.go` main: ./main.go - - # GOOS list to build in. - # For more info refer to https://golang.org/doc/install/source#environment - # Defaults are darwin and linux + binary: watchtower goos: - linux - windows - - # GOARCH to build in. - # For more info refer to https://golang.org/doc/install/source#environment - # Defaults are 386 and amd64 goarch: - amd64 - arm - arm64 - -# Archive customization archive: - # You can change the name of the archive. - # This is parsed with Golang template engine and the following variables. name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}" - - # Archive format. Valid options are `tar.gz` and `zip`. - # Default is `zip` format: tar.gz - - # Replacements for GOOS and GOARCH on the archive name. - # The keys should be valid GOOS or GOARCH values followed by your custom - # replacements. - # By default, `replacements` replace GOOS and GOARCH values with valid outputs - # of `uname -s` and `uname -m` respectively. replacements: arm: armhf arm64: arm64v8 @@ -41,42 +18,42 @@ archive: 386: 386 darwin: macOS linux: linux - format_overrides: - goos: windows format: zip - - # Additional files you want to add to the archive. - # Defaults are any files matching `LICENCE*`, `LICENSE*`, - # `README*` and `CHANGELOG*` (case-insensitive) files: - LICENSE.md - dockers: - goos: linux goarch: amd64 goarm: '' - binary: watchtower - image: containrrr/watchtower dockerfile: dockerfile/amd64/Dockerfile - tag_templates: - - '{{ .Version }}' + build_flag_templates: + - "--label=com.centurylinklabs.watchtower=true" + image_templates: + - containrrr/watchtower:{{ .Version }} + binaries: + - watchtower - goos: linux goarch: arm goarm: 6 - binary: watchtower - image: containrrr/watchtower dockerfile: dockerfile/armhf/Dockerfile - tag_templates: - - 'armhf-{{ .Version }}' + build_flag_templates: + - "--label=com.centurylinklabs.watchtower=true" + image_templates: + - containrrr/watchtower:armhf-{{ .Version }} + binaries: + - watchtower - goos: linux goarch: arm64 goarm: '' - binary: watchtower - image: containrrr/watchtower dockerfile: dockerfile/arm64v8/Dockerfile - tag_templates: - - 'arm64v8-{{ .Version }}' + build_flag_templates: + - "--label=com.centurylinklabs.watchtower=true" + image_templates: + - containrrr/watchtower:arm64v8-{{ .Version }} + binaries: + - watchtower \ No newline at end of file diff --git a/notifications/smtp.go b/notifications/smtp.go index d0f07f8..82954bc 100644 --- a/notifications/smtp.go +++ b/notifications/smtp.go @@ -1,3 +1,4 @@ +// Package notifications ... // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license. From 6157c50e4fe1fab15ca8022f3e82c306e73d6d35 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sat, 6 Apr 2019 14:05:01 +0200 Subject: [PATCH 10/20] fix some minor issues --- .circleci/config.yml | 2 +- container/client.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 82031be..bead463 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,7 +93,7 @@ jobs: ./goreleaser -v - run: name: Execute goreleaser - command: ../goreleaser --snapshot --skip-publish --debug + command: CGO_ENABLED=${CGO_ENABLED:-0} ../goreleaser --snapshot --skip-publish --debug publishing: executor: go steps: diff --git a/container/client.go b/container/client.go index 47e4776..62bce6c 100644 --- a/container/client.go +++ b/container/client.go @@ -187,8 +187,8 @@ func (client dockerClient) IsContainerStale(c Container) (bool, error) { var opts types.ImagePullOptions // ImagePullOptions can take a RegistryAuth arg to authenticate against a private registry auth, err := EncodedAuth(imageName) - log.Infof("Got auth value: %s", auth) - log.Infof("Got image name: %s", imageName) + log.Debugf("Got auth value: %s", auth) + log.Debugf("Got image name: %s", imageName) if err != nil { log.Debugf("Error loading authentication credentials %s", err) return false, err From 7db0aed2a5235a471b5b67f7d57b903c9c882ff0 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sat, 6 Apr 2019 14:27:50 +0200 Subject: [PATCH 11/20] print to log if multiple watchtower instances are detected --- actions/check.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/actions/check.go b/actions/check.go index 2517dc2..a95133e 100644 --- a/actions/check.go +++ b/actions/check.go @@ -3,6 +3,8 @@ package actions import ( "sort" + log "github.com/sirupsen/logrus" + "github.com/containrrr/watchtower/container" ) @@ -17,6 +19,7 @@ func CheckPrereqs(client container.Client, cleanup bool) error { } if len(containers) > 1 { + log.Info("Found multiple running watchtower instances. Cleaning up") sort.Sort(container.ByCreated(containers)) // Iterate over all containers execept the last one From bac518a4413570770a0215a185a4988e63415cf6 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 14:52:43 +0200 Subject: [PATCH 12/20] add a logo and spice up the top part of the readme --- README.md | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c0dfbf2..f32d456 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,29 @@ -# Watchtower +

+ +

+

+ Watchtower +

-[![Circle CI](https://circleci.com/gh/containrrr/watchtower.svg?style=shield)](https://circleci.com/gh/containrrr/watchtower) -[![GoDoc](https://godoc.org/github.com/containrrr/watchtower?status.svg)](https://godoc.org/github.com/containrrr/watchtower) -[![](https://images.microbadger.com/badges/image/containrrr/watchtower.svg)](https://microbadger.com/images/containrrr/watchtower "Get your own image badge on microbadger.com") -[![Go Report Card](https://goreportcard.com/badge/github.com/containrrr/watchtower)](https://goreportcard.com/report/github.com/containrrr/watchtower) -[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) - -A process for watching your Docker containers and automatically restarting them whenever their base image is refreshed. +

+ A process for automating Docker container base image updates. +

+ + Circle CI + + + GoDoc + + + Microbadger + + + Go Report Card + + + Hound CI + +

## Overview From 438c90f821198de3dcd8533faf4cbe585cce1d00 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 14:53:29 +0200 Subject: [PATCH 13/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f32d456..a671490 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ For example, let's say you were running watchtower along with an instance of *ce $ docker ps CONTAINER ID IMAGE STATUS PORTS NAMES 967848166a45 centurylink/wetty-cli Up 10 minutes 0.0.0.0:8080->3000/tcp wetty -6cc4d2a9d1a5 containrrr/watchtower Up 15 minutes watchtower +6cc4d2a9d1a5 containrrr/watchtower Up 15 minutes watchtower ``` Every few minutes watchtower will pull the latest *centurylink/wetty-cli* image and compare it to the one that was used to run the "wetty" container. If it sees that the image has changed it will stop/remove the "wetty" container and then restart it using the new image and the same `docker run` options that were used to start the container initially (in this case, that would include the `-p 8080:3000` port mapping). From d29b6cf93eeda8cc502ebc3a1d3bdd03b1efcc32 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 15:52:56 +0200 Subject: [PATCH 14/20] add a monitor only flag --- actions/update.go | 25 +++++++++++++++++++------ main.go | 16 +++++++++++++++- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/actions/update.go b/actions/update.go index e631b1a..27fe144 100644 --- a/actions/update.go +++ b/actions/update.go @@ -12,14 +12,22 @@ var ( letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ) +type UpdateParams struct { + Filter container.Filter + Cleanup bool + NoRestart bool + Timeout time.Duration + MonitorOnly bool +} + // Update looks at the running Docker containers to see if any of the images // used to start those containers have been updated. If a change is detected in // any of the images, the associated containers are stopped and restarted with // the new image. -func Update(client container.Client, filter container.Filter, cleanup bool, noRestart bool, timeout time.Duration) error { +func Update(client container.Client, params UpdateParams) error { log.Debug("Checking containers for updated images") - containers, err := client.ListContainers(filter) + containers, err := client.ListContainers(params.Filter) if err != nil { return err } @@ -27,7 +35,8 @@ func Update(client container.Client, filter container.Filter, cleanup bool, noRe for i, container := range containers { stale, err := client.IsContainerStale(container) if err != nil { - log.Infof("Unable to update container %s, err='%s'. Proceeding to next.", containers[i].Name(), err) + log.Infof("Unable to update container %s. Proceeding to next.", containers[i].Name()) + log.Debug(err) stale = false } containers[i].Stale = stale @@ -40,6 +49,10 @@ func Update(client container.Client, filter container.Filter, cleanup bool, noRe checkDependencies(containers) + if params.MonitorOnly { + return nil + } + // Stop stale containers in reverse order for i := len(containers) - 1; i >= 0; i-- { container := containers[i] @@ -50,7 +63,7 @@ func Update(client container.Client, filter container.Filter, cleanup bool, noRe } if container.Stale { - if err := client.StopContainer(container, timeout); err != nil { + if err := client.StopContainer(container, params.Timeout); err != nil { log.Error(err) } } @@ -70,13 +83,13 @@ func Update(client container.Client, filter container.Filter, cleanup bool, noRe } } - if !noRestart { + if !params.NoRestart { if err := client.StartContainer(container); err != nil { log.Error(err) } } - if cleanup { + if params.Cleanup { client.RemoveImage(container) } } diff --git a/main.go b/main.go index c686b65..fc853fe 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,7 @@ var ( scheduleSpec string cleanup bool noRestart bool + monitorOnly bool enableLabel bool notifier *notifications.Notifier timeout time.Duration @@ -171,6 +172,11 @@ func main() { Usage: "The MSTeams notifier will try to extract log entry fields as MSTeams message facts", EnvVar: "WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA", }, + cli.BoolFlag{ + Name: "monitor-only", + Usage: "Will only monitor for new images, not update the containers", + EnvVar: "WATCHTOWER_MONITOR_ONLY", + }, } if err := app.Run(os.Args); err != nil { @@ -196,6 +202,7 @@ func before(c *cli.Context) error { cleanup = c.GlobalBool("cleanup") noRestart = c.GlobalBool("no-restart") + monitorOnly = c.GlobalBool("monitor-only") timeout = c.GlobalDuration("stop-timeout") if timeout < 0 { log.Fatal("Please specify a positive value for timeout value.") @@ -234,7 +241,14 @@ func start(c *cli.Context) error { case v := <-tryLockSem: defer func() { tryLockSem <- v }() notifier.StartNotification() - if err := actions.Update(client, filter, cleanup, noRestart, timeout); err != nil { + updateParams := actions.UpdateParams{ + Filter: filter, + Cleanup: cleanup, + NoRestart: noRestart, + Timeout: timeout, + MonitorOnly: monitorOnly, + } + if err := actions.Update(client, updateParams); err != nil { log.Println(err) } notifier.SendNotification() From 66f38bd302122c219f32a08c4049e0de678c944d Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 15:55:16 +0200 Subject: [PATCH 15/20] fix linting errors --- actions/update.go | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/update.go b/actions/update.go index 27fe144..a18ea4c 100644 --- a/actions/update.go +++ b/actions/update.go @@ -12,6 +12,7 @@ var ( letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ) +// UpdateParams contains all different options available to alter the behavior of the Update func type UpdateParams struct { Filter container.Filter Cleanup bool From 59eb978b5f0917957c37b5a985a5c30a1e675cc5 Mon Sep 17 00:00:00 2001 From: Prashanth Joseph Babu Date: Wed, 22 Aug 2018 17:47:16 +0530 Subject: [PATCH 16/20] 32bit support --- dockerfile/386/Dockerfile | 20 ++++++++++++++++++++ goreleaser.yml | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 dockerfile/386/Dockerfile diff --git a/dockerfile/386/Dockerfile b/dockerfile/386/Dockerfile new file mode 100644 index 0000000..13b19e8 --- /dev/null +++ b/dockerfile/386/Dockerfile @@ -0,0 +1,20 @@ +# +# Alpine image to get some needed data +# +FROM alpine:latest as alpine +RUN apk add --no-cache \ + ca-certificates \ + tzdata + +# +# Image +# +FROM scratch +LABEL "com.centurylinklabs.watchtower"="true" + +# copy files from other containers +COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo + +COPY watchtower / +ENTRYPOINT ["/watchtower"] \ No newline at end of file diff --git a/goreleaser.yml b/goreleaser.yml index 20c763e..a81dbf8 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -6,6 +6,7 @@ build: - windows goarch: - amd64 + - 386 - arm - arm64 archive: @@ -35,6 +36,15 @@ dockers: - containrrr/watchtower:{{ .Version }} binaries: - watchtower + - + goos: linux + goarch: 386 + goarm: '' + binary: watchtower + image: v2tec/watchtower + dockerfile: dockerfile/386/Dockerfile + tag_templates: + - '386-{{ .Version }}' - goos: linux goarch: arm From 0cd6e6954afee67ddd0418bfa04b4aed78dcb7ae Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 16:51:37 +0200 Subject: [PATCH 17/20] minor changes to make it work with new goreleaser version --- dockerfile/amd64/Dockerfile | 7 ------- dockerfile/arm64v8/Dockerfile | 7 ------- dockerfile/armhf/Dockerfile | 7 ------- dockerfile/{386 => i386}/Dockerfile | 7 ------- goreleaser.yml | 18 ++++++++++-------- 5 files changed, 10 insertions(+), 36 deletions(-) rename dockerfile/{386 => i386}/Dockerfile (79%) diff --git a/dockerfile/amd64/Dockerfile b/dockerfile/amd64/Dockerfile index 13b19e8..7594771 100644 --- a/dockerfile/amd64/Dockerfile +++ b/dockerfile/amd64/Dockerfile @@ -1,18 +1,11 @@ -# -# Alpine image to get some needed data -# FROM alpine:latest as alpine RUN apk add --no-cache \ ca-certificates \ tzdata -# -# Image -# FROM scratch LABEL "com.centurylinklabs.watchtower"="true" -# copy files from other containers COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo diff --git a/dockerfile/arm64v8/Dockerfile b/dockerfile/arm64v8/Dockerfile index 13b19e8..7594771 100644 --- a/dockerfile/arm64v8/Dockerfile +++ b/dockerfile/arm64v8/Dockerfile @@ -1,18 +1,11 @@ -# -# Alpine image to get some needed data -# FROM alpine:latest as alpine RUN apk add --no-cache \ ca-certificates \ tzdata -# -# Image -# FROM scratch LABEL "com.centurylinklabs.watchtower"="true" -# copy files from other containers COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo diff --git a/dockerfile/armhf/Dockerfile b/dockerfile/armhf/Dockerfile index 13b19e8..7594771 100644 --- a/dockerfile/armhf/Dockerfile +++ b/dockerfile/armhf/Dockerfile @@ -1,18 +1,11 @@ -# -# Alpine image to get some needed data -# FROM alpine:latest as alpine RUN apk add --no-cache \ ca-certificates \ tzdata -# -# Image -# FROM scratch LABEL "com.centurylinklabs.watchtower"="true" -# copy files from other containers COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo diff --git a/dockerfile/386/Dockerfile b/dockerfile/i386/Dockerfile similarity index 79% rename from dockerfile/386/Dockerfile rename to dockerfile/i386/Dockerfile index 13b19e8..7594771 100644 --- a/dockerfile/386/Dockerfile +++ b/dockerfile/i386/Dockerfile @@ -1,18 +1,11 @@ -# -# Alpine image to get some needed data -# FROM alpine:latest as alpine RUN apk add --no-cache \ ca-certificates \ tzdata -# -# Image -# FROM scratch LABEL "com.centurylinklabs.watchtower"="true" -# copy files from other containers COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo diff --git a/goreleaser.yml b/goreleaser.yml index a81dbf8..695f59f 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -6,7 +6,7 @@ build: - windows goarch: - amd64 - - 386 + - i386 - arm - arm64 archive: @@ -16,7 +16,7 @@ archive: arm: armhf arm64: arm64v8 amd64: amd64 - 386: 386 + 386: i386 darwin: macOS linux: linux format_overrides: @@ -38,13 +38,15 @@ dockers: - watchtower - goos: linux - goarch: 386 + goarch: i386 goarm: '' - binary: watchtower - image: v2tec/watchtower - dockerfile: dockerfile/386/Dockerfile - tag_templates: - - '386-{{ .Version }}' + dockerfile: dockerfile/i386/Dockerfile + build_flag_templates: + - "--label=com.centurylinklabs.watchtower=true" + image_templates: + - containrrr/watchtower:i386-{{ .Version }} + binaries: + - watchtower - goos: linux goarch: arm From bf9e1ed1994c44fbbfa19b37f227de7e20bc556b Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 16:56:51 +0200 Subject: [PATCH 18/20] remove erroneuos i in goreleaser --- goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goreleaser.yml b/goreleaser.yml index 695f59f..d581ae3 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -38,7 +38,7 @@ dockers: - watchtower - goos: linux - goarch: i386 + goarch: 386 goarm: '' dockerfile: dockerfile/i386/Dockerfile build_flag_templates: From 01ce9a145f4792e0d2a15db3e0533d6a02b073c6 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 16:57:35 +0200 Subject: [PATCH 19/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a671490..67db06d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

Watchtower From ebb416819c6c858f72030207c0b689d470dd5bb4 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sun, 7 Apr 2019 17:00:44 +0200 Subject: [PATCH 20/20] remove (another) erroneuos i in goreleaser --- goreleaser.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/goreleaser.yml b/goreleaser.yml index d581ae3..54ef038 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -6,7 +6,7 @@ build: - windows goarch: - amd64 - - i386 + - 386 - arm - arm64 archive: @@ -16,7 +16,7 @@ archive: arm: armhf arm64: arm64v8 amd64: amd64 - 386: i386 + 386: 386 darwin: macOS linux: linux format_overrides: