Skip to content

Commit e2ca89e

Browse files
committed
feat: [CI-16432]: Added new input PLUGIN_BUILDX_OPTIONS
1 parent ff923bf commit e2ca89e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

app.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ func Run() {
410410
Usage: "build target",
411411
EnvVar: "PLUGIN_HARNESS_SELF_HOSTED_GCP_JSON_KEY",
412412
},
413+
cli.StringSliceFlag{
414+
Name: "buildx-options",
415+
Usage: "additional options to pass directly to the buildx command",
416+
EnvVar: "PLUGIN_BUILDX_OPTIONS",
417+
},
413418
}
414419

415420
if err := app.Run(os.Args); err != nil {
@@ -471,6 +476,7 @@ func run(c *cli.Context) error {
471476
HarnessSelfHostedS3AccessKey: c.String("harness-self-hosted-s3-access-key"),
472477
HarnessSelfHostedS3SecretKey: c.String("harness-self-hosted-s3-secret-key"),
473478
HarnessSelfHostedGcpJsonKey: c.String("harness-self-hosted-gcp-json-key"),
479+
BuildxOptions: c.StringSlice("buildx-options"),
474480
},
475481
Daemon: Daemon{
476482
Registry: c.String("docker.registry"),

docker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ type (
9494
HarnessSelfHostedS3AccessKey string // Harness self-hosted s3 access key
9595
HarnessSelfHostedS3SecretKey string // Harness self-hosted s3 secret key
9696
HarnessSelfHostedGcpJsonKey string // Harness self hosted gcp json region
97+
BuildxOptions []string // Generic buildx options passed directly to the buildx command
9798
}
9899

99100
// Plugin defines the Docker plugin parameters.
@@ -581,6 +582,9 @@ func commandBuildx(build Build, builder Builder, dryrun bool, metadataFile strin
581582
} else {
582583
args = append(args, "--push")
583584
}
585+
if len(build.BuildxOptions) > 0 {
586+
args = append(args, build.BuildxOptions...)
587+
}
584588
args = append(args, build.Context)
585589
if metadataFile != "" {
586590
args = append(args, "--metadata-file", metadataFile)

0 commit comments

Comments
 (0)