@@ -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,16 @@ 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+ fmt .Println (arg )
421+ fmt .Println ("hehe" )
422+ args = append (args , "--build-arg" , arg )
423+ }
424+ } else {
425+ for _ , arg := range build .Args {
426+ args = append (args , "--build-arg" , arg )
427+ }
418428 }
419429 for _ , host := range build .AddHost {
420430 args = append (args , "--add-host" , host )
@@ -519,6 +529,10 @@ func addProxyValue(build *Build, key string) {
519529 build .Args = append (build .Args , fmt .Sprintf ("%s=%s" , key , value ))
520530 build .Args = append (build .Args , fmt .Sprintf ("%s=%s" , strings .ToUpper (key ), value ))
521531 }
532+ if len (value ) > 0 && ! hasProxyBuildArgNew (build , key ) {
533+ build .ArgsNew = append (build .ArgsNew , fmt .Sprintf ("%s=%s" , key , value ))
534+ build .ArgsNew = append (build .ArgsNew , fmt .Sprintf ("%s=%s" , strings .ToUpper (key ), value ))
535+ }
522536}
523537
524538// helper function to get a proxy value from the environment.
@@ -546,6 +560,17 @@ func hasProxyBuildArg(build *Build, key string) bool {
546560
547561 return false
548562}
563+ func hasProxyBuildArgNew (build * Build , key string ) bool {
564+ keyUpper := strings .ToUpper (key )
565+
566+ for _ , s := range build .ArgsNew {
567+ if strings .HasPrefix (s , key ) || strings .HasPrefix (s , keyUpper ) {
568+ return true
569+ }
570+ }
571+
572+ return false
573+ }
549574
550575// helper function to create the docker tag command.
551576func commandTag (build Build , tag string ) * exec.Cmd {
0 commit comments