Skip to content

Commit

Permalink
(#5292): Simplify run cmd for archs other than amd64
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiesler authored and squakez committed May 8, 2024
1 parent 6be1c1b commit c6c0072
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/builder/jib.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,16 @@ 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")

// Build the integration for the arch configured in the IntegrationPlatform.
// This can explicitly be configured with the `-t builder.platforms` trait.
// Building the integration for multiarch is deferred until the next major version (e.g. 3.x)

if t.task.Configuration.ImagePlatforms != nil {
platforms := strings.Join(t.task.Configuration.ImagePlatforms, ",")
mavenArgs = append(mavenArgs, jib.JibMavenFromPlatforms+platforms)
}

if t.task.Registry.Insecure {
mavenArgs = append(mavenArgs, jib.JibMavenInsecureRegistries+"true")
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/platform/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,17 @@ func setPlatformDefaults(p *v1.IntegrationPlatform, verbose bool) error {
}
setStatusAdditionalInfo(p)

buildConfig := &p.Status.Build.BuildConfiguration
if buildConfig.ImagePlatforms == nil {
if runtime.GOARCH == "arm64" {
buildConfig.ImagePlatforms = []string{"linux/arm64"}
}
}

if verbose {
log.Log.Infof("RuntimeVersion set to %s", p.Status.Build.RuntimeVersion)
log.Log.Infof("BaseImage set to %s", p.Status.Build.BaseImage)
log.Log.Infof("ImagePlatforms set to %s", buildConfig.ImagePlatforms)
log.Log.Infof("LocalRepository set to %s", p.Status.Build.Maven.LocalRepository)
log.Log.Infof("Timeout set to %s", p.Status.Build.GetTimeout())
}
Expand Down

0 comments on commit c6c0072

Please sign in to comment.