Skip to content

Commit

Permalink
Merge pull request #4 from drone-plugins/custom_buildkit
Browse files Browse the repository at this point in the history
Add support for builder driver opts
  • Loading branch information
shubham149 authored May 8, 2023
2 parents 51d0139 + 65ea605 commit 5d9579f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions buildx.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func cmdSetupBuildx(builder Builder) *exec.Cmd {
if builder.Name != "" {
args = append(args, "--name", builder.Name)
}
if builder.DriverOpts != "" {
args = append(args, "--driver-opt", builder.DriverOpts)
for _, opt := range builder.DriverOpts {
args = append(args, "--driver-opt", opt)
}
if builder.RemoteConn != "" && builder.Driver == remoteDriver {
args = append(args, builder.RemoteConn)
Expand Down
6 changes: 4 additions & 2 deletions cmd/drone-docker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,11 @@ func main() {
Name: "builder-driver",
EnvVar: "PLUGIN_BUILDER_DRIVER",
},
cli.StringFlag{
cli.GenericFlag{
Name: "builder-driver-opts",
Usage: "buildx builder driver opts",
EnvVar: "PLUGIN_BUILDER_DRIVER_OPTS",
Value: new(docker.CustomStringSliceFlag),
},
cli.StringFlag{
Name: "builder-remote-conn",
Expand Down Expand Up @@ -366,7 +368,7 @@ func run(c *cli.Context) error {
Builder: docker.Builder{
Name: c.String("builder-name"),
Driver: c.String("builder-driver"),
DriverOpts: c.String("builder-driver-opts"),
DriverOpts: c.Generic("builder-driver-opts").(*docker.CustomStringSliceFlag).GetValue(),
RemoteConn: c.String("builder-remote-conn"),
},
}
Expand Down
8 changes: 4 additions & 4 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ type (
}

Builder struct {
Name string // Buildx builder name
Driver string // Buildx driver type
DriverOpts string // Buildx driver opts
RemoteConn string // Buildx remote connection endpoint
Name string // Buildx builder name
Driver string // Buildx driver type
DriverOpts []string // Buildx driver opts
RemoteConn string // Buildx remote connection endpoint
}

// Login defines Docker login parameters.
Expand Down

0 comments on commit 5d9579f

Please sign in to comment.