mirror of
https://github.com/drone-plugins/drone-docker.git
synced 2026-06-14 05:13:02 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcc762d301 | |||
| b318c15acb | |||
| 86de147dc8 | |||
| 68605049b7 | |||
| e2e30f3015 | |||
| 4999d4ca01 | |||
| b28dae76d7 |
+27
-27
@@ -162,7 +162,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: go build
|
- name: go build
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
commands:
|
commands:
|
||||||
@@ -264,7 +264,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker'
|
||||||
environment:
|
environment:
|
||||||
@@ -275,7 +275,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker'
|
||||||
environment:
|
environment:
|
||||||
@@ -285,7 +285,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: executable
|
- name: executable
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- ./release/linux/amd64/drone-docker --help
|
- ./release/linux/amd64/drone-docker --help
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker'
|
||||||
environment:
|
environment:
|
||||||
@@ -340,7 +340,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker'
|
||||||
environment:
|
environment:
|
||||||
@@ -350,7 +350,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: executable
|
- name: executable
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- ./release/linux/arm64/drone-docker --help
|
- ./release/linux/arm64/drone-docker --help
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr'
|
||||||
environment:
|
environment:
|
||||||
@@ -440,7 +440,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr'
|
||||||
environment:
|
environment:
|
||||||
@@ -488,7 +488,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr'
|
||||||
environment:
|
environment:
|
||||||
@@ -499,7 +499,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr'
|
||||||
environment:
|
environment:
|
||||||
@@ -582,7 +582,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-gar ./cmd/drone-gar'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-gar ./cmd/drone-gar'
|
||||||
environment:
|
environment:
|
||||||
@@ -593,7 +593,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-gar ./cmd/drone-gar'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-gar ./cmd/drone-gar'
|
||||||
environment:
|
environment:
|
||||||
@@ -641,7 +641,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-gar ./cmd/drone-gar'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-gar ./cmd/drone-gar'
|
||||||
environment:
|
environment:
|
||||||
@@ -652,7 +652,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-gar ./cmd/drone-gar'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-gar ./cmd/drone-gar'
|
||||||
environment:
|
environment:
|
||||||
@@ -734,7 +734,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr'
|
||||||
environment:
|
environment:
|
||||||
@@ -744,7 +744,7 @@ steps:
|
|||||||
exclude:
|
exclude:
|
||||||
- tag
|
- tag
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr'
|
||||||
environment:
|
environment:
|
||||||
@@ -792,7 +792,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr'
|
||||||
environment:
|
environment:
|
||||||
@@ -802,7 +802,7 @@ steps:
|
|||||||
exclude:
|
exclude:
|
||||||
- tag
|
- tag
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr'
|
||||||
environment:
|
environment:
|
||||||
@@ -885,7 +885,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku'
|
||||||
environment:
|
environment:
|
||||||
@@ -895,7 +895,7 @@ steps:
|
|||||||
exclude:
|
exclude:
|
||||||
- tag
|
- tag
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku'
|
||||||
environment:
|
environment:
|
||||||
@@ -944,7 +944,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku'
|
- 'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku'
|
||||||
environment:
|
environment:
|
||||||
@@ -954,7 +954,7 @@ steps:
|
|||||||
exclude:
|
exclude:
|
||||||
- tag
|
- tag
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku'
|
||||||
environment:
|
environment:
|
||||||
@@ -1035,7 +1035,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-acr ./cmd/drone-acr'
|
- 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-acr ./cmd/drone-acr'
|
||||||
environment:
|
environment:
|
||||||
@@ -1045,7 +1045,7 @@ steps:
|
|||||||
exclude:
|
exclude:
|
||||||
- tag
|
- tag
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-acr ./cmd/drone-acr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-acr ./cmd/drone-acr'
|
||||||
environment:
|
environment:
|
||||||
@@ -1093,7 +1093,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-acr ./cmd/drone-acr'
|
- 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-acr ./cmd/drone-acr'
|
||||||
environment:
|
environment:
|
||||||
@@ -1104,7 +1104,7 @@ steps:
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
image: golang:1.22.4
|
image: golang:1.22.7
|
||||||
commands:
|
commands:
|
||||||
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-acr ./cmd/drone-acr'
|
- 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-acr ./cmd/drone-acr'
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CustomStringSliceFlag is like a regular StringSlice flag but with
|
||||||
|
// semicolon as a delimiter
|
||||||
|
type CustomStringSliceFlag struct {
|
||||||
|
Value []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *CustomStringSliceFlag) GetValue() []string {
|
||||||
|
if f.Value == nil {
|
||||||
|
return make([]string, 0)
|
||||||
|
}
|
||||||
|
return f.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *CustomStringSliceFlag) String() string {
|
||||||
|
if f.Value == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return strings.Join(f.Value, ";")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *CustomStringSliceFlag) Set(v string) error {
|
||||||
|
for _, s := range strings.Split(v, ";") {
|
||||||
|
s = strings.TrimSpace(s)
|
||||||
|
f.Value = append(f.Value, s)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
+39
-26
@@ -151,6 +151,17 @@ func main() {
|
|||||||
Usage: "build args",
|
Usage: "build args",
|
||||||
EnvVar: "PLUGIN_BUILD_ARGS_FROM_ENV",
|
EnvVar: "PLUGIN_BUILD_ARGS_FROM_ENV",
|
||||||
},
|
},
|
||||||
|
cli.GenericFlag{
|
||||||
|
Name: "args-new",
|
||||||
|
Usage: "build args new",
|
||||||
|
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
|
||||||
|
Value: new(CustomStringSliceFlag),
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "plugin-multiple-build-agrs",
|
||||||
|
Usage: "plugin multiple build agrs",
|
||||||
|
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
|
||||||
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "quiet",
|
Name: "quiet",
|
||||||
Usage: "quiet docker build",
|
Usage: "quiet docker build",
|
||||||
@@ -339,32 +350,34 @@ func run(c *cli.Context) error {
|
|||||||
CardPath: c.String("drone-card-path"),
|
CardPath: c.String("drone-card-path"),
|
||||||
ArtifactFile: c.String("artifact-file"),
|
ArtifactFile: c.String("artifact-file"),
|
||||||
Build: docker.Build{
|
Build: docker.Build{
|
||||||
Remote: c.String("remote.url"),
|
Remote: c.String("remote.url"),
|
||||||
Name: c.String("commit.sha"),
|
Name: c.String("commit.sha"),
|
||||||
TempTag: generateTempTag(),
|
TempTag: generateTempTag(),
|
||||||
Dockerfile: c.String("dockerfile"),
|
Dockerfile: c.String("dockerfile"),
|
||||||
Context: c.String("context"),
|
Context: c.String("context"),
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
ArgsEnv: c.StringSlice("args-from-env"),
|
ArgsEnv: c.StringSlice("args-from-env"),
|
||||||
Target: c.String("target"),
|
ArgsNew: c.Generic("args-new").(*CustomStringSliceFlag).GetValue(),
|
||||||
Squash: c.Bool("squash"),
|
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
|
||||||
Pull: c.BoolT("pull-image"),
|
Target: c.String("target"),
|
||||||
CacheFrom: c.StringSlice("cache-from"),
|
Squash: c.Bool("squash"),
|
||||||
Compress: c.Bool("compress"),
|
Pull: c.BoolT("pull-image"),
|
||||||
Repo: c.String("repo"),
|
CacheFrom: c.StringSlice("cache-from"),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Compress: c.Bool("compress"),
|
||||||
LabelSchema: c.StringSlice("label-schema"),
|
Repo: c.String("repo"),
|
||||||
AutoLabel: c.BoolT("auto-label"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
Link: c.String("link"),
|
LabelSchema: c.StringSlice("label-schema"),
|
||||||
NoCache: c.Bool("no-cache"),
|
AutoLabel: c.BoolT("auto-label"),
|
||||||
Secret: c.String("secret"),
|
Link: c.String("link"),
|
||||||
SecretEnvs: c.StringSlice("secrets-from-env"),
|
NoCache: c.Bool("no-cache"),
|
||||||
SecretFiles: c.StringSlice("secrets-from-file"),
|
Secret: c.String("secret"),
|
||||||
AddHost: c.StringSlice("add-host"),
|
SecretEnvs: c.StringSlice("secrets-from-env"),
|
||||||
Quiet: c.Bool("quiet"),
|
SecretFiles: c.StringSlice("secrets-from-file"),
|
||||||
Platform: c.String("platform"),
|
AddHost: c.StringSlice("add-host"),
|
||||||
SSHAgentKey: c.String("ssh-agent-key"),
|
Quiet: c.Bool("quiet"),
|
||||||
|
Platform: c.String("platform"),
|
||||||
|
SSHAgentKey: c.String("ssh-agent-key"),
|
||||||
},
|
},
|
||||||
Daemon: docker.Daemon{
|
Daemon: docker.Daemon{
|
||||||
Registry: c.String("docker.registry"),
|
Registry: c.String("docker.registry"),
|
||||||
|
|||||||
@@ -45,33 +45,35 @@ type (
|
|||||||
|
|
||||||
// Build defines Docker build parameters.
|
// Build defines Docker build parameters.
|
||||||
Build struct {
|
Build struct {
|
||||||
Remote string // Git remote URL
|
Remote string // Git remote URL
|
||||||
Name string // Docker build using default named tag
|
Name string // Docker build using default named tag
|
||||||
TempTag string // Temporary tag used during docker build
|
TempTag string // Temporary tag used during docker build
|
||||||
Dockerfile string // Docker build Dockerfile
|
Dockerfile string // Docker build Dockerfile
|
||||||
Context string // Docker build context
|
Context string // Docker build context
|
||||||
Tags []string // Docker build tags
|
Tags []string // Docker build tags
|
||||||
Args []string // Docker build args
|
Args []string // Docker build args
|
||||||
ArgsEnv []string // Docker build args from env
|
ArgsEnv []string // Docker build args from env
|
||||||
Target string // Docker build target
|
ArgsNew []string // docker build args which has comma seperated values
|
||||||
Squash bool // Docker build squash
|
IsMultipleBuildArgs bool // env variable for fall back to old build args
|
||||||
Pull bool // Docker build pull
|
Target string // Docker build target
|
||||||
CacheFrom []string // Docker build cache-from
|
Squash bool // Docker build squash
|
||||||
Compress bool // Docker build compress
|
Pull bool // Docker build pull
|
||||||
Repo string // Docker build repository
|
CacheFrom []string // Docker build cache-from
|
||||||
LabelSchema []string // label-schema Label map
|
Compress bool // Docker build compress
|
||||||
AutoLabel bool // auto-label bool
|
Repo string // Docker build repository
|
||||||
Labels []string // Label map
|
LabelSchema []string // label-schema Label map
|
||||||
Link string // Git repo link
|
AutoLabel bool // auto-label bool
|
||||||
NoCache bool // Docker build no-cache
|
Labels []string // Label map
|
||||||
Secret string // secret keypair
|
Link string // Git repo link
|
||||||
SecretEnvs []string // Docker build secrets with env var as source
|
NoCache bool // Docker build no-cache
|
||||||
SecretFiles []string // Docker build secrets with file as source
|
Secret string // secret keypair
|
||||||
AddHost []string // Docker build add-host
|
SecretEnvs []string // Docker build secrets with env var as source
|
||||||
Quiet bool // Docker build quiet
|
SecretFiles []string // Docker build secrets with file as source
|
||||||
Platform string // Docker build platform
|
AddHost []string // Docker build add-host
|
||||||
SSHAgentKey string // Docker build ssh agent key
|
Quiet bool // Docker build quiet
|
||||||
SSHKeyPath string // Docker build ssh key path
|
Platform string // Docker build platform
|
||||||
|
SSHAgentKey string // Docker build ssh agent key
|
||||||
|
SSHKeyPath string // Docker build ssh key path
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin defines the Docker plugin parameters.
|
// Plugin defines the Docker plugin parameters.
|
||||||
@@ -172,10 +174,10 @@ func (p Plugin) Exec() error {
|
|||||||
|
|
||||||
if p.BaseImageRegistry != "" {
|
if p.BaseImageRegistry != "" {
|
||||||
if p.BaseImageUsername == "" {
|
if p.BaseImageUsername == "" {
|
||||||
return fmt.Errorf("Username cannot be empty. The base image connector requires authenticated access. Please either use an authenticated connector, or remove the base image connector.")
|
fmt.Printf("Username cannot be empty. The base image connector requires authenticated access. Please either use an authenticated connector, or remove the base image connector.")
|
||||||
}
|
}
|
||||||
if p.BaseImagePassword == "" {
|
if p.BaseImagePassword == "" {
|
||||||
return fmt.Errorf("Password cannot be empty. The base image connector requires authenticated access. Please either use an authenticated connector, or remove the base image connector.")
|
fmt.Printf("Password cannot be empty. The base image connector requires authenticated access. Please either use an authenticated connector, or remove the base image connector.")
|
||||||
}
|
}
|
||||||
var baseConnectorLogin Login
|
var baseConnectorLogin Login
|
||||||
baseConnectorLogin.Registry = p.BaseImageRegistry
|
baseConnectorLogin.Registry = p.BaseImageRegistry
|
||||||
@@ -413,8 +415,14 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
for _, arg := range build.ArgsEnv {
|
for _, arg := range build.ArgsEnv {
|
||||||
addProxyValue(&build, arg)
|
addProxyValue(&build, arg)
|
||||||
}
|
}
|
||||||
for _, arg := range build.Args {
|
if build.IsMultipleBuildArgs {
|
||||||
args = append(args, "--build-arg", arg)
|
for _, arg := range build.ArgsNew {
|
||||||
|
args = append(args, "--build-arg", arg)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for _, arg := range build.Args {
|
||||||
|
args = append(args, "--build-arg", arg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, host := range build.AddHost {
|
for _, host := range build.AddHost {
|
||||||
args = append(args, "--add-host", host)
|
args = append(args, "--add-host", host)
|
||||||
@@ -519,6 +527,10 @@ func addProxyValue(build *Build, key string) {
|
|||||||
build.Args = append(build.Args, fmt.Sprintf("%s=%s", key, value))
|
build.Args = append(build.Args, fmt.Sprintf("%s=%s", key, value))
|
||||||
build.Args = append(build.Args, fmt.Sprintf("%s=%s", strings.ToUpper(key), value))
|
build.Args = append(build.Args, fmt.Sprintf("%s=%s", strings.ToUpper(key), value))
|
||||||
}
|
}
|
||||||
|
if len(value) > 0 && !hasProxyBuildArgNew(build, key) {
|
||||||
|
build.ArgsNew = append(build.ArgsNew, fmt.Sprintf("%s=%s", key, value))
|
||||||
|
build.ArgsNew = append(build.ArgsNew, fmt.Sprintf("%s=%s", strings.ToUpper(key), value))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper function to get a proxy value from the environment.
|
// helper function to get a proxy value from the environment.
|
||||||
@@ -546,6 +558,17 @@ func hasProxyBuildArg(build *Build, key string) bool {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
func hasProxyBuildArgNew(build *Build, key string) bool {
|
||||||
|
keyUpper := strings.ToUpper(key)
|
||||||
|
|
||||||
|
for _, s := range build.ArgsNew {
|
||||||
|
if strings.HasPrefix(s, key) || strings.HasPrefix(s, keyUpper) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// helper function to create the docker tag command.
|
// helper function to create the docker tag command.
|
||||||
func commandTag(build Build, tag string) *exec.Cmd {
|
func commandTag(build Build, tag string) *exec.Cmd {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM docker:20.10.14-dind
|
FROM docker:27.3.1-dind
|
||||||
|
|
||||||
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM arm64v8/docker:20.10.14-dind
|
FROM arm64v8/docker:27.3.1-dind
|
||||||
|
|
||||||
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user