Skip to content

Commit

Permalink
fix(apache#5292): Simplify run cmd for archs other than amd64
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiesler committed Apr 24, 2024
1 parent 57149cf commit d819b72
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/builder/jib.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
Expand Down Expand Up @@ -111,10 +112,17 @@ func (t *jibTask) Do(ctx context.Context) v1.BuildStatus {
mavenArgs = append(mavenArgs, jib.JibMavenToImageParam+t.task.Image)
mavenArgs = append(mavenArgs, jib.JibMavenFromImageParam+baseImage)
mavenArgs = append(mavenArgs, jib.JibMavenBaseImageCache+mavenDir+"/jib")

// If not explicitly configured otherwise, we build the integration for the arch we run on.
// Building the integration for multiarch is deferred until the next major version (e.g. 3.x)
jibFromPlatforms := "linux/amd64"
if t.task.Configuration.ImagePlatforms != nil {
platforms := strings.Join(t.task.Configuration.ImagePlatforms, ",")
mavenArgs = append(mavenArgs, jib.JibMavenFromPlatforms+platforms)
jibFromPlatforms = strings.Join(t.task.Configuration.ImagePlatforms, ",")
} else if runtime.GOARCH == "arm64" {
jibFromPlatforms = "linux/arm64"
}
mavenArgs = append(mavenArgs, jib.JibMavenFromPlatforms+jibFromPlatforms)

if t.task.Registry.Insecure {
mavenArgs = append(mavenArgs, jib.JibMavenInsecureRegistries+"true")
}
Expand Down

0 comments on commit d819b72

Please sign in to comment.