From f21133736682624d6e77427fcee96dfa34ace19e Mon Sep 17 00:00:00 2001 From: Rousseau Thibaut Date: Fri, 1 Dec 2017 14:44:45 +0100 Subject: [PATCH 01/44] feat: Add "whereNot" function --- README.md | 1 + template.go | 8 ++++++ template_test.go | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/README.md b/README.md index 3f74d2cd..d1e23cfb 100644 --- a/README.md +++ b/README.md @@ -373,6 +373,7 @@ For example, this is a JSON version of an emitted RuntimeContainer struct: * *`trim $string`*: Removes whitespace from both sides of `$string`. * *`when $condition $trueValue $falseValue`*: Returns the `$trueValue` when the `$condition` is `true` and the `$falseValue` otherwise * *`where $items $fieldPath $value`*: Filters an array or slice based on the values of a field path expression `$fieldPath`. A field path expression is a dot-delimited list of map keys or struct member names specifying the path from container to a nested value. Returns an array of items having that value. +* *`whereNot $items $fieldPath $value`*: Filters an array or slice based on the values of a field path expression `$fieldPath`. A field path expression is a dot-delimited list of map keys or struct member names specifying the path from container to a nested value. Returns an array of items **not** having that value. * *`whereExist $items $fieldPath`*: Like `where`, but returns only items where `$fieldPath` exists (is not nil). * *`whereNotExist $items $fieldPath`*: Like `where`, but returns only items where `$fieldPath` does not exist (is nil). * *`whereAny $items $fieldPath $sep $values`*: Like `where`, but the string value specified by `$fieldPath` is first split by `$sep` into a list of strings. The comparison value is a string slice with possible matches. Returns items which OR intersect these values. diff --git a/template.go b/template.go index 1eeffaf5..793396d5 100644 --- a/template.go +++ b/template.go @@ -156,6 +156,13 @@ func where(entries interface{}, key string, cmp interface{}) (interface{}, error }) } +// select entries where a key is not equal to a value +func whereNot(entries interface{}, key string, cmp interface{}) (interface{}, error) { + return generalizedWhere("whereNot", entries, key, func(value interface{}) bool { + return !reflect.DeepEqual(value, cmp) + }) +} + // selects entries where a key exists func whereExist(entries interface{}, key string) (interface{}, error) { return generalizedWhere("whereExist", entries, key, func(value interface{}) bool { @@ -442,6 +449,7 @@ func newTemplate(name string) *template.Template { "trim": trim, "when": when, "where": where, + "whereNot": whereNot, "whereExist": whereExist, "whereNotExist": whereNotExist, "whereAny": whereAny, diff --git a/template_test.go b/template_test.go index a64d3a67..dd1d58c3 100644 --- a/template_test.go +++ b/template_test.go @@ -351,6 +351,71 @@ func TestWhere(t *testing.T) { tests.run(t, "where") } +func TestWhereNot(t *testing.T) { + containers := []*RuntimeContainer{ + &RuntimeContainer{ + Env: map[string]string{ + "VIRTUAL_HOST": "demo1.localhost", + }, + ID: "1", + Addresses: []Address{ + Address{ + IP: "172.16.42.1", + Port: "80", + Proto: "tcp", + }, + }, + }, + &RuntimeContainer{ + Env: map[string]string{ + "VIRTUAL_HOST": "demo2.localhost", + }, + ID: "2", + Addresses: []Address{ + Address{ + IP: "172.16.42.1", + Port: "9999", + Proto: "tcp", + }, + }, + }, + &RuntimeContainer{ + Env: map[string]string{ + "VIRTUAL_HOST": "demo3.localhost", + }, + ID: "3", + }, + &RuntimeContainer{ + Env: map[string]string{ + "VIRTUAL_HOST": "demo2.localhost", + }, + ID: "4", + }, + } + + tests := templateTestList{ + {`{{whereNot . "Env.VIRTUAL_HOST" "demo1.localhost" | len}}`, containers, `3`}, + {`{{whereNot . "Env.VIRTUAL_HOST" "demo2.localhost" | len}}`, containers, `2`}, + {`{{whereNot . "Env.VIRTUAL_HOST" "demo3.localhost" | len}}`, containers, `3`}, + {`{{whereNot . "Env.NOEXIST" "demo3.localhost" | len}}`, containers, `4`}, + {`{{whereNot .Addresses "Port" "80" | len}}`, containers[0], `0`}, + {`{{whereNot .Addresses "Port" "80" | len}}`, containers[1], `1`}, + { + `{{whereNot . "Value" 5 | len}}`, + []struct { + Value int + }{ + {Value: 5}, + {Value: 3}, + {Value: 5}, + }, + `1`, + }, + } + + tests.run(t, "whereNot") +} + func TestWhereExist(t *testing.T) { containers := []*RuntimeContainer{ &RuntimeContainer{ From 2e4136d02d800e60480eb039adc288ea8cd55e89 Mon Sep 17 00:00:00 2001 From: Jason Wilder Date: Sun, 14 Jan 2018 14:39:24 -0700 Subject: [PATCH 02/44] Fix ECS container ID parsing ECS changed the /proc/self/cgroup paths which are used to determine the current container ID. This updates the regexes to search for the docker formatted ones and ECS one separately. --- context.go | 40 ++++++++++++++++++++++++++++++++-------- context_test.go | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 8 deletions(-) diff --git a/context.go b/context.go index f810f452..de92eb78 100644 --- a/context.go +++ b/context.go @@ -169,20 +169,44 @@ func GetCurrentContainerID() string { scanner := bufio.NewScanner(reader) scanner.Split(bufio.ScanLines) - regex := "/docker[/-]([[:alnum:]]{64})(\\.scope)?$" - re := regexp.MustCompilePOSIX(regex) - for scanner.Scan() { _, lines, err := bufio.ScanLines([]byte(scanner.Text()), true) if err == nil { - if re.MatchString(string(lines)) { - submatches := re.FindStringSubmatch(string(lines)) - containerID := submatches[1] - - return containerID + strLines := string(lines) + if id := matchDockerCurrentContainerID(strLines); id != "" { + return id + } else if matchECSCurrentContainerID(strLines); id != "" { + return id } } } return "" } + +func matchDockerCurrentContainerID(lines string) string { + regex := "/docker[/-]([[:alnum:]]{64})(\\.scope)?$" + re := regexp.MustCompilePOSIX(regex) + + if re.MatchString(lines) { + submatches := re.FindStringSubmatch(string(lines)) + containerID := submatches[1] + + return containerID + } + return "" +} + +func matchECSCurrentContainerID(lines string) string { + regex := "/ecs\\/[^\\/]+\\/(.+)$" + re := regexp.MustCompilePOSIX(regex) + + if re.MatchString(string(lines)) { + submatches := re.FindStringSubmatch(string(lines)) + containerID := submatches[1] + + return containerID + } + + return "" +} diff --git a/context_test.go b/context_test.go index b4cf87b2..4e64cc11 100644 --- a/context_test.go +++ b/context_test.go @@ -11,3 +11,42 @@ func TestGetCurrentContainerID(t *testing.T) { t.Fail() } } + +func TestGetCurrentContainerID_ECS(t *testing.T) { + cgroup := + `9:perf_event:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +8:memory:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +7:hugetlb:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +6:freezer:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +5:devices:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +4:cpuset:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +3:cpuacct:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +2:cpu:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f +1:blkio:/ecs/628967a1-46b4-4a8a-84ff-605128f4679e/3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f` + + if got, exp := matchECSCurrentContainerID(cgroup), "3c94e08259a6235781bb65f3dec91150c92e9d414ecc410d6245687392d3900f"; got != exp { + t.Fatalf("id mismatch: got %v, exp %v", got, exp) + } +} + +func TestGetCurrentContainerID_DockerCE(t *testing.T) { + cgroup := + `13:name=systemd:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +12:pids:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +11:hugetlb:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +10:net_prio:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +9:perf_event:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +8:net_cls:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +7:freezer:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +6:devices:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +5:memory:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +4:blkio:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +3:cpuacct:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +2:cpu:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb +1:cpuset:/docker-ce/docker/18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb` + + if got, exp := matchDockerCurrentContainerID(cgroup), "18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb"; got != exp { + t.Fatalf("id mismatch: got %v, exp %v", got, exp) + } + +} From f94b279fadf67b49ac49b2f893fd36dcde87e3c5 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Sun, 14 Jan 2018 19:52:37 +0100 Subject: [PATCH 03/44] Add builds for arm64 --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index e7b8c225..61daaa7c 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,10 @@ dist-clean: dist: dist-clean mkdir -p dist/alpine-linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/amd64/docker-gen ./cmd/docker-gen + mkdir -p dist/alpine-linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/arm64/docker-gen ./cmd/docker-gen mkdir -p dist/alpine-linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/armhf/docker-gen ./cmd/docker-gen mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/linux/amd64/docker-gen ./cmd/docker-gen + mkdir -p dist/linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/linux/arm64/docker-gen ./cmd/docker-gen mkdir -p dist/linux/i386 && GOOS=linux GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/linux/i386/docker-gen ./cmd/docker-gen mkdir -p dist/linux/armel && GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o dist/linux/armel/docker-gen ./cmd/docker-gen mkdir -p dist/linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -o dist/linux/armhf/docker-gen ./cmd/docker-gen @@ -30,8 +32,10 @@ dist: dist-clean release: dist glock sync -n < GLOCKFILE tar -cvzf docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen + tar -cvzf docker-gen-alpine-linux-arm64-$(TAG).tar.gz -C dist/alpine-linux/arm64 docker-gen tar -cvzf docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen tar -cvzf docker-gen-linux-amd64-$(TAG).tar.gz -C dist/linux/amd64 docker-gen + tar -cvzf docker-gen-linux-arm64-$(TAG).tar.gz -C dist/linux/arm64 docker-gen tar -cvzf docker-gen-linux-i386-$(TAG).tar.gz -C dist/linux/i386 docker-gen tar -cvzf docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen tar -cvzf docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen From 800c644608bfe57c98c35d9eb10131d83e044e2a Mon Sep 17 00:00:00 2001 From: Marius Rubin Date: Thu, 18 Jan 2018 18:19:16 +0000 Subject: [PATCH 04/44] Added missing assignment to ECS match statement --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index de92eb78..8200a4c5 100644 --- a/context.go +++ b/context.go @@ -175,7 +175,7 @@ func GetCurrentContainerID() string { strLines := string(lines) if id := matchDockerCurrentContainerID(strLines); id != "" { return id - } else if matchECSCurrentContainerID(strLines); id != "" { + } else if id:= matchECSCurrentContainerID(strLines); id != "" { return id } } From b982c4a859d43aa443a62210aaef7037cc4234ca Mon Sep 17 00:00:00 2001 From: Marius Rubin Date: Thu, 18 Jan 2018 18:37:11 +0000 Subject: [PATCH 05/44] Addressed formatting issue. --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index 8200a4c5..80a6bd7d 100644 --- a/context.go +++ b/context.go @@ -175,7 +175,7 @@ func GetCurrentContainerID() string { strLines := string(lines) if id := matchDockerCurrentContainerID(strLines); id != "" { return id - } else if id:= matchECSCurrentContainerID(strLines); id != "" { + } else if id := matchECSCurrentContainerID(strLines); id != "" { return id } } From 3ccbea76df231e04e3756f31d7144c27d7e69389 Mon Sep 17 00:00:00 2001 From: Harald Nordgren Date: Sun, 21 Oct 2018 16:26:31 +0200 Subject: [PATCH 06/44] Bump Go versions --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 545f4147..d24ce2b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: go go: -- 1.9 +- "1.9" +- "1.10" +- "1.11" install: - make get-deps script: From a6ecef715d39827ea480a91479e34fae909660a5 Mon Sep 17 00:00:00 2001 From: Harald Nordgren Date: Sun, 21 Oct 2018 18:56:08 +0200 Subject: [PATCH 07/44] Fix linter failures --- template_test.go | 8 ++++---- utils_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/template_test.go b/template_test.go index dd1d58c3..71501ada 100644 --- a/template_test.go +++ b/template_test.go @@ -71,7 +71,7 @@ func TestKeysEmpty(t *testing.T) { } if len(input) != vk.Len() { - t.Fatalf("Incorrect key count; expected %s, got %s", len(input), vk.Len()) + t.Fatalf("Incorrect key count; expected %d, got %d", len(input), vk.Len()) } } @@ -269,11 +269,11 @@ func TestGroupByMulti(t *testing.T) { } if len(groups["demo1.localhost"]) != 2 { - t.Fatalf("expected 2 got %s", len(groups["demo1.localhost"])) + t.Fatalf("expected 2 got %d", len(groups["demo1.localhost"])) } if len(groups["demo2.localhost"]) != 1 { - t.Fatalf("expected 1 got %s", len(groups["demo2.localhost"])) + t.Fatalf("expected 1 got %d", len(groups["demo2.localhost"])) } if groups["demo2.localhost"][0].(RuntimeContainer).ID != "3" { t.Fatalf("expected 2 got %s", groups["demo2.localhost"][0].(RuntimeContainer).ID) @@ -785,7 +785,7 @@ func TestJson(t *testing.T) { t.Fatal(err) } if len(decoded) != len(containers) { - t.Fatal("Incorrect unmarshaled container count. Expected %d, got %d.", len(containers), len(decoded)) + t.Fatalf("Incorrect unmarshaled container count. Expected %d, got %d.", len(containers), len(decoded)) } } diff --git a/utils_test.go b/utils_test.go index 45186ac3..c5a8c17b 100644 --- a/utils_test.go +++ b/utils_test.go @@ -30,7 +30,7 @@ func TestDockerHostEndpoint(t *testing.T) { endpoint, err := GetEndpoint("") if err != nil { - t.Fatal("%s", err) + t.Fatalf("%s", err) } if endpoint != "tcp://127.0.0.1:4243" { @@ -48,7 +48,7 @@ func TestDockerFlagEndpoint(t *testing.T) { // flag value should override DOCKER_HOST and default value endpoint, err := GetEndpoint("tcp://127.0.0.1:5555") if err != nil { - t.Fatal("%s", err) + t.Fatalf("%s", err) } if endpoint != "tcp://127.0.0.1:5555" { t.Fatalf("Expected tcp://127.0.0.1:5555, got %s", endpoint) From 6f22e5f4e9d06ba9216c2ab8c7dfac631edc8e9c Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 00:33:32 +0200 Subject: [PATCH 08/44] Adjust import path. --- cmd/docker-gen/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/docker-gen/main.go b/cmd/docker-gen/main.go index f84546a9..f6e2c44e 100644 --- a/cmd/docker-gen/main.go +++ b/cmd/docker-gen/main.go @@ -9,8 +9,8 @@ import ( "sync" "github.com/BurntSushi/toml" + "github.com/JoelLinn/docker-gen" docker "github.com/fsouza/go-dockerclient" - "github.com/jwilder/docker-gen" ) type stringslice []string From 61926c327b1500bee55879e94fcd1f56332534ab Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 00:44:36 +0200 Subject: [PATCH 09/44] Multi stage Dockerfile. Build binary in place. --- Dockerfile | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2277a2fb..cc7448ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,27 @@ +FROM golang:alpine as builder + +ARG SOURCE_REPO=github.com/JoelLinn/docker-gen + +RUN apk add --no-cache \ + git \ + make \ + gcc \ + libc-dev + +RUN go get ${SOURCE_REPO} +WORKDIR src/${SOURCE_REPO} + +RUN make get-deps +RUN make all check-gofmt test +RUN cp docker-gen / + FROM alpine:latest -LABEL maintainer="Jason Wilder " +LABEL maintainer="Joel Linn " -RUN apk -U add openssl +RUN apk --no-cache add openssl -ENV VERSION 0.7.3 -ENV DOWNLOAD_URL https://github.com/jwilder/docker-gen/releases/download/$VERSION/docker-gen-alpine-linux-amd64-$VERSION.tar.gz ENV DOCKER_HOST unix:///tmp/docker.sock -RUN wget -qO- $DOWNLOAD_URL | tar xvz -C /usr/local/bin +COPY --from=builder /docker-gen /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/docker-gen"] From 7e695f8b7a0396041ac88394c6fc36d0b8915981 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 11:28:35 +0200 Subject: [PATCH 10/44] Update dependencies: - github.com/BurntSushi/toml --- GLOCKFILE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GLOCKFILE b/GLOCKFILE index a9a6d4a7..ce233db6 100644 --- a/GLOCKFILE +++ b/GLOCKFILE @@ -1,4 +1,4 @@ -github.com/BurntSushi/toml 056c9bc7be7190eaa7715723883caffa5f8fa3e4 +github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 github.com/docker/docker f2afa26235941fd79f40eb1e572e19e4ac2b9bbe github.com/docker/go-units 0dadbb0345b35ec7ef35e228dabb8de89a65bf52 github.com/fsouza/go-dockerclient d2a6d0596004cc01062a2a068540b817f911e6dc From addea7bcecb5f56318a3bee4bbf219023e68d815 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 11:42:31 +0200 Subject: [PATCH 11/44] Update dependencies: - github.com/docker/docker to github.com/moby/moby v19.03.8 - github.com/fsouza/go-dockerclient to v1.6.5 --- GLOCKFILE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GLOCKFILE b/GLOCKFILE index ce233db6..4ca6fcf5 100644 --- a/GLOCKFILE +++ b/GLOCKFILE @@ -1,6 +1,6 @@ github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 -github.com/docker/docker f2afa26235941fd79f40eb1e572e19e4ac2b9bbe +github.com/moby/moby aa6a9891b09cce3d9004121294301a30d45d998d github.com/docker/go-units 0dadbb0345b35ec7ef35e228dabb8de89a65bf52 -github.com/fsouza/go-dockerclient d2a6d0596004cc01062a2a068540b817f911e6dc +github.com/fsouza/go-dockerclient 9abb9ed850fd14325e1f2c7d4fa47960baf980eb github.com/gorilla/mux d391bea3118c9fc17a88d62c9189bb791255e0ef golang.org/x/net a04bdaca5b32abe1c069418fb7088ae607de5bd0 From dd0d3d96f482e95ff853d14fde25e7f394a1e797 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 11:46:26 +0200 Subject: [PATCH 12/44] Update dependencies: - github.com/docker/go-units to v0.4.0 --- GLOCKFILE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GLOCKFILE b/GLOCKFILE index 4ca6fcf5..8e75582f 100644 --- a/GLOCKFILE +++ b/GLOCKFILE @@ -1,6 +1,6 @@ github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 github.com/moby/moby aa6a9891b09cce3d9004121294301a30d45d998d -github.com/docker/go-units 0dadbb0345b35ec7ef35e228dabb8de89a65bf52 +github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 github.com/fsouza/go-dockerclient 9abb9ed850fd14325e1f2c7d4fa47960baf980eb github.com/gorilla/mux d391bea3118c9fc17a88d62c9189bb791255e0ef golang.org/x/net a04bdaca5b32abe1c069418fb7088ae607de5bd0 From c8d416f18f7ed4dec8ae6f0f74912263e9642652 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 11:48:20 +0200 Subject: [PATCH 13/44] Update dependencies: - github.com/gorilla/mux to v1.7.4 --- GLOCKFILE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GLOCKFILE b/GLOCKFILE index 8e75582f..7386b6da 100644 --- a/GLOCKFILE +++ b/GLOCKFILE @@ -2,5 +2,5 @@ github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 github.com/moby/moby aa6a9891b09cce3d9004121294301a30d45d998d github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 github.com/fsouza/go-dockerclient 9abb9ed850fd14325e1f2c7d4fa47960baf980eb -github.com/gorilla/mux d391bea3118c9fc17a88d62c9189bb791255e0ef +github.com/gorilla/mux 75dcda0896e109a2a22c9315bca3bb21b87b2ba5 golang.org/x/net a04bdaca5b32abe1c069418fb7088ae607de5bd0 From e660381cf23096092d728f671760689bab62d78f Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 11:50:49 +0200 Subject: [PATCH 14/44] Update dependencies: - golang.org/x/net --- GLOCKFILE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GLOCKFILE b/GLOCKFILE index 7386b6da..bf9cc00e 100644 --- a/GLOCKFILE +++ b/GLOCKFILE @@ -3,4 +3,4 @@ github.com/moby/moby aa6a9891b09cce3d9004121294301a30d45d998d github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 github.com/fsouza/go-dockerclient 9abb9ed850fd14325e1f2c7d4fa47960baf980eb github.com/gorilla/mux 75dcda0896e109a2a22c9315bca3bb21b87b2ba5 -golang.org/x/net a04bdaca5b32abe1c069418fb7088ae607de5bd0 +golang.org/x/net e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f From 56a42df5fb9d87ba06d02f7e0bbfb7e8be2f0c0a Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 12:04:41 +0200 Subject: [PATCH 15/44] Update golang version in travis. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d24ce2b2..0740f60e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: go go: -- "1.9" -- "1.10" -- "1.11" +- "1.12" +- "1.13" +- "1.14" install: - make get-deps script: From 34afeaca8070cd0bfe00568090589641d84fafb9 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 12:04:54 +0200 Subject: [PATCH 16/44] Change repository URLs. --- README.md | 26 +++++++++++++------------- examples/docker-gen.service | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d1e23cfb..b7d07da2 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,16 @@ docker-gen ===== ![latest 0.7.3](https://img.shields.io/badge/latest-0.7.3-green.svg?style=flat) -[![Build Status](https://travis-ci.org/jwilder/docker-gen.svg?branch=master)](https://travis-ci.org/jwilder/docker-gen) +[![Build Status](https://travis-ci.org/joellinn/docker-gen.svg?branch=master)](https://travis-ci.org/github/joellinn/docker-gen) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) `docker-gen` is a file generator that renders templates using docker container meta-data. It can be used to generate various kinds of files for: - * **Centralized logging** - [fluentd](https://github.com/jwilder/docker-gen/blob/master/templates/fluentd.conf.tmpl), logstash or other centralized logging tools that tail the containers JSON log file or files within the container. - * **Log Rotation** - [logrotate](https://github.com/jwilder/docker-gen/blob/master/templates/logrotate.tmpl) files to rotate container JSON log files - * **Reverse Proxy Configs** - [nginx](https://github.com/jwilder/docker-gen/blob/master/templates/nginx.tmpl), [haproxy](https://github.com/jwilder/docker-discover), etc. reverse proxy configs to route requests from the host to containers + * **Centralized logging** - [fluentd](https://github.com/joellinn/docker-gen/blob/master/templates/fluentd.conf.tmpl), logstash or other centralized logging tools that tail the containers JSON log file or files within the container. + * **Log Rotation** - [logrotate](https://github.com/joellinn/docker-gen/blob/master/templates/logrotate.tmpl) files to rotate container JSON log files + * **Reverse Proxy Configs** - [nginx](https://github.com/joellinn/docker-gen/blob/master/templates/nginx.tmpl), [haproxy](https://github.com/jwilder/docker-discover), etc. reverse proxy configs to route requests from the host to containers * **Service Discovery** - Scripts (python, bash, etc..) to register containers within [etcd](https://github.com/jwilder/docker-register), hipache, etc.. === @@ -25,16 +25,16 @@ There are three common ways to run docker-gen: #### Host Install -Linux/OSX binaries for release [0.7.3](https://github.com/jwilder/docker-gen/releases) +Linux/OSX binaries for release [0.7.3](https://github.com/joellinn/docker-gen/releases) -* [amd64](https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz) -* [i386](https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-linux-i386-0.7.3.tar.gz) -* [alpine-linux](https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-alpine-linux-amd64-0.7.3.tar.gz) +* [amd64](https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz) +* [i386](https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-linux-i386-0.7.3.tar.gz) +* [alpine-linux](https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-alpine-linux-amd64-0.7.3.tar.gz) Download the version you need, untar, and install to your PATH. ``` -$ wget https://github.com/jwilder/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz +$ wget https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz $ tar xvzf docker-gen-linux-amd64-0.7.3.tar.gz $ ./docker-gen ``` @@ -50,7 +50,7 @@ docker-gen within a container to do service registration with etcd. #### Separate Container Install -It can also be run as two separate containers using the [jwilder/docker-gen](https://index.docker.io/u/jwilder/docker-gen/) +It can also be run as two separate containers using the [joellinn/docker-gen](https://index.docker.io/u/joellinn/docker-gen/) image, together with virtually any other image. This is how you could run the official [nginx](https://registry.hub.docker.com/_/nginx/) image and @@ -66,11 +66,11 @@ $ docker run -d -p 80:80 --name nginx -v /tmp/nginx:/etc/nginx/conf.d -t nginx Fetch the template and start the docker-gen container with the shared volume: ``` $ mkdir -p /tmp/templates && cd /tmp/templates -$ curl -o nginx.tmpl https://raw.githubusercontent.com/jwilder/docker-gen/master/templates/nginx.tmpl +$ curl -o nginx.tmpl https://raw.githubusercontent.com/joellinn/docker-gen/master/templates/nginx.tmpl $ docker run -d --name nginx-gen --volumes-from nginx \ -v /var/run/docker.sock:/tmp/docker.sock:ro \ -v /tmp/templates:/etc/docker-gen/templates \ - -t jwilder/docker-gen -notify-sighup nginx -watch -only-exposed /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf + -t joellinn/docker-gen -notify-sighup nginx -watch -only-exposed /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf ``` === @@ -363,7 +363,7 @@ For example, this is a JSON version of an emitted RuntimeContainer struct: * *`json $value`*: Returns the JSON representation of `$value` as a `string`. * *`keys $map`*: Returns the keys from `$map`. If `$map` is `nil`, a `nil` is returned. If `$map` is not a `map`, an error will be thrown. * *`last $array`*: Returns the last value of an array. -* *`parseBool $string`*: parseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error. Alias for [`strconv.ParseBool`](http://golang.org/pkg/strconv/#ParseBool) +* *`parseBool $string`*: parseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error. Alias for [`strconv.ParseBool`](http://golang.org/pkg/strconv/#ParseBool) * *`replace $string $old $new $count`*: Replaces up to `$count` occurences of `$old` with `$new` in `$string`. Alias for [`strings.Replace`](http://golang.org/pkg/strings/#Replace) * *`sha1 $string`*: Returns the hexadecimal representation of the SHA1 hash of `$string`. * *`split $string $sep`*: Splits `$string` into a slice of substrings delimited by `$sep`. Alias for [`strings.Split`](http://golang.org/pkg/strings/#Split) diff --git a/examples/docker-gen.service b/examples/docker-gen.service index 4bd43b33..d4133265 100644 --- a/examples/docker-gen.service +++ b/examples/docker-gen.service @@ -1,6 +1,6 @@ [Unit] Description=A file generator that renders templates using Docker Container meta-data. -Documentation=https://github.com/jwilder/docker-gen +Documentation=https://github.com/joellinn/docker-gen After=network.target docker.socket Requires=docker.socket From c1f43a951e98ffda283a306dd65fc877d4d737dc Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 12:07:23 +0200 Subject: [PATCH 17/44] Simplify readme. --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b7d07da2..e4f75184 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,13 @@ There are three common ways to run docker-gen: #### Host Install -Linux/OSX binaries for release [0.7.3](https://github.com/joellinn/docker-gen/releases) - -* [amd64](https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz) -* [i386](https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-linux-i386-0.7.3.tar.gz) -* [alpine-linux](https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-alpine-linux-amd64-0.7.3.tar.gz) +Linux/OSX binaries for [release](https://github.com/joellinn/docker-gen/releases) Download the version you need, untar, and install to your PATH. ``` -$ wget https://github.com/joellinn/docker-gen/releases/download/0.7.3/docker-gen-linux-amd64-0.7.3.tar.gz -$ tar xvzf docker-gen-linux-amd64-0.7.3.tar.gz +$ wget https://github.com/joellinn/docker-gen/releases/download/VERSION/docker-gen-linux-amd64-VERSION.tar.gz +$ tar xvzf docker-gen-linux-amd64-VERSION.tar.gz $ ./docker-gen ``` From c61e383e593ef928e0afafae7283e300a7266088 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 12:09:22 +0200 Subject: [PATCH 18/44] Bump version to v0.8.0 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4f75184..89465230 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ docker-gen ===== -![latest 0.7.3](https://img.shields.io/badge/latest-0.7.3-green.svg?style=flat) +![latest 0.8.0](https://img.shields.io/badge/latest-0.8.0-green.svg?style=flat) [![Build Status](https://travis-ci.org/joellinn/docker-gen.svg?branch=master)](https://travis-ci.org/github/joellinn/docker-gen) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) From a8bcfe7980958461ed05ab5241ee04a04e6147bf Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 12:19:30 +0200 Subject: [PATCH 19/44] Remove go version 1.12 from travis. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0740f60e..6753ce44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: go go: -- "1.12" - "1.13" - "1.14" install: From d8a5cf7a342954aeab1b517fbcab962e75910713 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 15:14:42 +0200 Subject: [PATCH 20/44] Disable tests in dockerfile. Docker hub build servers are to slow it seems. --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cc7448ed..f765745c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,8 @@ RUN go get ${SOURCE_REPO} WORKDIR src/${SOURCE_REPO} RUN make get-deps -RUN make all check-gofmt test +# Tests are disabled here because docker build servers are to slow for ms dependent tests +RUN make all check-gofmt RUN cp docker-gen / FROM alpine:latest From e75e7d2fb76c7aeb74505614f5ef08de7b8ad075 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 16:21:26 +0200 Subject: [PATCH 21/44] User docker/docker isntead of moby/moby again. github.com/fsouza/go-dockerclient still uses the old alias. --- GLOCKFILE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GLOCKFILE b/GLOCKFILE index bf9cc00e..b505bf19 100644 --- a/GLOCKFILE +++ b/GLOCKFILE @@ -1,5 +1,5 @@ github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 -github.com/moby/moby aa6a9891b09cce3d9004121294301a30d45d998d +github.com/docker/docker aa6a9891b09cce3d9004121294301a30d45d998d github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 github.com/fsouza/go-dockerclient 9abb9ed850fd14325e1f2c7d4fa47960baf980eb github.com/gorilla/mux 75dcda0896e109a2a22c9315bca3bb21b87b2ba5 From a7d6c660c5369ffe241a7d4893bbb0ff92e82f86 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 16:39:36 +0200 Subject: [PATCH 22/44] Fix exit(2) on SIGHUP before fully initialized. Fixes https://github.com/jwilder/docker-gen/issues/244 --- cmd/docker-gen/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/docker-gen/main.go b/cmd/docker-gen/main.go index f6e2c44e..b503ecfe 100644 --- a/cmd/docker-gen/main.go +++ b/cmd/docker-gen/main.go @@ -5,8 +5,10 @@ import ( "fmt" "log" "os" + "os/signal" "path/filepath" "sync" + "syscall" "github.com/BurntSushi/toml" "github.com/JoelLinn/docker-gen" @@ -111,6 +113,10 @@ func initFlags() { } func main() { + // SIGHUP is used to trigger generation but go programs call os.Exit(2) at default. + // Ignore the signal until the handler is registered: + signal.Ignore(syscall.SIGHUP) + initFlags() if version { From e5fb8a0cb83d27f043bc45fabb88049754213aa9 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sat, 2 May 2020 16:42:05 +0200 Subject: [PATCH 23/44] Bump version to 0.8.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89465230..cbddadbb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ docker-gen ===== -![latest 0.8.0](https://img.shields.io/badge/latest-0.8.0-green.svg?style=flat) +![latest 0.8.1](https://img.shields.io/badge/latest-0.8.1-green.svg?style=flat) [![Build Status](https://travis-ci.org/joellinn/docker-gen.svg?branch=master)](https://travis-ci.org/github/joellinn/docker-gen) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) From d736d78d905b7321a45c77dff18c5f35d6fd675b Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 9 Jun 2020 13:49:28 +0000 Subject: [PATCH 24/44] Add Labels to SwarmNode #303 https://github.com/jwilder/docker-gen/pull/303 --- context.go | 1 + generator.go | 1 + 2 files changed, 2 insertions(+) diff --git a/context.go b/context.go index 80a6bd7d..4c53e487 100644 --- a/context.go +++ b/context.go @@ -135,6 +135,7 @@ type SwarmNode struct { ID string Name string Address Address + Labels map[string]string } type Mount struct { diff --git a/generator.go b/generator.go index bf68be66..8f7afd59 100644 --- a/generator.go +++ b/generator.go @@ -434,6 +434,7 @@ func (g *generator) getContainers() ([]*RuntimeContainer, error) { runtimeContainer.Node.Address = Address{ IP: container.Node.IP, } + runtimeContainer.Node.Labels = container.Node.Labels } for _, v := range container.Mounts { From a2dd1edcd0775d50ca848bc5950e5e5b24c28ec2 Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 9 Jun 2020 14:14:35 +0000 Subject: [PATCH 25/44] Add NetworkMode to RuntimeContainer #287. https://github.com/jwilder/docker-gen/pull/287 --- context.go | 1 + generator.go | 1 + generator_test.go | 3 +++ 3 files changed, 5 insertions(+) diff --git a/context.go b/context.go index 4c53e487..98329615 100644 --- a/context.go +++ b/context.go @@ -88,6 +88,7 @@ type RuntimeContainer struct { Gateway string Name string Hostname string + NetworkMode string Image DockerImage Env map[string]string Volumes map[string]Volume diff --git a/generator.go b/generator.go index 8f7afd59..63cb0115 100644 --- a/generator.go +++ b/generator.go @@ -379,6 +379,7 @@ func (g *generator) getContainers() ([]*RuntimeContainer, error) { Name: strings.TrimLeft(container.Name, "/"), Hostname: container.Config.Hostname, Gateway: container.NetworkSettings.Gateway, + NetworkMode: container.HostConfig.NetworkMode, Addresses: []Address{}, Networks: []Network{}, Env: make(map[string]string), diff --git a/generator_test.go b/generator_test.go index 87b8ce71..c1918e74 100644 --- a/generator_test.go +++ b/generator_test.go @@ -79,6 +79,9 @@ func TestGenerateFromEvents(t *testing.T) { Cmd: []string{"/bin/sh"}, Image: "base:latest", }, + HostConfig: &docker.HostConfig{ + NetworkMode: "container:d246e2c9e3d465d96359c942e91de493f6d51a01ba33900d865180d64c34ee91", + }, State: docker.State{ Running: true, Pid: 400, From 214ff5864a688d27b14db506b7e5d145f5ff58a6 Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 9 Jun 2020 22:22:40 +0000 Subject: [PATCH 26/44] Add toLower and toUpper functions #306 https://github.com/jwilder/docker-gen/pull/306/files --- README.md | 2 ++ template.go | 12 ++++++++++++ template_test.go | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/README.md b/README.md index cbddadbb..132ff340 100644 --- a/README.md +++ b/README.md @@ -367,6 +367,8 @@ For example, this is a JSON version of an emitted RuntimeContainer struct: * *`trimPrefix $prefix $string`*: If `$prefix` is a prefix of `$string`, return `$string` with `$prefix` trimmed from the beginning. Otherwise, return `$string` unchanged. * *`trimSuffix $suffix $string`*: If `$suffix` is a suffix of `$string`, return `$string` with `$suffix` trimmed from the end. Otherwise, return `$string` unchanged. * *`trim $string`*: Removes whitespace from both sides of `$string`. +* *`toLower $string`*: Replace capital letters in `$string` to lowercase. +* *`toUpper $string`*: Replace lowercase letters in `$string` to uppercase. * *`when $condition $trueValue $falseValue`*: Returns the `$trueValue` when the `$condition` is `true` and the `$falseValue` otherwise * *`where $items $fieldPath $value`*: Filters an array or slice based on the values of a field path expression `$fieldPath`. A field path expression is a dot-delimited list of map keys or struct member names specifying the path from container to a nested value. Returns an array of items having that value. * *`whereNot $items $fieldPath $value`*: Filters an array or slice based on the values of a field path expression `$fieldPath`. A field path expression is a dot-delimited list of map keys or struct member names specifying the path from container to a nested value. Returns an array of items **not** having that value. diff --git a/template.go b/template.go index 793396d5..6a45da4d 100644 --- a/template.go +++ b/template.go @@ -409,6 +409,16 @@ func trim(s string) string { return strings.TrimSpace(s) } +// toLower return the string in lower case +func toLower(s string) string { + return strings.ToLower(s) +} + +// toUpper return the string in upper case +func toUpper(s string) string { + return strings.ToUpper(s) +} + // when returns the trueValue when the condition is true and the falseValue otherwise func when(condition bool, trueValue, falseValue interface{}) interface{} { if condition { @@ -447,6 +457,8 @@ func newTemplate(name string) *template.Template { "trimPrefix": trimPrefix, "trimSuffix": trimSuffix, "trim": trim, + "toLower": toLower, + "toUpper": toUpper, "when": when, "where": where, "whereNot": whereNot, diff --git a/template_test.go b/template_test.go index 71501ada..f8ac3c88 100644 --- a/template_test.go +++ b/template_test.go @@ -709,6 +709,24 @@ func TestTrim(t *testing.T) { } } +func TestToLower(t *testing.T) { + const str = ".RaNd0m StrinG_" + const lowered = ".rand0m string_" + got := toLower(str) + if got != lowered { + t.Fatalf("Expected toLower(%s) to be '%s', got '%s'", str, lowered, got) + } +} + +func TestToUpper(t *testing.T) { + const str = ".RaNd0m StrinG_" + const uppered = ".RAND0M STRING_" + got := toUpper(str) + if got != uppered { + t.Fatalf("Expected toUpper(%s) to be '%s', got '%s'", str, uppered, got) + } +} + func TestDict(t *testing.T) { containers := []*RuntimeContainer{ &RuntimeContainer{ From a5abae3dbe61d380de7da34afe3ddf1e4150dc8a Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 9 Jun 2020 23:03:00 +0000 Subject: [PATCH 27/44] Allow more notify and restart options #283 https://github.com/jwilder/docker-gen/pull/283 --- README.md | 7 ++++++- cmd/docker-gen/main.go | 12 +++++++----- generator.go | 8 ++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 132ff340..acce932d 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,13 @@ Options: run command after template is regenerated (e.g restart xyz) -notify-output log the output(stdout/stderr) of notify command + -notify-container container-ID + container to send a signal to + -notify-signal signal + signal to send to the -notify-container. -1 to call docker restart. Defaults to 1 aka. HUP. + All available signals available on the [dockerclient](https://github.com/fsouza/go-dockerclient/blob/01804dec8a84d0a77e63611f2b62d33e9bb2b64a/signal.go) -notify-sighup container-ID - send HUP signal to container. Equivalent to 'docker kill -s HUP container-ID' + send HUP signal to container. Equivalent to 'docker kill -s HUP container-ID' or `-notify-container container-ID -notify-signal 1` -only-exposed only include containers with exposed ports -only-published diff --git a/cmd/docker-gen/main.go b/cmd/docker-gen/main.go index b503ecfe..cd750cf5 100644 --- a/cmd/docker-gen/main.go +++ b/cmd/docker-gen/main.go @@ -24,7 +24,8 @@ var ( wait string notifyCmd string notifyOutput bool - notifySigHUPContainerID string + notifyContainerID string + notifyContainerSignal int onlyExposed bool onlyPublished bool includeStopped bool @@ -97,8 +98,9 @@ func initFlags() { flag.BoolVar(&includeStopped, "include-stopped", false, "include stopped containers") flag.BoolVar(¬ifyOutput, "notify-output", false, "log the output(stdout/stderr) of notify command") flag.StringVar(¬ifyCmd, "notify", "", "run command after template is regenerated (e.g `restart xyz`)") - flag.StringVar(¬ifySigHUPContainerID, "notify-sighup", "", - "send HUP signal to container. Equivalent to docker kill -s HUP `container-ID`") + flag.StringVar(¬ifyContainerID, "notify-sighup", "", "send HUP signal to container. Equivalent to docker kill -s HUP `container-ID`") + flag.StringVar(¬ifyContainerID, "notify-container", "", "container to send a signal to") + flag.IntVar(¬ifyContainerSignal, "notify-signal", int(docker.SIGHUP), "signal to send to the notify-container. Defaults to SIGHUP") flag.Var(&configFiles, "config", "config files with template directives. Config files will be merged if this option is specified multiple times.") flag.IntVar(&interval, "interval", 0, "notify command interval (secs)") flag.BoolVar(&keepBlankLines, "keep-blank-lines", false, "keep blank lines in the output file") @@ -155,8 +157,8 @@ func main() { Interval: interval, KeepBlankLines: keepBlankLines, } - if notifySigHUPContainerID != "" { - config.NotifyContainers[notifySigHUPContainerID] = docker.SIGHUP + if notifyContainerID != "" { + config.NotifyContainers[notifyContainerID] = docker.Signal(notifyContainerSignal) } configs = dockergen.ConfigFile{ Config: []dockergen.Config{config}} diff --git a/generator.go b/generator.go index 63cb0115..a330f0f9 100644 --- a/generator.go +++ b/generator.go @@ -331,6 +331,14 @@ func (g *generator) sendSignalToContainer(config Config) { for container, signal := range config.NotifyContainers { log.Printf("Sending container '%s' signal '%v'", container, signal) + + if signal == -1 { + if err := g.Client.RestartContainer(container, 10); err != nil { + log.Printf("Error sending restarting container: %s", err) + } + return + } + killOpts := docker.KillContainerOptions{ ID: container, Signal: signal, From 7521952e223afa3b950492bf38c5c73a54ee3bd6 Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 9 Jun 2020 23:25:42 +0000 Subject: [PATCH 28/44] gofmt fixes --- cmd/docker-gen/main.go | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/cmd/docker-gen/main.go b/cmd/docker-gen/main.go index cd750cf5..727a3ca7 100644 --- a/cmd/docker-gen/main.go +++ b/cmd/docker-gen/main.go @@ -18,28 +18,28 @@ import ( type stringslice []string var ( - buildVersion string - version bool - watch bool - wait string - notifyCmd string - notifyOutput bool - notifyContainerID string - notifyContainerSignal int - onlyExposed bool - onlyPublished bool - includeStopped bool - configFiles stringslice - configs dockergen.ConfigFile - interval int - keepBlankLines bool - endpoint string - tlsCert string - tlsKey string - tlsCaCert string - tlsVerify bool - tlsCertPath string - wg sync.WaitGroup + buildVersion string + version bool + watch bool + wait string + notifyCmd string + notifyOutput bool + notifyContainerID string + notifyContainerSignal int + onlyExposed bool + onlyPublished bool + includeStopped bool + configFiles stringslice + configs dockergen.ConfigFile + interval int + keepBlankLines bool + endpoint string + tlsCert string + tlsKey string + tlsCaCert string + tlsVerify bool + tlsCertPath string + wg sync.WaitGroup ) func (strings *stringslice) String() string { From 251ba98b838a1343280b52b1f9717ce5f0012b2c Mon Sep 17 00:00:00 2001 From: bugficks Date: Sat, 11 Jul 2020 06:19:10 +0000 Subject: [PATCH 29/44] use go modules --- GLOCKFILE | 6 -- Makefile | 6 +- cmd/docker-gen/main.go | 4 +- go.mod | 8 ++ go.sum | 164 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 177 insertions(+), 11 deletions(-) delete mode 100644 GLOCKFILE create mode 100644 go.mod create mode 100644 go.sum diff --git a/GLOCKFILE b/GLOCKFILE deleted file mode 100644 index b505bf19..00000000 --- a/GLOCKFILE +++ /dev/null @@ -1,6 +0,0 @@ -github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 -github.com/docker/docker aa6a9891b09cce3d9004121294301a30d45d998d -github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 -github.com/fsouza/go-dockerclient 9abb9ed850fd14325e1f2c7d4fa47960baf980eb -github.com/gorilla/mux 75dcda0896e109a2a22c9315bca3bb21b87b2ba5 -golang.org/x/net e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f diff --git a/Makefile b/Makefile index 61daaa7c..6fa9b1eb 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ dist: dist-clean release: dist - glock sync -n < GLOCKFILE + go mod tidy tar -cvzf docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen tar -cvzf docker-gen-alpine-linux-arm64-$(TAG).tar.gz -C dist/alpine-linux/arm64 docker-gen tar -cvzf docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen @@ -43,8 +43,6 @@ release: dist tar -cvzf docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen get-deps: - go get github.com/robfig/glock - glock sync -n < GLOCKFILE check-gofmt: if [ -n "$(shell gofmt -l .)" ]; then \ @@ -54,4 +52,4 @@ check-gofmt: fi test: - go test + go test ./... diff --git a/cmd/docker-gen/main.go b/cmd/docker-gen/main.go index 727a3ca7..a75f9d44 100644 --- a/cmd/docker-gen/main.go +++ b/cmd/docker-gen/main.go @@ -11,7 +11,9 @@ import ( "syscall" "github.com/BurntSushi/toml" - "github.com/JoelLinn/docker-gen" + //dockergen "github.com/JoelLinn/docker-gen" + //dockergen "../.." + dockergen "docker-gen" docker "github.com/fsouza/go-dockerclient" ) diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..609aabfe --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module docker-gen + +go 1.13 + +require ( + github.com/BurntSushi/toml v0.3.1 + github.com/fsouza/go-dockerclient v1.6.5 +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..b828ab1d --- /dev/null +++ b/go.sum @@ -0,0 +1,164 @@ +bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= +github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= +github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0 h1:xjvXQWABwS2uiv3TWgQt5Uth60Gu86LTGZXMJkjc7rY= +github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c h1:8ahmSVELW1wghbjerVAyuEYD5+Dio66RYvSS0iGfL1M= +github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= +github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +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/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 v1.4.2-0.20191101170500-ac7306503d23 h1:oqgGT9O61YAYvI41EBsLePOr+LE6roB0xY4gpkZuFSE= +github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +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-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsouza/go-dockerclient v1.6.5 h1:vuFDnPcds3LvTWGYb9h0Rty14FLgkjHZdwLDROCdgsw= +github.com/fsouza/go-dockerclient v1.6.5/go.mod h1:GOdftxWLWIbIWKbIMDroKFJzPdg6Iw7r+jX1DDZdVsA= +github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +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/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= +github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +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/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +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.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= +github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/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_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +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.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/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.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/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-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo= +golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +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/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +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-20180906233101-161cd47e91fd/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-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/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/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/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-20180909124046-d0be0721c37e/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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/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= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +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-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= From 71b1c1809ebeaa696265f24ec29180b3a4507067 Mon Sep 17 00:00:00 2001 From: bugficks Date: Sat, 11 Jul 2020 06:30:31 +0000 Subject: [PATCH 30/44] add setHTPasswd method --- README.md | 1 + go.mod | 1 + go.sum | 5 +++++ template.go | 10 ++++++++++ 4 files changed, 17 insertions(+) diff --git a/README.md b/README.md index acce932d..1621f8dc 100644 --- a/README.md +++ b/README.md @@ -367,6 +367,7 @@ For example, this is a JSON version of an emitted RuntimeContainer struct: * *`parseBool $string`*: parseBool returns the boolean value represented by the string. It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. Any other value returns an error. Alias for [`strconv.ParseBool`](http://golang.org/pkg/strconv/#ParseBool) * *`replace $string $old $new $count`*: Replaces up to `$count` occurences of `$old` with `$new` in `$string`. Alias for [`strings.Replace`](http://golang.org/pkg/strings/#Replace) * *`sha1 $string`*: Returns the hexadecimal representation of the SHA1 hash of `$string`. +* *`setHTPasswd $file $user $password`*: Creates or adds `$user` with `$password` to htpasswd `$file`. * *`split $string $sep`*: Splits `$string` into a slice of substrings delimited by `$sep`. Alias for [`strings.Split`](http://golang.org/pkg/strings/#Split) * *`splitN $string $sep $count`*: Splits `$string` into a slice of substrings delimited by `$sep`, with number of substrings returned determined by `$count`. Alias for [`strings.SplitN`](https://golang.org/pkg/strings/#SplitN) * *`trimPrefix $prefix $string`*: If `$prefix` is a prefix of `$string`, return `$string` with `$prefix` trimmed from the beginning. Otherwise, return `$string` unchanged. diff --git a/go.mod b/go.mod index 609aabfe..3256075b 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,6 @@ go 1.13 require ( github.com/BurntSushi/toml v0.3.1 + github.com/foomo/htpasswd v0.0.0-20200116085101-e3a90e78da9c github.com/fsouza/go-dockerclient v1.6.5 ) diff --git a/go.sum b/go.sum index b828ab1d..c4a375b8 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/GehirnInc/crypt v0.0.0-20190301055215-6c0105aabd46 h1:rs0kDBt2zF4/CM9rO5/iH+U22jnTygPlqWgX55Ufcxg= +github.com/GehirnInc/crypt v0.0.0-20190301055215-6c0105aabd46/go.mod h1:kC29dT1vFpj7py2OvG1khBdQpo3kInWP+6QipLbdngo= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= @@ -35,6 +37,8 @@ github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/foomo/htpasswd v0.0.0-20200116085101-e3a90e78da9c h1:DBGU7zCwrrPPDsD6+gqKG8UfMxenWg9BOJE/Nmfph+4= +github.com/foomo/htpasswd v0.0.0-20200116085101-e3a90e78da9c/go.mod h1:SHawtolbB0ZOFoRWgDwakX5WpwuIWAK88bUXVZqK0Ss= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsouza/go-dockerclient v1.6.5 h1:vuFDnPcds3LvTWGYb9h0Rty14FLgkjHZdwLDROCdgsw= github.com/fsouza/go-dockerclient v1.6.5/go.mod h1:GOdftxWLWIbIWKbIMDroKFJzPdg6Iw7r+jX1DDZdVsA= @@ -101,6 +105,7 @@ github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/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-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= diff --git a/template.go b/template.go index 6a45da4d..9345d8e9 100644 --- a/template.go +++ b/template.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/foomo/htpasswd" "io" "io/ioutil" "log" @@ -319,6 +320,14 @@ func hashSha1(input string) string { return fmt.Sprintf("%x", h.Sum(nil)) } +func setHTPasswd(file, name, password string) (bool, error) { + err := htpasswd.SetPassword(file, name, password, htpasswd.HashBCrypt) + if err != nil { + return false, err + } + return true, nil +} + func marshalJson(input interface{}) (string, error) { var buf bytes.Buffer enc := json.NewEncoder(&buf) @@ -452,6 +461,7 @@ func newTemplate(name string) *template.Template { "parseJson": unmarshalJson, "queryEscape": url.QueryEscape, "sha1": hashSha1, + "setHTPasswd": setHTPasswd, "split": strings.Split, "splitN": strings.SplitN, "trimPrefix": trimPrefix, From 0b289f0c541ea51279f9fd8a71edffba32ade0ad Mon Sep 17 00:00:00 2001 From: bugficks Date: Sat, 11 Jul 2020 11:10:47 +0000 Subject: [PATCH 31/44] change repo url --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f765745c..4d0c96d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:alpine as builder -ARG SOURCE_REPO=github.com/JoelLinn/docker-gen +ARG SOURCE_REPO=github.com/bugficks/docker-gen RUN apk add --no-cache \ git \ @@ -11,13 +11,16 @@ RUN apk add --no-cache \ RUN go get ${SOURCE_REPO} WORKDIR src/${SOURCE_REPO} +COPY . /build +WORKDIR /build + RUN make get-deps -# Tests are disabled here because docker build servers are to slow for ms dependent tests +# Tests are disabled here because docker build servers are too slow for ms dependent tests RUN make all check-gofmt RUN cp docker-gen / FROM alpine:latest -LABEL maintainer="Joel Linn " +LABEL maintainer="github.com/bugficks/docker-gen" RUN apk --no-cache add openssl From 68bb4b2ea8bf40a5542f0989b10bf9321b0ad21e Mon Sep 17 00:00:00 2001 From: bugficks Date: Sat, 11 Jul 2020 11:12:29 +0000 Subject: [PATCH 32/44] fix linux built bin won't run on alpine --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6fa9b1eb..8e13e49f 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ .SILENT : -.PHONY : docker-gen clean fmt +.PHONY : docker-gen dist dist-clean release check-gofmt test TAG:=`git describe --tags` LDFLAGS:=-X main.buildVersion=$(TAG) +# https://stackoverflow.com/a/58185179 +LDFLAGS+=-linkmode external -w -extldflags "-static" all: docker-gen From 7602e67ae3be0e09db9277451b179ebb63070214 Mon Sep 17 00:00:00 2001 From: bugficks Date: Sat, 11 Jul 2020 16:05:05 +0000 Subject: [PATCH 33/44] CircleCI --- .circleci/config.yml | 38 ++++++++++++++++++++++++++++++++++++++ Makefile | 36 +++++++++++++++++------------------- 2 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..96f04f6e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,38 @@ +# Golang CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-go/ for more details +version: 2 +jobs: + build: + docker: + # specify the version + - image: circleci/golang:1.13 + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/postgres:9.4 + + #### TEMPLATE_NOTE: go expects specific checkout path representing url + #### expecting it in the form of + #### /go/src/github.com/circleci/go-tool + #### /go/src/bitbucket.org/circleci/go-tool + working_directory: /go/src/github.com/bugficks/docker-gen + steps: + - add_ssh_keys: + fingerprints: + - "5c:26:7f:82:3f:d7:78:22:07:65:c4:c1:e2:b1:c9:ce" + + - checkout + - attach_workspace: + at: ./release + + # specify any bash command here prefixed with `run: ` + - run: make test check-gofmt all + - run: make release + - run: + name: "Publish Release on GitHub" + command: | + go get github.com/tcnksm/ghr + TAG=$(git describe --tags) + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${TAG} ./release/ diff --git a/Makefile b/Makefile index 8e13e49f..5123792f 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ TAG:=`git describe --tags` LDFLAGS:=-X main.buildVersion=$(TAG) # https://stackoverflow.com/a/58185179 -LDFLAGS+=-linkmode external -w -extldflags "-static" +LDFLAGS_EXTRA=-linkmode external -w -extldflags "-static" all: docker-gen @@ -13,16 +13,15 @@ docker-gen: go build -ldflags "$(LDFLAGS)" ./cmd/docker-gen dist-clean: - rm -rf dist - rm -f docker-gen-alpine-linux-*.tar.gz - rm -f docker-gen-linux-*.tar.gz - rm -f docker-gen-darwin-*.tar.gz + go mod tidy + rm -rf dist release/ + rm -f docker-gen dist: dist-clean - mkdir -p dist/alpine-linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/amd64/docker-gen ./cmd/docker-gen + mkdir -p dist/alpine-linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS) ${LDFLAGS_EXTRA}" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/amd64/docker-gen ./cmd/docker-gen mkdir -p dist/alpine-linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/arm64/docker-gen ./cmd/docker-gen mkdir -p dist/alpine-linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/armhf/docker-gen ./cmd/docker-gen - mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/linux/amd64/docker-gen ./cmd/docker-gen + mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS) ${LDFLAGS_EXTRA}" -o dist/linux/amd64/docker-gen ./cmd/docker-gen mkdir -p dist/linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/linux/arm64/docker-gen ./cmd/docker-gen mkdir -p dist/linux/i386 && GOOS=linux GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/linux/i386/docker-gen ./cmd/docker-gen mkdir -p dist/linux/armel && GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o dist/linux/armel/docker-gen ./cmd/docker-gen @@ -30,19 +29,18 @@ dist: dist-clean mkdir -p dist/darwin/amd64 && GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/darwin/amd64/docker-gen ./cmd/docker-gen mkdir -p dist/darwin/i386 && GOOS=darwin GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/darwin/i386/docker-gen ./cmd/docker-gen - release: dist - go mod tidy - tar -cvzf docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen - tar -cvzf docker-gen-alpine-linux-arm64-$(TAG).tar.gz -C dist/alpine-linux/arm64 docker-gen - tar -cvzf docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen - tar -cvzf docker-gen-linux-amd64-$(TAG).tar.gz -C dist/linux/amd64 docker-gen - tar -cvzf docker-gen-linux-arm64-$(TAG).tar.gz -C dist/linux/arm64 docker-gen - tar -cvzf docker-gen-linux-i386-$(TAG).tar.gz -C dist/linux/i386 docker-gen - tar -cvzf docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen - tar -cvzf docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen - tar -cvzf docker-gen-darwin-amd64-$(TAG).tar.gz -C dist/darwin/amd64 docker-gen - tar -cvzf docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen + mkdir -p release + tar -cvzf release/docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen + tar -cvzf release/docker-gen-alpine-linux-arm64-$(TAG).tar.gz -C dist/alpine-linux/arm64 docker-gen + tar -cvzf release/docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen + tar -cvzf release/docker-gen-linux-amd64-$(TAG).tar.gz -C dist/linux/amd64 docker-gen + tar -cvzf release/docker-gen-linux-arm64-$(TAG).tar.gz -C dist/linux/arm64 docker-gen + tar -cvzf release/docker-gen-linux-i386-$(TAG).tar.gz -C dist/linux/i386 docker-gen + tar -cvzf release/docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen + tar -cvzf release/docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen + tar -cvzf release/docker-gen-darwin-amd64-$(TAG).tar.gz -C dist/darwin/amd64 docker-gen + tar -cvzf release/docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen get-deps: From 41c6200c4ca995fa954f7dfc65bafa29d24823ed Mon Sep 17 00:00:00 2001 From: bugficks Date: Sat, 11 Jul 2020 17:18:12 +0000 Subject: [PATCH 34/44] CirceCI --- .circleci/config.yml | 5 +---- Makefile | 9 ++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 96f04f6e..acc361a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,4 @@ jobs: - run: make release - run: name: "Publish Release on GitHub" - command: | - go get github.com/tcnksm/ghr - TAG=$(git describe --tags) - ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${TAG} ./release/ + command: make github_release diff --git a/Makefile b/Makefile index 5123792f..69214bcf 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .SILENT : .PHONY : docker-gen dist dist-clean release check-gofmt test -TAG:=`git describe --tags` +TAG:=$(shell git describe --tags) LDFLAGS:=-X main.buildVersion=$(TAG) # https://stackoverflow.com/a/58185179 LDFLAGS_EXTRA=-linkmode external -w -extldflags "-static" @@ -53,3 +53,10 @@ check-gofmt: test: go test ./... + +github_release: SHELL=/bin/bash +github_release: + if [[ ${TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$$ ]]; then \ + go get github.com/tcnksm/ghr; \ + ghr -t $${GITHUB_TOKEN} -u $${CIRCLE_PROJECT_USERNAME} -r $${CIRCLE_PROJECT_REPONAME} -c $${CIRCLE_SHA1} -delete ${TAG} ./release/; \ + fi; From 6939a8930f6d24a242d0dc7530fd8982587a8dd7 Mon Sep 17 00:00:00 2001 From: bugficks Date: Sun, 12 Jul 2020 00:42:27 +0700 Subject: [PATCH 35/44] Update README.md --- README.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1621f8dc..ee4caad8 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ docker-gen ===== -![latest 0.8.1](https://img.shields.io/badge/latest-0.8.1-green.svg?style=flat) -[![Build Status](https://travis-ci.org/joellinn/docker-gen.svg?branch=master)](https://travis-ci.org/github/joellinn/docker-gen) +![latest 0.8.3](https://img.shields.io/badge/latest-0.8.3-green.svg?style=flat) +[![Travis CI](https://travis-ci.org/bugficks/docker-gen.svg?branch=master)](https://travis-ci.org/github/bugficks/docker-gen) +[![CircleCI](https://circleci.com/gh/bugficks/docker-gen.svg?style=svg)](https://circleci.com/gh/bugficks/docker-gen) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) `docker-gen` is a file generator that renders templates using docker container meta-data. It can be used to generate various kinds of files for: - * **Centralized logging** - [fluentd](https://github.com/joellinn/docker-gen/blob/master/templates/fluentd.conf.tmpl), logstash or other centralized logging tools that tail the containers JSON log file or files within the container. - * **Log Rotation** - [logrotate](https://github.com/joellinn/docker-gen/blob/master/templates/logrotate.tmpl) files to rotate container JSON log files - * **Reverse Proxy Configs** - [nginx](https://github.com/joellinn/docker-gen/blob/master/templates/nginx.tmpl), [haproxy](https://github.com/jwilder/docker-discover), etc. reverse proxy configs to route requests from the host to containers + * **Centralized logging** - [fluentd](https://github.com/bugficks/docker-gen/blob/master/templates/fluentd.conf.tmpl), logstash or other centralized logging tools that tail the containers JSON log file or files within the container. + * **Log Rotation** - [logrotate](https://github.com/bugficks/docker-gen/blob/master/templates/logrotate.tmpl) files to rotate container JSON log files + * **Reverse Proxy Configs** - [nginx](https://github.com/bugficks/docker-gen/blob/master/templates/nginx.tmpl), [haproxy](https://github.com/jwilder/docker-discover), etc. reverse proxy configs to route requests from the host to containers * **Service Discovery** - Scripts (python, bash, etc..) to register containers within [etcd](https://github.com/jwilder/docker-register), hipache, etc.. === @@ -25,12 +26,12 @@ There are three common ways to run docker-gen: #### Host Install -Linux/OSX binaries for [release](https://github.com/joellinn/docker-gen/releases) +Linux/OSX binaries for [release](https://github.com/bugficks/docker-gen/releases) Download the version you need, untar, and install to your PATH. ``` -$ wget https://github.com/joellinn/docker-gen/releases/download/VERSION/docker-gen-linux-amd64-VERSION.tar.gz +$ wget https://github.com/bugficks/docker-gen/releases/download/VERSION/docker-gen-linux-amd64-VERSION.tar.gz $ tar xvzf docker-gen-linux-amd64-VERSION.tar.gz $ ./docker-gen ``` @@ -438,13 +439,8 @@ $ docker-gen -notify "/bin/bash /tmp/etcd.sh" -interval 10 templates/etcd.tmpl / ### Development -This project uses [glock](https://github.com/robfig/glock) for managing 3rd party dependencies. -You'll need to install glock into your workspace before hacking on docker-gen. - ``` $ git clone -$ cd -$ make get-deps $ make ``` From ca4fef16cccef26801771bdd5c00acdcb9b13a44 Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 14 Jul 2020 16:31:09 +0000 Subject: [PATCH 36/44] Build docker image from either gitub release or local directory --- .dockerignore | 3 ++- Dockerfile | 45 ++++++++++++++++++++++++++++++++++++--------- Makefile | 10 +++++++++- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index a9c198a7..0b495b41 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,5 @@ -.git +#.git docker-gen dist +release *.gz diff --git a/Dockerfile b/Dockerfile index 4d0c96d6..02e447e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,58 @@ +######################################################################################################################## +# +ARG BUILD_ENV=github +ARG SOURCE_REPO=https://github.com/bugficks/docker-gen + +######################################################################################################################## +# FROM golang:alpine as builder +LABEL stage=docker-gen-intermediate + +ARG BUILD_ENV +ARG SOURCE_REPO -ARG SOURCE_REPO=github.com/bugficks/docker-gen +ENV BUILD_ENV=${BUILD_ENV:-github}\ + SOURCE_REPO=${SOURCE_REPO} RUN apk add --no-cache \ git \ make \ gcc \ - libc-dev + libc-dev \ + curl + +######################################################################################################################## +# +FROM builder as builder_github +ONBUILD RUN \ + export TAG=${TAG:-$(curl -fsSLI -o /dev/null -w %{url_effective} ${SOURCE_REPO}/releases/latest | awk -F / '{print $NF}')} \ + && git clone ${SOURCE_REPO} --single-branch --branch ${TAG} --depth 1 /build -RUN go get ${SOURCE_REPO} -WORKDIR src/${SOURCE_REPO} +######################################################################################################################## +# +FROM builder as builder_local +ONBUILD COPY . /build -COPY . /build +######################################################################################################################## +# +FROM builder_${BUILD_ENV} as final + +# Tests are disabled here because docker build servers are too slow for ms dependent tests WORKDIR /build -RUN make get-deps # Tests are disabled here because docker build servers are too slow for ms dependent tests -RUN make all check-gofmt -RUN cp docker-gen / +RUN make check-gofmt all +######################################################################################################################## +# FROM alpine:latest + LABEL maintainer="github.com/bugficks/docker-gen" RUN apk --no-cache add openssl ENV DOCKER_HOST unix:///tmp/docker.sock -COPY --from=builder /docker-gen /usr/local/bin/ +COPY --from=final /build/docker-gen /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/docker-gen"] diff --git a/Makefile b/Makefile index 69214bcf..1ce2bb75 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ all: docker-gen docker-gen: echo "Building docker-gen" - go build -ldflags "$(LDFLAGS)" ./cmd/docker-gen + go build -ldflags "$(LDFLAGS) $(LDFLAGS_EXTRA)" ./cmd/docker-gen dist-clean: go mod tidy @@ -54,9 +54,17 @@ check-gofmt: test: go test ./... +.PHONY: github_release github_release: SHELL=/bin/bash github_release: if [[ ${TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$$ ]]; then \ go get github.com/tcnksm/ghr; \ ghr -t $${GITHUB_TOKEN} -u $${CIRCLE_PROJECT_USERNAME} -r $${CIRCLE_PROJECT_REPONAME} -c $${CIRCLE_SHA1} -delete ${TAG} ./release/; \ fi; + +# build docker image from either latest release on github or local directory +# BUILD_ENV: (github | local) default=github +.PHONY: docker-image +docker-image: + docker build -t docker-gen . --build-arg BUILD_ENV=$${BUILD_ENV:-github} + docker tag docker-gen docker-gen:$(shell docker run --rm -it docker-gen:latest -version) From 9bf1a166e29a3b874cb18679a4801818423ada19 Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 14 Jul 2020 16:34:01 +0000 Subject: [PATCH 37/44] go 1.14 --- .circleci/config.yml | 2 +- go.mod | 2 +- go.sum | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index acc361a1..4e8b98d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: build: docker: # specify the version - - image: circleci/golang:1.13 + - image: circleci/golang:1.14 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images diff --git a/go.mod b/go.mod index 3256075b..209d47d7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module docker-gen -go 1.13 +go 1.14 require ( github.com/BurntSushi/toml v0.3.1 diff --git a/go.sum b/go.sum index c4a375b8..25491ebe 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,15 @@ bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= 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 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GehirnInc/crypt v0.0.0-20190301055215-6c0105aabd46 h1:rs0kDBt2zF4/CM9rO5/iH+U22jnTygPlqWgX55Ufcxg= github.com/GehirnInc/crypt v0.0.0-20190301055215-6c0105aabd46/go.mod h1:kC29dT1vFpj7py2OvG1khBdQpo3kInWP+6QipLbdngo= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873 h1:93nQ7k53GjoMQ07HVP8g6Zj1fQZDDj7Xy2VkNNtvX8o= github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/hcsshim v0.8.7 h1:ptnOoufxGSzauVTsdE+wMYnCWA301PdoN4xg5oRdZpg= github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -25,6 +28,7 @@ github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDG github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -46,6 +50,7 @@ github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6 github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= 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= @@ -66,6 +71,7 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= @@ -85,6 +91,7 @@ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mo github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= @@ -96,6 +103,7 @@ github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bd 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.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -118,6 +126,7 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 h1:KaQtG+aDELoNmXYas3TVkGNYRuq8JQ1aa7LJt8EXVyo= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/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= @@ -136,6 +145,7 @@ golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -144,6 +154,7 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= @@ -157,12 +168,15 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 350fdbdf764f28a588e196d1b5f81871e927e9fc Mon Sep 17 00:00:00 2001 From: bugficks Date: Wed, 15 Jul 2020 02:27:19 +0000 Subject: [PATCH 38/44] Use CircleCI workflow to make github release --- .circleci/config.yml | 39 ++++++++++++++++++++++++++++++--------- Makefile | 8 -------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e8b98d3..b71c7bbf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,17 +19,38 @@ jobs: #### /go/src/bitbucket.org/circleci/go-tool working_directory: /go/src/github.com/bugficks/docker-gen steps: - - add_ssh_keys: - fingerprints: - - "5c:26:7f:82:3f:d7:78:22:07:65:c4:c1:e2:b1:c9:ce" - - checkout - - attach_workspace: - at: ./release - - # specify any bash command here prefixed with `run: ` - run: make test check-gofmt all - run: make release + - run: echo "export VERSION=$(git describe --tags)" >> VERSION + - persist_to_workspace: + root: . + paths: + - VERSION + - release/* + + publish-github-release: + docker: + - image: cibuilds/github:0.10 + steps: + - attach_workspace: + at: . - run: name: "Publish Release on GitHub" - command: make github_release + command: | + source VERSION + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./release/ + +workflows: + version: 2 + main: + jobs: + - build + - publish-github-release: + requires: + - build + filters: + branches: + ignore: /.*/ + tags: + only: /^\d+\.\d+\.\d+$/ diff --git a/Makefile b/Makefile index 1ce2bb75..69489d89 100644 --- a/Makefile +++ b/Makefile @@ -54,14 +54,6 @@ check-gofmt: test: go test ./... -.PHONY: github_release -github_release: SHELL=/bin/bash -github_release: - if [[ ${TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$$ ]]; then \ - go get github.com/tcnksm/ghr; \ - ghr -t $${GITHUB_TOKEN} -u $${CIRCLE_PROJECT_USERNAME} -r $${CIRCLE_PROJECT_REPONAME} -c $${CIRCLE_SHA1} -delete ${TAG} ./release/; \ - fi; - # build docker image from either latest release on github or local directory # BUILD_ENV: (github | local) default=github .PHONY: docker-image From 88ec289374f0bf912a1852ac67b68f72f3333c4e Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 21 Jul 2020 10:26:19 +0000 Subject: [PATCH 39/44] change setHTPasswd to use sha instead of bcrypt if not specified --- template.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/template.go b/template.go index 9345d8e9..32831b75 100644 --- a/template.go +++ b/template.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/foomo/htpasswd" "io" "io/ioutil" "log" @@ -19,6 +18,8 @@ import ( "strings" "syscall" "text/template" + + "github.com/foomo/htpasswd" ) func exists(path string) (bool, error) { @@ -320,8 +321,15 @@ func hashSha1(input string) string { return fmt.Sprintf("%x", h.Sum(nil)) } -func setHTPasswd(file, name, password string) (bool, error) { - err := htpasswd.SetPassword(file, name, password, htpasswd.HashBCrypt) +// no bcrypt on debian. default to sha instead +// https://github.com/nginxinc/docker-nginx/issues/29#issuecomment-194817391 +func setHTPasswd(file, name, password, algo string) (bool, error) { + if algo == "" { + algo = htpasswd.HashSHA + } else { + strings.ToLower(algo) + } + err := htpasswd.SetPassword(file, name, password, htpasswd.HashAlgorithm(algo)) if err != nil { return false, err } From c8156f4464a375712084b14f527fb4357b49d283 Mon Sep 17 00:00:00 2001 From: bugficks Date: Tue, 21 Jul 2020 18:04:59 +0000 Subject: [PATCH 40/44] circleci --- .circleci/config.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b71c7bbf..b78b7bdb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,9 +43,15 @@ jobs: workflows: version: 2 - main: + untagged-build: jobs: - build + tagged-build: + jobs: + - build: + filters: + tags: + only: /^\d+\.\d+\.\d+$/ - publish-github-release: requires: - build From 26dd3bcf2c21c037f127a16b640ff1c1b230ddb8 Mon Sep 17 00:00:00 2001 From: bugficks Date: Sun, 28 Feb 2021 17:17:52 +0000 Subject: [PATCH 41/44] go 1.16 --- .circleci/config.yml | 3 +- .travis.yml | 2 + go.mod | 4 +- go.sum | 169 ++++++++++++++++++++++++++----------------- 4 files changed, 109 insertions(+), 69 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b78b7bdb..59571826 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: build: docker: # specify the version - - image: circleci/golang:1.14 + - image: circleci/golang:1.16 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images @@ -41,6 +41,7 @@ jobs: source VERSION ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./release/ +# https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag workflows: version: 2 untagged-build: diff --git a/.travis.yml b/.travis.yml index 6753ce44..07b4b87d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ language: go go: - "1.13" - "1.14" +- "1.15" +- "1.16" install: - make get-deps script: diff --git a/go.mod b/go.mod index 209d47d7..49063141 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module docker-gen -go 1.14 +go 1.16 require ( github.com/BurntSushi/toml v0.3.1 github.com/foomo/htpasswd v0.0.0-20200116085101-e3a90e78da9c - github.com/fsouza/go-dockerclient v1.6.5 + github.com/fsouza/go-dockerclient v1.7.1 ) diff --git a/go.sum b/go.sum index 25491ebe..9c9365bc 100644 --- a/go.sum +++ b/go.sum @@ -6,50 +6,50 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GehirnInc/crypt v0.0.0-20190301055215-6c0105aabd46 h1:rs0kDBt2zF4/CM9rO5/iH+U22jnTygPlqWgX55Ufcxg= github.com/GehirnInc/crypt v0.0.0-20190301055215-6c0105aabd46/go.mod h1:kC29dT1vFpj7py2OvG1khBdQpo3kInWP+6QipLbdngo= -github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873 h1:93nQ7k53GjoMQ07HVP8g6Zj1fQZDDj7Xy2VkNNtvX8o= -github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/hcsshim v0.8.7 h1:ptnOoufxGSzauVTsdE+wMYnCWA301PdoN4xg5oRdZpg= -github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= -github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= +github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/hcsshim v0.8.14 h1:lbPVK25c1cu5xTLITwpUcxoA9vKrKErASPYygvouJns= +github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= +github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= +github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59 h1:qWj4qVYZ95vLWwqyNJCQg7rDsG5wPdze0UaPolH7DUk= +github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0 h1:xjvXQWABwS2uiv3TWgQt5Uth60Gu86LTGZXMJkjc7rY= -github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.3 h1:ijQT13JedHSHrQGWFcGEwzcNKrAGIiZ+jSD5QQG07SY= +github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c h1:8ahmSVELW1wghbjerVAyuEYD5+Dio66RYvSS0iGfL1M= -github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= +github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e h1:6JKvHHt396/qabvMhnhUZvWaHZzfVfldxE60TK8YLhg= +github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -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 v1.4.2-0.20191101170500-ac7306503d23 h1:oqgGT9O61YAYvI41EBsLePOr+LE6roB0xY4gpkZuFSE= -github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.3-0.20210216175712-646072ed6524+incompatible h1:Yu2uGErhwEoOT/OxAFe+/SiJCqRLs+pgcS5XKrDXnG4= +github.com/docker/docker v20.10.3-0.20210216175712-646072ed6524+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= 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-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/foomo/htpasswd v0.0.0-20200116085101-e3a90e78da9c h1:DBGU7zCwrrPPDsD6+gqKG8UfMxenWg9BOJE/Nmfph+4= github.com/foomo/htpasswd v0.0.0-20200116085101-e3a90e78da9c/go.mod h1:SHawtolbB0ZOFoRWgDwakX5WpwuIWAK88bUXVZqK0Ss= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsouza/go-dockerclient v1.6.5 h1:vuFDnPcds3LvTWGYb9h0Rty14FLgkjHZdwLDROCdgsw= -github.com/fsouza/go-dockerclient v1.6.5/go.mod h1:GOdftxWLWIbIWKbIMDroKFJzPdg6Iw7r+jX1DDZdVsA= -github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/fsouza/go-dockerclient v1.7.1 h1:OHRaYvQslCqBStrel+I3OcXZBmpoTnRCGsmH2tAk7Hk= +github.com/fsouza/go-dockerclient v1.7.1/go.mod h1:PHUSk8IVIp+nkIVGrQa2GK69jPOeW/43OUKQgQcOH+M= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= 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= @@ -61,65 +61,79 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= 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/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/moby/sys/mount v0.2.0 h1:WhCW5B355jtxndN5ovugJlMFJawbUODuW8fSnEH6SSM= +github.com/moby/sys/mount v0.2.0/go.mod h1:aAivFE2LB3W4bACsUXChRHQ0qKWsetY4Y9V7sxOougM= +github.com/moby/sys/mountinfo v0.4.0 h1:1KInV3Huv18akCu58V7lzNlt+jFmqlu1EaErnEHE/VM= +github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 h1:rzf0wL0CHVc8CEsgyygG0Mn9CNCCPZqOPaz8RiiHYQk= +github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -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/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= 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.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= 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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +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.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo= -golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 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/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -128,56 +142,79 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 h1:KaQtG+aDELoNmXYas3TVkGNYRuq8JQ1aa7LJt8EXVyo= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 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/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/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-20180909124046-d0be0721c37e/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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210216224549-f992740a1bac h1:9glrpwtNjBYgRpb67AZJKHfzj1stG/8BL5H7In2oTC4= +golang.org/x/sys v0.0.0-20210216224549-f992740a1bac/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201113234701-d7a72108b828 h1:htWEtQEuEVJ4tU/Ngx7Cd/4Q7e3A5Up1owgyBtVsTwk= +golang.org/x/term v0.0.0-20201113234701-d7a72108b828/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/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= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= +gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= From bf31bf1c3ec0ddd9ab7ffe2c6b8e90fd8dc67c2a Mon Sep 17 00:00:00 2001 From: bugficks Date: Sun, 28 Feb 2021 17:23:39 +0000 Subject: [PATCH 42/44] GetCurrentContainerID from /proc/self/mountinfo #335 + #336 --- context.go | 41 ++++++++++++++++++++++------------------- context_test.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/context.go b/context.go index 98329615..e46dc069 100644 --- a/context.go +++ b/context.go @@ -6,7 +6,7 @@ import ( "regexp" "sync" - "github.com/fsouza/go-dockerclient" + docker "github.com/fsouza/go-dockerclient" ) var ( @@ -161,24 +161,27 @@ type Docker struct { } func GetCurrentContainerID() string { - file, err := os.Open("/proc/self/cgroup") + filepaths := []string{"/proc/self/cgroup", "/proc/self/mountinfo"} - if err != nil { - return "" - } + for _, filepath := range filepaths { + file, err := os.Open(filepath) + if err != nil { + continue + } - reader := bufio.NewReader(file) - scanner := bufio.NewScanner(reader) - scanner.Split(bufio.ScanLines) - - for scanner.Scan() { - _, lines, err := bufio.ScanLines([]byte(scanner.Text()), true) - if err == nil { - strLines := string(lines) - if id := matchDockerCurrentContainerID(strLines); id != "" { - return id - } else if id := matchECSCurrentContainerID(strLines); id != "" { - return id + reader := bufio.NewReader(file) + scanner := bufio.NewScanner(reader) + scanner.Split(bufio.ScanLines) + + for scanner.Scan() { + _, lines, err := bufio.ScanLines([]byte(scanner.Text()), true) + if err == nil { + strLines := string(lines) + if id := matchDockerCurrentContainerID(strLines); id != "" { + return id + } else if id := matchECSCurrentContainerID(strLines); id != "" { + return id + } } } } @@ -187,12 +190,12 @@ func GetCurrentContainerID() string { } func matchDockerCurrentContainerID(lines string) string { - regex := "/docker[/-]([[:alnum:]]{64})(\\.scope)?$" + regex := "/docker(/containers)?[/-]([[:alnum:]]{64})(/|$)" re := regexp.MustCompilePOSIX(regex) if re.MatchString(lines) { submatches := re.FindStringSubmatch(string(lines)) - containerID := submatches[1] + containerID := submatches[len(submatches)-2] return containerID } diff --git a/context_test.go b/context_test.go index 4e64cc11..2d667741 100644 --- a/context_test.go +++ b/context_test.go @@ -48,5 +48,37 @@ func TestGetCurrentContainerID_DockerCE(t *testing.T) { if got, exp := matchDockerCurrentContainerID(cgroup), "18862cabc2e0d24142cf93c46ccb6e070c2ea7b996c81c0311ec0309abcbcdfb"; got != exp { t.Fatalf("id mismatch: got %v, exp %v", got, exp) } +} + +func TestGetCurrentContainerID_DockerCE_mountinfo(t *testing.T) { + mountinfo := + `550 209 0:38 / / rw,relatime master:97 - overlay overlay rw,seclabel,lowerdir=/var/lib/docker/overlay2/l/CMLIRGTLVPWATOT2BBGMMWTKPL:/var/lib/docker/overlay2/l/JBJ54L4BQPWTRHZVLNTFAIKIMU:/var/lib/docker/overlay2/l/GKWSGW3V5DTMUG5OV2QF2NDXZM:/var/lib/docker/overlay2/l/KKB7IBA5SXQ6GOHKPC3X2TVPDL,upperdir=/var/lib/docker/overlay2/d3c3d349e227bba0d9f66787a03a5ba8928e6fb8198e787d4d038425afc89fd0/diff,workdir=/var/lib/docker/overlay2/d3c3d349e227bba0d9f66787a03a5ba8928e6fb8198e787d4d038425afc89fd0/work +551 550 0:47 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw +552 550 0:48 / /dev rw,nosuid - tmpfs tmpfs rw,seclabel,size=65536k,mode=755,inode64 +553 552 0:49 / /dev/pts rw,nosuid,noexec,relatime - devpts devpts rw,seclabel,gid=5,mode=620,ptmxmode=666 +554 550 0:50 / /sys ro,nosuid,nodev,noexec,relatime - sysfs sysfs ro,seclabel +555 554 0:27 / /sys/fs/cgroup ro,nosuid,nodev,noexec,relatime - cgroup2 cgroup rw,seclabel,nsdelegate +556 552 0:46 / /dev/mqueue rw,nosuid,nodev,noexec,relatime - mqueue mqueue rw,seclabel +557 552 0:51 / /dev/shm rw,nosuid,nodev,noexec,relatime - tmpfs shm rw,seclabel,size=65536k,inode64 +558 550 253:1 /var/lib/docker/containers/bc4ed21e220deb8e759970f0853854b868f0157d1b45caab844c5641435553a4/resolv.conf /etc/resolv.conf rw,relatime - xfs /dev/mapper/fedora_tpdachsserver-root rw,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota +559 550 253:1 /var/lib/docker/containers/bc4ed21e220deb8e759970f0853854b868f0157d1b45caab844c5641435553a4/hostname /etc/hostname rw,relatime - xfs /dev/mapper/fedora_tpdachsserver-root rw,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota +560 550 253:1 /var/lib/docker/containers/bc4ed21e220deb8e759970f0853854b868f0157d1b45caab844c5641435553a4/hosts /etc/hosts rw,relatime - xfs /dev/mapper/fedora_tpdachsserver-root rw,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota +210 551 0:47 /bus /proc/bus ro,relatime - proc proc rw +211 551 0:47 /fs /proc/fs ro,relatime - proc proc rw +212 551 0:47 /irq /proc/irq ro,relatime - proc proc rw +264 551 0:47 /sys /proc/sys ro,relatime - proc proc rw +265 551 0:47 /sysrq-trigger /proc/sysrq-trigger ro,relatime - proc proc rw +523 551 0:58 / /proc/asound ro,relatime - tmpfs tmpfs ro,seclabel,inode64 +524 551 0:59 / /proc/acpi ro,relatime - tmpfs tmpfs ro,seclabel,inode64 +529 551 0:48 /null /proc/kcore rw,nosuid - tmpfs tmpfs rw,seclabel,size=65536k,mode=755,inode64 +530 551 0:48 /null /proc/keys rw,nosuid - tmpfs tmpfs rw,seclabel,size=65536k,mode=755,inode64 +531 551 0:48 /null /proc/latency_stats rw,nosuid - tmpfs tmpfs rw,seclabel,size=65536k,mode=755,inode64 +532 551 0:48 /null /proc/timer_list rw,nosuid - tmpfs tmpfs rw,seclabel,size=65536k,mode=755,inode64 +533 551 0:48 /null /proc/sched_debug rw,nosuid - tmpfs tmpfs rw,seclabel,size=65536k,mode=755,inode64 +534 551 0:60 / /proc/scsi ro,relatime - tmpfs tmpfs ro,seclabel,inode64 +535 554 0:61 / /sys/firmware ro,relatime - tmpfs tmpfs ro,seclabel,inode64` + if got, exp := matchDockerCurrentContainerID(mountinfo), "bc4ed21e220deb8e759970f0853854b868f0157d1b45caab844c5641435553a4"; got != exp { + t.Fatalf("id mismatch: got %v, exp %v", got, exp) + } } From 2c40c828f02a132eee2919e865f2fc956ca3b424 Mon Sep 17 00:00:00 2001 From: bugficks Date: Sun, 28 Feb 2021 17:41:00 +0000 Subject: [PATCH 43/44] drop darwin/386 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 69489d89..238080a8 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ dist: dist-clean mkdir -p dist/linux/armel && GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o dist/linux/armel/docker-gen ./cmd/docker-gen mkdir -p dist/linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -o dist/linux/armhf/docker-gen ./cmd/docker-gen mkdir -p dist/darwin/amd64 && GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/darwin/amd64/docker-gen ./cmd/docker-gen - mkdir -p dist/darwin/i386 && GOOS=darwin GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/darwin/i386/docker-gen ./cmd/docker-gen +# mkdir -p dist/darwin/i386 && GOOS=darwin GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/darwin/i386/docker-gen ./cmd/docker-gen release: dist mkdir -p release @@ -40,7 +40,7 @@ release: dist tar -cvzf release/docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen tar -cvzf release/docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen tar -cvzf release/docker-gen-darwin-amd64-$(TAG).tar.gz -C dist/darwin/amd64 docker-gen - tar -cvzf release/docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen +# tar -cvzf release/docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen get-deps: From 209b041c7e6f877220ef8d7a9faa6a1b64ed703b Mon Sep 17 00:00:00 2001 From: bugficks Date: Sun, 28 Feb 2021 17:53:32 +0000 Subject: [PATCH 44/44] 0.8.5 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ee4caad8..f71c498d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ docker-gen ===== -![latest 0.8.3](https://img.shields.io/badge/latest-0.8.3-green.svg?style=flat) +![latest 0.8.5](https://img.shields.io/badge/latest-0.8.5-green.svg?style=flat) [![Travis CI](https://travis-ci.org/bugficks/docker-gen.svg?branch=master)](https://travis-ci.org/github/bugficks/docker-gen) [![CircleCI](https://circleci.com/gh/bugficks/docker-gen.svg?style=svg)](https://circleci.com/gh/bugficks/docker-gen) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) +![Go Version](https://img.shields.io/github/go-mod/go-version/bugficks/docker-gen) `docker-gen` is a file generator that renders templates using docker container meta-data.