patch nocache

This commit is contained in:
shovelwagon 2018-02-14 22:01:13 -07:00
parent af4a2586ce
commit 1ec6edc647
3 changed files with 23 additions and 14 deletions

View File

@ -4,21 +4,21 @@ set -e
set -x set -x
# compile the main binary # 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=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/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/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/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/viant/drone-docker/cmd/drone-docker
# build the heroku binary # 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=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/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/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/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/viant/drone-docker/cmd/drone-docker-heroku
# build the gcr binary # 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=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/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/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/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/viant/drone-docker/cmd/drone-docker-gcr
# build the ecr binary # 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=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/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/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/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/viant/drone-docker/cmd/drone-docker-ecr

View File

@ -7,8 +7,7 @@ import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/joho/godotenv" "github.com/joho/godotenv"
"github.com/urfave/cli" "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 var build = "0" // build number set at compile-time
@ -202,6 +201,11 @@ func main() {
Usage: "repository default branch", Usage: "repository default branch",
EnvVar: "DRONE_REPO_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 { if err := app.Run(os.Args); err != nil {
@ -232,6 +236,7 @@ func run(c *cli.Context) error {
Compress: c.Bool("compress"), Compress: c.Bool("compress"),
Repo: c.String("repo"), Repo: c.String("repo"),
LabelSchema: c.StringSlice("label-schema"), LabelSchema: c.StringSlice("label-schema"),
NoCache: c.Bool("no-cache"),
}, },
Daemon: docker.Daemon{ Daemon: docker.Daemon{
Registry: c.String("docker.registry"), Registry: c.String("docker.registry"),

View File

@ -49,6 +49,7 @@ type (
Compress bool // Docker build compress Compress bool // Docker build compress
Repo string // Docker build repository Repo string // Docker build repository
LabelSchema []string // Label schema map LabelSchema []string // Label schema map
NoCache bool // Docker build no-cache
} }
// Plugin defines the Docker plugin parameters. // Plugin defines the Docker plugin parameters.
@ -198,6 +199,9 @@ func commandBuild(build Build) *exec.Cmd {
if build.Pull { if build.Pull {
args = append(args, "--pull=true") args = append(args, "--pull=true")
} }
if build.NoCache {
args = append(args, "--no-cache")
}
for _, arg := range build.ArgsEnv { for _, arg := range build.ArgsEnv {
addProxyValue(&build, arg) addProxyValue(&build, arg)
} }