@@ -45,33 +45,35 @@ type (
4545
4646 // Build defines Docker build parameters.
4747 Build struct {
48- Remote string // Git remote URL
49- Name string // Docker build using default named tag
50- TempTag string // Temporary tag used during docker build
51- Dockerfile string // Docker build Dockerfile
52- Context string // Docker build context
53- Tags []string // Docker build tags
54- Args []string // Docker build args
55- ArgsEnv []string // Docker build args from env
56- Target string // Docker build target
57- Squash bool // Docker build squash
58- Pull bool // Docker build pull
59- CacheFrom []string // Docker build cache-from
60- Compress bool // Docker build compress
61- Repo string // Docker build repository
62- LabelSchema []string // label-schema Label map
63- AutoLabel bool // auto-label bool
64- Labels []string // Label map
65- Link string // Git repo link
66- NoCache bool // Docker build no-cache
67- Secret string // secret keypair
68- SecretEnvs []string // Docker build secrets with env var as source
69- SecretFiles []string // Docker build secrets with file as source
70- AddHost []string // Docker build add-host
71- Quiet bool // Docker build quiet
72- Platform string // Docker build platform
73- SSHAgentKey string // Docker build ssh agent key
74- SSHKeyPath string // Docker build ssh key path
48+ Remote string // Git remote URL
49+ Name string // Docker build using default named tag
50+ TempTag string // Temporary tag used during docker build
51+ Dockerfile string // Docker build Dockerfile
52+ Context string // Docker build context
53+ Tags []string // Docker build tags
54+ Args []string // Docker build args
55+ ArgsEnv []string // Docker build args from env
56+ ArgsNew []string // docker build args which has comma seperated values
57+ IsMultipleBuildArgs bool // env variable for fall back to old build args
58+ Target string // Docker build target
59+ Squash bool // Docker build squash
60+ Pull bool // Docker build pull
61+ CacheFrom []string // Docker build cache-from
62+ Compress bool // Docker build compress
63+ Repo string // Docker build repository
64+ LabelSchema []string // label-schema Label map
65+ AutoLabel bool // auto-label bool
66+ Labels []string // Label map
67+ Link string // Git repo link
68+ NoCache bool // Docker build no-cache
69+ Secret string // secret keypair
70+ SecretEnvs []string // Docker build secrets with env var as source
71+ SecretFiles []string // Docker build secrets with file as source
72+ AddHost []string // Docker build add-host
73+ Quiet bool // Docker build quiet
74+ Platform string // Docker build platform
75+ SSHAgentKey string // Docker build ssh agent key
76+ SSHKeyPath string // Docker build ssh key path
7577 }
7678
7779 // Plugin defines the Docker plugin parameters.
@@ -413,8 +415,14 @@ func commandBuild(build Build) *exec.Cmd {
413415 for _ , arg := range build .ArgsEnv {
414416 addProxyValue (& build , arg )
415417 }
416- for _ , arg := range build .Args {
417- args = append (args , "--build-arg" , arg )
418+ if build .IsMultipleBuildArgs {
419+ for _ , arg := range build .ArgsNew {
420+ args = append (args , "--build-arg" , arg )
421+ }
422+ } else {
423+ for _ , arg := range build .Args {
424+ args = append (args , "--build-arg" , arg )
425+ }
418426 }
419427 for _ , host := range build .AddHost {
420428 args = append (args , "--add-host" , host )
@@ -519,6 +527,10 @@ func addProxyValue(build *Build, key string) {
519527 build .Args = append (build .Args , fmt .Sprintf ("%s=%s" , key , value ))
520528 build .Args = append (build .Args , fmt .Sprintf ("%s=%s" , strings .ToUpper (key ), value ))
521529 }
530+ if len (value ) > 0 && ! hasProxyBuildArgNew (build , key ) {
531+ build .ArgsNew = append (build .ArgsNew , fmt .Sprintf ("%s=%s" , key , value ))
532+ build .ArgsNew = append (build .ArgsNew , fmt .Sprintf ("%s=%s" , strings .ToUpper (key ), value ))
533+ }
522534}
523535
524536// helper function to get a proxy value from the environment.
@@ -546,6 +558,17 @@ func hasProxyBuildArg(build *Build, key string) bool {
546558
547559 return false
548560}
561+ func hasProxyBuildArgNew (build * Build , key string ) bool {
562+ keyUpper := strings .ToUpper (key )
563+
564+ for _ , s := range build .ArgsNew {
565+ if strings .HasPrefix (s , key ) || strings .HasPrefix (s , keyUpper ) {
566+ return true
567+ }
568+ }
569+
570+ return false
571+ }
549572
550573// helper function to create the docker tag command.
551574func commandTag (build Build , tag string ) * exec.Cmd {
0 commit comments