Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit a6cc96f

Browse files
authored
fix: allow multi-platform builds using --push flag (#29)
1 parent 562ee26 commit a6cc96f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

plugin/docker.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func commandBuild(build Build) *exec.Cmd {
6565
args := []string{
6666
"buildx",
6767
"build",
68-
"--load",
6968
"--rm=true",
7069
"-f", build.Dockerfile,
7170
"-t", build.Name,
@@ -107,6 +106,12 @@ func commandBuild(build Build) *exec.Cmd {
107106
args = append(args, "--quiet")
108107
}
109108

109+
if len(build.Platforms.Value()) > 1 {
110+
args = append(args, "--push")
111+
} else {
112+
args = append(args, "--load")
113+
}
114+
110115
if len(build.Platforms.Value()) > 0 {
111116
args = append(args, "--platform", strings.Join(build.Platforms.Value()[:], ","))
112117
}

plugin/impl.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ func (p *Plugin) Validate() error {
8383
p.settings.Build.Ref = p.pipeline.Commit.Ref
8484
p.settings.Daemon.Registry = p.settings.Login.Registry
8585

86+
if len(p.settings.Build.Platforms.Value()) > 1 && p.settings.Dryrun {
87+
return fmt.Errorf("dryrun is not supported on multi-platform builds")
88+
}
89+
8690
if p.settings.Build.TagsAuto {
8791
// return true if tag event or default branch
8892
if UseDefaultTag(

0 commit comments

Comments
 (0)