From 1ec6edc647048c240d595f032a24d31184a02901 Mon Sep 17 00:00:00 2001 From: shovelwagon Date: Wed, 14 Feb 2018 22:01:13 -0700 Subject: [PATCH 1/4] patch nocache --- .drone.sh | 24 ++++++++++++------------ cmd/drone-docker/main.go | 9 +++++++-- docker.go | 4 ++++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.drone.sh b/.drone.sh index a86a192..fa98227 100644 --- a/.drone.sh +++ b/.drone.sh @@ -4,21 +4,21 @@ set -e set -x # compile the main binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-docker github.com/viant/drone-docker/cmd/drone-docker +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-docker github.com/viant/drone-docker/cmd/drone-docker +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm/drone-docker github.com/viant/drone-docker/cmd/drone-docker # build the heroku binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-heroku github.com/viant/drone-docker/cmd/drone-docker-heroku +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-heroku github.com/viant/drone-docker/cmd/drone-docker-heroku +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-heroku github.com/viant/drone-docker/cmd/drone-docker-heroku # build the gcr binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-gcr github.com/viant/drone-docker/cmd/drone-docker-gcr +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-gcr github.com/viant/drone-docker/cmd/drone-docker-gcr +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-gcr github.com/viant/drone-docker/cmd/drone-docker-gcr # build the ecr binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-ecr github.com/viant/drone-docker/cmd/drone-docker-ecr +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-ecr github.com/viant/drone-docker/cmd/drone-docker-ecr +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-ecr github.com/viant/drone-docker/cmd/drone-docker-ecr diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 4b4edbb..5ee26c7 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -7,8 +7,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/joho/godotenv" "github.com/urfave/cli" - - "github.com/drone-plugins/drone-docker" + docker "github.com/viant/drone-docker" ) var build = "0" // build number set at compile-time @@ -202,6 +201,11 @@ func main() { Usage: "repository default branch", EnvVar: "DRONE_REPO_BRANCH", }, + cli.BoolFlag{ + Name: "no-cache", + Usage: "donot use cached itermediate containers", + EnvVar: "NO_CACHE", + }, } if err := app.Run(os.Args); err != nil { @@ -232,6 +236,7 @@ func run(c *cli.Context) error { Compress: c.Bool("compress"), Repo: c.String("repo"), LabelSchema: c.StringSlice("label-schema"), + NoCache: c.Bool("no-cache"), }, Daemon: docker.Daemon{ Registry: c.String("docker.registry"), diff --git a/docker.go b/docker.go index 229a1d0..7990de0 100644 --- a/docker.go +++ b/docker.go @@ -49,6 +49,7 @@ type ( Compress bool // Docker build compress Repo string // Docker build repository LabelSchema []string // Label schema map + NoCache bool // Docker build no-cache } // Plugin defines the Docker plugin parameters. @@ -198,6 +199,9 @@ func commandBuild(build Build) *exec.Cmd { if build.Pull { args = append(args, "--pull=true") } + if build.NoCache { + args = append(args, "--no-cache") + } for _, arg := range build.ArgsEnv { addProxyValue(&build, arg) } From 7e0f2a61f616b76806cae12784897d6508fb4e12 Mon Sep 17 00:00:00 2001 From: shovelwagon Date: Wed, 14 Feb 2018 22:07:20 -0700 Subject: [PATCH 2/4] patch noncache for pr --- .drone.sh | 24 ++++++++++++------------ cmd/drone-docker/main.go | 3 ++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.drone.sh b/.drone.sh index fa98227..a86a192 100644 --- a/.drone.sh +++ b/.drone.sh @@ -4,21 +4,21 @@ set -e set -x # compile the main binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-docker github.com/viant/drone-docker/cmd/drone-docker -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-docker github.com/viant/drone-docker/cmd/drone-docker -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm/drone-docker github.com/viant/drone-docker/cmd/drone-docker +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker # build the heroku binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-heroku github.com/viant/drone-docker/cmd/drone-docker-heroku -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-heroku github.com/viant/drone-docker/cmd/drone-docker-heroku -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-heroku github.com/viant/drone-docker/cmd/drone-docker-heroku +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku # build the gcr binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-gcr github.com/viant/drone-docker/cmd/drone-docker-gcr -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-gcr github.com/viant/drone-docker/cmd/drone-docker-gcr -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-gcr github.com/viant/drone-docker/cmd/drone-docker-gcr +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr # build the ecr binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-ecr github.com/viant/drone-docker/cmd/drone-docker-ecr -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-ecr github.com/viant/drone-docker/cmd/drone-docker-ecr -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-ecr github.com/viant/drone-docker/cmd/drone-docker-ecr +GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr +GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 5ee26c7..bf087e8 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -7,7 +7,8 @@ import ( "github.com/Sirupsen/logrus" "github.com/joho/godotenv" "github.com/urfave/cli" - docker "github.com/viant/drone-docker" + + "github.com/drone-plugins/drone-docker" ) var build = "0" // build number set at compile-time From 1ff9aa77fde4958a7f4a79bdd79b05947a508153 Mon Sep 17 00:00:00 2001 From: shovelwagon Date: Wed, 14 Feb 2018 22:11:37 -0700 Subject: [PATCH 3/4] fix spelling of intermediate --- 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 bf087e8..613b751 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -204,7 +204,7 @@ func main() { }, cli.BoolFlag{ Name: "no-cache", - Usage: "donot use cached itermediate containers", + Usage: "donot use cached intermediate containers", EnvVar: "NO_CACHE", }, } From f82dbb903af6a0ad396e5b19bc9e6fbe57030670 Mon Sep 17 00:00:00 2001 From: shovelwagon Date: Tue, 20 Feb 2018 06:00:19 -0700 Subject: [PATCH 4/4] Fix environment variable naming and update usage --- 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 613b751..636a625 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -204,8 +204,8 @@ func main() { }, cli.BoolFlag{ Name: "no-cache", - Usage: "donot use cached intermediate containers", - EnvVar: "NO_CACHE", + Usage: "do not use cached intermediate containers", + EnvVar: "PLUGIN_NO_CACHE", }, }