Skip to content

Commit 07045cc

Browse files
committed
changes for load and push
1 parent 11440e2 commit 07045cc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

common/common.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ func buildDockerCommand(imageName, dockerfile string, buildArgs []string, noCach
495495

496496
// RunBuild runs function from func.yaml/json/yml.
497497
func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []string, noCache bool, containerEngineType string, shape string) error {
498+
var issuePush bool
498499
cancel := make(chan os.Signal, 3)
499500
signal.Notify(cancel, os.Interrupt) // and others perhaps
500501
defer signal.Stop(cancel)
@@ -530,6 +531,7 @@ func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []strin
530531

531532
go func(done chan<- error) {
532533
var dockerBuildCmdArgs []string
534+
533535
// Depending whether architecture list is passed or not trigger docker buildx or docker build accordingly
534536

535537
if arch, ok := ShapeMap[shape]; ok {
@@ -553,6 +555,7 @@ func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []strin
553555
} else {
554556
fmt.Println("TargetedPlatform and hostPlatform are same")
555557
dockerBuildCmdArgs = buildDockerCommand(imageName, dockerfile, buildArgs, noCache)
558+
issuePush = true
556559
}
557560
}
558561
}
@@ -580,7 +583,7 @@ func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []strin
580583
fmt.Fprintln(os.Stderr)
581584
return fmt.Errorf("build cancelled on signal %v", signal)
582585
}
583-
if containerEngineType != containerEngineTypeDocker {
586+
if containerEngineType != containerEngineTypeDocker || issuePush {
584587
fmt.Println("Using Container engine", containerEngineType, "to push as --push id only for docker and --load is for podman")
585588
// Push to docker registry
586589
fmt.Println("Using Container engine", containerEngineType, "to push")

0 commit comments

Comments
 (0)