Skip to content

Commit 4d92e81

Browse files
ohenningTP Honey
authored andcommitted
Add option to mount host ssh agent (--ssh)
1 parent 94c8139 commit 4d92e81

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cmd/drone-docker/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ func main() {
274274
Usage: "platform value to pass to docker",
275275
EnvVar: "PLUGIN_PLATFORM",
276276
},
277+
cli.StringSliceFlag{
278+
Name: "ssh-agent",
279+
Usage: "mount ssh agent",
280+
EnvVar: "PLUGIN_SSH_AGENT",
281+
},
277282
}
278283

279284
if err := app.Run(os.Args); err != nil {
@@ -318,6 +323,7 @@ func run(c *cli.Context) error {
318323
AddHost: c.StringSlice("add-host"),
319324
Quiet: c.Bool("quiet"),
320325
Platform: c.String("platform"),
326+
SSHAgent: c.StringSlice("ssh-agent"),
321327
},
322328
Daemon: docker.Daemon{
323329
Registry: c.String("docker.registry"),

docker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type (
6464
AddHost []string // Docker build add-host
6565
Quiet bool // Docker build quiet
6666
Platform string // Docker build platform
67+
SSHAgent []string // Docker build ssh
6768
}
6869

6970
// Plugin defines the Docker plugin parameters.
@@ -328,6 +329,9 @@ func commandBuild(build Build) *exec.Cmd {
328329
if build.Platform != "" {
329330
args = append(args, "--platform", build.Platform)
330331
}
332+
if build.SSHAgent != "" {
333+
args = append(args, "--ssh", build.SSHAgent)
334+
}
331335

332336
if build.AutoLabel {
333337
labelSchema := []string{

0 commit comments

Comments
 (0)