From d346675c3b8f17c80975e7a6872bcfafa6f04d55 Mon Sep 17 00:00:00 2001 From: bmwosz Date: Fri, 10 Sep 2021 13:18:04 +0200 Subject: [PATCH 1/9] Enable secrets based on nashiox work --- cmd/drone-docker/main.go | 46 +++++++++++++++++++++++----------------- docker.go | 4 ++++ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 3385bb80..61d5830e 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -248,6 +248,11 @@ func main() { Usage: "additional host:IP mapping", EnvVar: "PLUGIN_ADD_HOST", }, + cli.StringSliceFlag{ + Name: "secret", + Usage: "Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret", + EnvVar: "PLUGIN_SECRET", + }, } if err := app.Run(os.Args); err != nil { @@ -267,26 +272,27 @@ func run(c *cli.Context) error { Config: c.String("docker.config"), }, Build: docker.Build{ - Remote: c.String("remote.url"), - Name: c.String("commit.sha"), - Dockerfile: c.String("dockerfile"), - Context: c.String("context"), - Tags: c.StringSlice("tags"), - Args: c.StringSlice("args"), - ArgsEnv: c.StringSlice("args-from-env"), - Target: c.String("target"), - Squash: c.Bool("squash"), - Pull: c.BoolT("pull-image"), - CacheFrom: c.StringSlice("cache-from"), - Compress: c.Bool("compress"), - Repo: c.String("repo"), - Labels: c.StringSlice("custom-labels"), - LabelSchema: c.StringSlice("label-schema"), - AutoLabel: c.BoolT("auto-label"), - Link: c.String("link"), - NoCache: c.Bool("no-cache"), - AddHost: c.StringSlice("add-host"), - Quiet: c.Bool("quiet"), + Remote: c.String("remote.url"), + Name: c.String("commit.sha"), + Dockerfile: c.String("dockerfile"), + Context: c.String("context"), + Tags: c.StringSlice("tags"), + Args: c.StringSlice("args"), + ArgsEnv: c.StringSlice("args-from-env"), + Target: c.String("target"), + Squash: c.Bool("squash"), + Pull: c.BoolT("pull-image"), + CacheFrom: c.StringSlice("cache-from"), + Compress: c.Bool("compress"), + Repo: c.String("repo"), + Labels: c.StringSlice("custom-labels"), + LabelSchema: c.StringSlice("label-schema"), + AutoLabel: c.BoolT("auto-label"), + Link: c.String("link"), + NoCache: c.Bool("no-cache"), + AddHost: c.StringSlice("add-host"), + Secrets: c.StringSlice("secret"), + Quiet: c.Bool("quiet"), }, Daemon: docker.Daemon{ Registry: c.String("docker.registry"), diff --git a/docker.go b/docker.go index 9effe4c5..540ae02b 100644 --- a/docker.go +++ b/docker.go @@ -58,6 +58,7 @@ type ( Link string // Git repo link NoCache bool // Docker build no-cache AddHost []string // Docker build add-host + Secrets []string // Docker build secret Quiet bool // Docker build quiet } @@ -261,6 +262,9 @@ func commandBuild(build Build) *exec.Cmd { if build.Target != "" { args = append(args, "--target", build.Target) } + for _, secret := range build.Secrets { + args = append(args, "--secret", secret) + } if build.Quiet { args = append(args, "--quiet") } From 0f6e0c501b87256a9f25d9d3157f846f4f5659ae Mon Sep 17 00:00:00 2001 From: bmwosz Date: Tue, 14 Sep 2021 15:16:27 +0200 Subject: [PATCH 2/9] Working secrets to mount in docker build --- cmd/drone-docker/main.go | 59 +++++++++++++++++----------- docker.go | 45 ++++++++++----------- docker/docker/Dockerfile.linux.amd64 | 2 +- 3 files changed, 59 insertions(+), 47 deletions(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 61d5830e..3f22b5ce 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -249,9 +249,15 @@ func main() { EnvVar: "PLUGIN_ADD_HOST", }, cli.StringSliceFlag{ - Name: "secret", - Usage: "Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret", - EnvVar: "PLUGIN_SECRET", + Name: "secrets", + Usage: "Secret file to expose to the build (only if BuildKit enabled): id=mysecret;src=/local/secret", + EnvVar: "PLUGIN_SECRETS", + }, + cli.StringFlag{ + Name: "secret-separator", + Usage: "Sign to be used to separate secrets id and src - this sign will be replaced with , to work with docker build command", + Value: ";", + EnvVar: "PLUGIN_SECRET_SEPARATOR", }, } @@ -272,27 +278,28 @@ func run(c *cli.Context) error { Config: c.String("docker.config"), }, Build: docker.Build{ - Remote: c.String("remote.url"), - Name: c.String("commit.sha"), - Dockerfile: c.String("dockerfile"), - Context: c.String("context"), - Tags: c.StringSlice("tags"), - Args: c.StringSlice("args"), - ArgsEnv: c.StringSlice("args-from-env"), - Target: c.String("target"), - Squash: c.Bool("squash"), - Pull: c.BoolT("pull-image"), - CacheFrom: c.StringSlice("cache-from"), - Compress: c.Bool("compress"), - Repo: c.String("repo"), - Labels: c.StringSlice("custom-labels"), - LabelSchema: c.StringSlice("label-schema"), - AutoLabel: c.BoolT("auto-label"), - Link: c.String("link"), - NoCache: c.Bool("no-cache"), - AddHost: c.StringSlice("add-host"), - Secrets: c.StringSlice("secret"), - Quiet: c.Bool("quiet"), + Remote: c.String("remote.url"), + Name: c.String("commit.sha"), + Dockerfile: c.String("dockerfile"), + Context: c.String("context"), + Tags: c.StringSlice("tags"), + Args: c.StringSlice("args"), + ArgsEnv: c.StringSlice("args-from-env"), + Target: c.String("target"), + Squash: c.Bool("squash"), + Pull: c.BoolT("pull-image"), + CacheFrom: c.StringSlice("cache-from"), + Compress: c.Bool("compress"), + Repo: c.String("repo"), + Labels: c.StringSlice("custom-labels"), + LabelSchema: c.StringSlice("label-schema"), + AutoLabel: c.BoolT("auto-label"), + Link: c.String("link"), + NoCache: c.Bool("no-cache"), + AddHost: c.StringSlice("add-host"), + Secrets: c.StringSlice("secrets"), + SecretsSeparator: c.String("secret-separator"), + Quiet: c.Bool("quiet"), }, Daemon: docker.Daemon{ Registry: c.String("docker.registry"), @@ -331,5 +338,9 @@ func run(c *cli.Context) error { } } + if c.String("secret-separator") == "," { + logrus.Fatal("secret variables separator ',' will break build - please use default one or any other") + } + return plugin.Exec() } diff --git a/docker.go b/docker.go index 540ae02b..e803bc25 100644 --- a/docker.go +++ b/docker.go @@ -39,27 +39,28 @@ type ( // Build defines Docker build parameters. Build struct { - Remote string // Git remote URL - Name string // Docker build using default named tag - Dockerfile string // Docker build Dockerfile - Context string // Docker build context - Tags []string // Docker build tags - Args []string // Docker build args - ArgsEnv []string // Docker build args from env - Target string // Docker build target - Squash bool // Docker build squash - Pull bool // Docker build pull - CacheFrom []string // Docker build cache-from - Compress bool // Docker build compress - Repo string // Docker build repository - LabelSchema []string // label-schema Label map - AutoLabel bool // auto-label bool - Labels []string // Label map - Link string // Git repo link - NoCache bool // Docker build no-cache - AddHost []string // Docker build add-host - Secrets []string // Docker build secret - Quiet bool // Docker build quiet + Remote string // Git remote URL + Name string // Docker build using default named tag + Dockerfile string // Docker build Dockerfile + Context string // Docker build context + Tags []string // Docker build tags + Args []string // Docker build args + ArgsEnv []string // Docker build args from env + Target string // Docker build target + Squash bool // Docker build squash + Pull bool // Docker build pull + CacheFrom []string // Docker build cache-from + Compress bool // Docker build compress + Repo string // Docker build repository + LabelSchema []string // label-schema Label map + AutoLabel bool // auto-label bool + Labels []string // Label map + Link string // Git repo link + NoCache bool // Docker build no-cache + AddHost []string // Docker build add-host + Secrets []string // Docker build secret + SecretsSeparator string // Docker build secrets variables separator + Quiet bool // Docker build quiet } // Plugin defines the Docker plugin parameters. @@ -263,7 +264,7 @@ func commandBuild(build Build) *exec.Cmd { args = append(args, "--target", build.Target) } for _, secret := range build.Secrets { - args = append(args, "--secret", secret) + args = append(args, "--secret", strings.Replace(secret, build.SecretsSeparator, ",", -1)) } if build.Quiet { args = append(args, "--quiet") diff --git a/docker/docker/Dockerfile.linux.amd64 b/docker/docker/Dockerfile.linux.amd64 index c39c5787..9f854b41 100644 --- a/docker/docker/Dockerfile.linux.amd64 +++ b/docker/docker/Dockerfile.linux.amd64 @@ -1,4 +1,4 @@ -FROM docker:19.03.8-dind +FROM docker:20.10.8-dind ENV DOCKER_HOST=unix:///var/run/docker.sock From a3f9486ef8f297b5a92de57d51fa43223d4e287d Mon Sep 17 00:00:00 2001 From: bmwosz Date: Wed, 15 Sep 2021 15:45:51 +0200 Subject: [PATCH 3/9] Enable secrets only when BUILDKIT_ENABLE is set to 1; create flag for injecting drone git .netrc file into secrets --- cmd/drone-docker/main.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 3f22b5ce..79c5c7f4 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -248,6 +248,11 @@ func main() { Usage: "additional host:IP mapping", EnvVar: "PLUGIN_ADD_HOST", }, + cli.BoolFlag{ + Name: "git-netrc-pass", + Usage: "Pass git auth ~/.netrc file into docker build as secret (only if BuildKit enabled) - it will be avaliable as: id=git-netrc,src=$HOME/.netrc", + EnvVar: "PLUGIN_GIT_NETRC_PASS", + }, cli.StringSliceFlag{ Name: "secrets", Usage: "Secret file to expose to the build (only if BuildKit enabled): id=mysecret;src=/local/secret", @@ -338,8 +343,24 @@ func run(c *cli.Context) error { } } - if c.String("secret-separator") == "," { - logrus.Fatal("secret variables separator ',' will break build - please use default one or any other") + docker_buildkit_env_val, docker_buildkit_env_present := os.LookupEnv("DOCKER_BUILDKIT") + if docker_buildkit_env_present && docker_buildkit_env_val == "1" { + if c.String("secret-separator") == "," && len(c.StringSlice("secrets")) > 0 { + logrus.Fatal("secret variables separator ',' will break build - please use default one or any other") + } + if c.Bool("git-netrc-pass") { + homedirname, err := os.UserHomeDir() + if err != nil { + logrus.Fatal(err) + } + + plugin.Build.Secrets = append(c.StringSlice("secrets"), "id=git-netrc,src="+homedirname+"/.netrc") + } + } else { + if c.Bool("git-netrc-pass") || len(c.StringSlice("secrets")) > 0 { + logrus.Printf("skipping all secrets because DOCKER_BUILDKIT environment variable is not set to 1 - If this build fails because of secrets this is the reason why") + } + plugin.Build.Secrets = []string{} } return plugin.Exec() From 05824f1f5963a228b22d415e31b3e9e9c630d37b Mon Sep 17 00:00:00 2001 From: bmwosz Date: Wed, 15 Sep 2021 15:49:51 +0200 Subject: [PATCH 4/9] Change message when DOCKER_BUILDKIT is not enabled --- cmd/drone-docker/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 79c5c7f4..d70ba272 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -358,7 +358,7 @@ func run(c *cli.Context) error { } } else { if c.Bool("git-netrc-pass") || len(c.StringSlice("secrets")) > 0 { - logrus.Printf("skipping all secrets because DOCKER_BUILDKIT environment variable is not set to 1 - If this build fails because of secrets this is the reason why") + logrus.Printf("skipping all secrets because DOCKER_BUILDKIT environment variable is not set to 1 - If docker build fails on the step with secrets this is the reason why") } plugin.Build.Secrets = []string{} } From c184eafcd27d4267e2b1d1f4d31911bab86e664c Mon Sep 17 00:00:00 2001 From: bmwosz Date: Thu, 16 Sep 2021 14:26:30 +0200 Subject: [PATCH 5/9] Create .netrc file in users home directory based on env variable; Set DOCKER_BUILDKIT to 1 when secrets are provided or git_netrc_pass is set to true --- cmd/drone-docker/main.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index d70ba272..4f232969 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -343,24 +343,37 @@ func run(c *cli.Context) error { } } - docker_buildkit_env_val, docker_buildkit_env_present := os.LookupEnv("DOCKER_BUILDKIT") - if docker_buildkit_env_present && docker_buildkit_env_val == "1" { + if c.Bool("git-netrc-pass") || len(c.StringSlice("secrets")) > 0 { if c.String("secret-separator") == "," && len(c.StringSlice("secrets")) > 0 { logrus.Fatal("secret variables separator ',' will break build - please use default one or any other") } if c.Bool("git-netrc-pass") { + // Detect current user home directory homedirname, err := os.UserHomeDir() if err != nil { logrus.Fatal(err) } - plugin.Build.Secrets = append(c.StringSlice("secrets"), "id=git-netrc,src="+homedirname+"/.netrc") + // Create $HOME/.netrc file with correct permissions + netrcpath := homedirname + "/.netrc" + drone_netrc_file_env_val, drone_netrc_file_env_present := os.LookupEnv("DRONE_NETRC_FILE") + if drone_netrc_file_env_present { + err = os.WriteFile(netrcpath, []byte(drone_netrc_file_env_val), 0600) + if err != nil { + logrus.Fatal(err) + } + } else { + logrus.Fatal("DRONE_NETRC_FILE environment variable doesn't exists - cannot pass netrc file into build") + } + + // Inject netrc secret into secrets + plugin.Build.Secrets = append(c.StringSlice("secrets"), "id=git-netrc,src="+netrcpath) } - } else { - if c.Bool("git-netrc-pass") || len(c.StringSlice("secrets")) > 0 { - logrus.Printf("skipping all secrets because DOCKER_BUILDKIT environment variable is not set to 1 - If docker build fails on the step with secrets this is the reason why") + // Enable Buildkit if there are any secrets to pass to docker build + docker_buildkit_env_val, docker_buildkit_env_present := os.LookupEnv("DOCKER_BUILDKIT") + if docker_buildkit_env_present != true || docker_buildkit_env_val == "0" { + os.Setenv("DOCKER_BUILDKIT", "1") } - plugin.Build.Secrets = []string{} } return plugin.Exec() From 12e4959e203c4cb872c9adad7a97dcd47ead6aa0 Mon Sep 17 00:00:00 2001 From: bmwosz Date: Thu, 16 Sep 2021 14:56:25 +0200 Subject: [PATCH 6/9] Restore mainstream docker version --- docker/docker/Dockerfile.linux.amd64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker/Dockerfile.linux.amd64 b/docker/docker/Dockerfile.linux.amd64 index 9f854b41..c39c5787 100644 --- a/docker/docker/Dockerfile.linux.amd64 +++ b/docker/docker/Dockerfile.linux.amd64 @@ -1,4 +1,4 @@ -FROM docker:20.10.8-dind +FROM docker:19.03.8-dind ENV DOCKER_HOST=unix:///var/run/docker.sock From 597073f0da022c8ee4fd68bfb621fd8cf176d74c Mon Sep 17 00:00:00 2001 From: bmwosz Date: Thu, 16 Sep 2021 15:01:21 +0200 Subject: [PATCH 7/9] Change secrets usage description --- cmd/drone-docker/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 4f232969..5a5fc2ca 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -250,12 +250,12 @@ func main() { }, cli.BoolFlag{ Name: "git-netrc-pass", - Usage: "Pass git auth ~/.netrc file into docker build as secret (only if BuildKit enabled) - it will be avaliable as: id=git-netrc,src=$HOME/.netrc", + Usage: "Pass git auth ~/.netrc file into docker build as secret - it will be avaliable as: id=git-netrc,src=$HOME/.netrc", EnvVar: "PLUGIN_GIT_NETRC_PASS", }, cli.StringSliceFlag{ Name: "secrets", - Usage: "Secret file to expose to the build (only if BuildKit enabled): id=mysecret;src=/local/secret", + Usage: "Secret file to expose to the build ex: id=mysecret;src=/local/secret", EnvVar: "PLUGIN_SECRETS", }, cli.StringFlag{ From 21eb9d83ca5d6dc0b343dc3c6a9939726db45b9a Mon Sep 17 00:00:00 2001 From: bmwosz Date: Fri, 17 Sep 2021 14:17:58 +0200 Subject: [PATCH 8/9] Remove flag for passing git netrc file; allow passing environment variables as docker secrets into build --- cmd/drone-docker/main.go | 44 ++++++++++++++++++++++++---------------- docker.go | 2 +- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 5a5fc2ca..cfcd4035 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -2,6 +2,7 @@ package main import ( "os" + "strings" "github.com/joho/godotenv" "github.com/sirupsen/logrus" @@ -248,10 +249,10 @@ func main() { Usage: "additional host:IP mapping", EnvVar: "PLUGIN_ADD_HOST", }, - cli.BoolFlag{ - Name: "git-netrc-pass", - Usage: "Pass git auth ~/.netrc file into docker build as secret - it will be avaliable as: id=git-netrc,src=$HOME/.netrc", - EnvVar: "PLUGIN_GIT_NETRC_PASS", + cli.StringSliceFlag{ + Name: "secrets-from-env", + Usage: "The list of environment variables provided to secrets list in lowercase", + EnvVar: "PLUGIN_SECRETS_FROM_ENV", }, cli.StringSliceFlag{ Name: "secrets", @@ -343,31 +344,38 @@ func run(c *cli.Context) error { } } - if c.Bool("git-netrc-pass") || len(c.StringSlice("secrets")) > 0 { + // secrets list handling + if len(c.StringSlice("secrets-from-env")) > 0 || len(c.StringSlice("secrets")) > 0 { + // Replace provided string separator with , in the list of strings if c.String("secret-separator") == "," && len(c.StringSlice("secrets")) > 0 { logrus.Fatal("secret variables separator ',' will break build - please use default one or any other") + } else if len(c.StringSlice("secrets")) > 0 { + secretslist := []string{} + for _, secret := range c.StringSlice("secrets") { + secretslist = append(secretslist, strings.Replace(secret, c.String("secret-separator"), ",", -1)) + } + plugin.Build.Secrets = secretslist } - if c.Bool("git-netrc-pass") { + + // Create secret files based on environment variables + if len(c.StringSlice("secrets-from-env")) > 0 { // Detect current user home directory homedirname, err := os.UserHomeDir() if err != nil { logrus.Fatal(err) } - // Create $HOME/.netrc file with correct permissions - netrcpath := homedirname + "/.netrc" - drone_netrc_file_env_val, drone_netrc_file_env_present := os.LookupEnv("DRONE_NETRC_FILE") - if drone_netrc_file_env_present { - err = os.WriteFile(netrcpath, []byte(drone_netrc_file_env_val), 0600) - if err != nil { - logrus.Fatal(err) + for _, secret := range c.StringSlice("secrets-from-env") { + env_val, env_present := os.LookupEnv(secret) + if env_present { + secretfilepath := homedirname + "/" + strings.ToLower(secret) + err = os.WriteFile(secretfilepath, []byte(env_val), 0600) + if err != nil { + logrus.Fatal(err) + } + plugin.Build.Secrets = append(plugin.Build.Secrets, "id="+strings.ToLower(secret)+",src="+secretfilepath) } - } else { - logrus.Fatal("DRONE_NETRC_FILE environment variable doesn't exists - cannot pass netrc file into build") } - - // Inject netrc secret into secrets - plugin.Build.Secrets = append(c.StringSlice("secrets"), "id=git-netrc,src="+netrcpath) } // Enable Buildkit if there are any secrets to pass to docker build docker_buildkit_env_val, docker_buildkit_env_present := os.LookupEnv("DOCKER_BUILDKIT") diff --git a/docker.go b/docker.go index e803bc25..09834569 100644 --- a/docker.go +++ b/docker.go @@ -264,7 +264,7 @@ func commandBuild(build Build) *exec.Cmd { args = append(args, "--target", build.Target) } for _, secret := range build.Secrets { - args = append(args, "--secret", strings.Replace(secret, build.SecretsSeparator, ",", -1)) + args = append(args, "--secret", secret) } if build.Quiet { args = append(args, "--quiet") From 02d789d795e7b34e49d96f555d552d7e98a9ffb5 Mon Sep 17 00:00:00 2001 From: bmwosz Date: Fri, 17 Sep 2021 14:19:36 +0200 Subject: [PATCH 9/9] Remove secretSeparator from Build structure --- cmd/drone-docker/main.go | 43 ++++++++++++++++++++-------------------- docker.go | 43 ++++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index cfcd4035..181e3287 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -284,28 +284,27 @@ func run(c *cli.Context) error { Config: c.String("docker.config"), }, Build: docker.Build{ - Remote: c.String("remote.url"), - Name: c.String("commit.sha"), - Dockerfile: c.String("dockerfile"), - Context: c.String("context"), - Tags: c.StringSlice("tags"), - Args: c.StringSlice("args"), - ArgsEnv: c.StringSlice("args-from-env"), - Target: c.String("target"), - Squash: c.Bool("squash"), - Pull: c.BoolT("pull-image"), - CacheFrom: c.StringSlice("cache-from"), - Compress: c.Bool("compress"), - Repo: c.String("repo"), - Labels: c.StringSlice("custom-labels"), - LabelSchema: c.StringSlice("label-schema"), - AutoLabel: c.BoolT("auto-label"), - Link: c.String("link"), - NoCache: c.Bool("no-cache"), - AddHost: c.StringSlice("add-host"), - Secrets: c.StringSlice("secrets"), - SecretsSeparator: c.String("secret-separator"), - Quiet: c.Bool("quiet"), + Remote: c.String("remote.url"), + Name: c.String("commit.sha"), + Dockerfile: c.String("dockerfile"), + Context: c.String("context"), + Tags: c.StringSlice("tags"), + Args: c.StringSlice("args"), + ArgsEnv: c.StringSlice("args-from-env"), + Target: c.String("target"), + Squash: c.Bool("squash"), + Pull: c.BoolT("pull-image"), + CacheFrom: c.StringSlice("cache-from"), + Compress: c.Bool("compress"), + Repo: c.String("repo"), + Labels: c.StringSlice("custom-labels"), + LabelSchema: c.StringSlice("label-schema"), + AutoLabel: c.BoolT("auto-label"), + Link: c.String("link"), + NoCache: c.Bool("no-cache"), + AddHost: c.StringSlice("add-host"), + Secrets: c.StringSlice("secrets"), + Quiet: c.Bool("quiet"), }, Daemon: docker.Daemon{ Registry: c.String("docker.registry"), diff --git a/docker.go b/docker.go index 09834569..540ae02b 100644 --- a/docker.go +++ b/docker.go @@ -39,28 +39,27 @@ type ( // Build defines Docker build parameters. Build struct { - Remote string // Git remote URL - Name string // Docker build using default named tag - Dockerfile string // Docker build Dockerfile - Context string // Docker build context - Tags []string // Docker build tags - Args []string // Docker build args - ArgsEnv []string // Docker build args from env - Target string // Docker build target - Squash bool // Docker build squash - Pull bool // Docker build pull - CacheFrom []string // Docker build cache-from - Compress bool // Docker build compress - Repo string // Docker build repository - LabelSchema []string // label-schema Label map - AutoLabel bool // auto-label bool - Labels []string // Label map - Link string // Git repo link - NoCache bool // Docker build no-cache - AddHost []string // Docker build add-host - Secrets []string // Docker build secret - SecretsSeparator string // Docker build secrets variables separator - Quiet bool // Docker build quiet + Remote string // Git remote URL + Name string // Docker build using default named tag + Dockerfile string // Docker build Dockerfile + Context string // Docker build context + Tags []string // Docker build tags + Args []string // Docker build args + ArgsEnv []string // Docker build args from env + Target string // Docker build target + Squash bool // Docker build squash + Pull bool // Docker build pull + CacheFrom []string // Docker build cache-from + Compress bool // Docker build compress + Repo string // Docker build repository + LabelSchema []string // label-schema Label map + AutoLabel bool // auto-label bool + Labels []string // Label map + Link string // Git repo link + NoCache bool // Docker build no-cache + AddHost []string // Docker build add-host + Secrets []string // Docker build secret + Quiet bool // Docker build quiet } // Plugin defines the Docker plugin parameters.