diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go index 2bd7b88ec5..115ea6d66d 100644 --- a/pkg/trait/builder.go +++ b/pkg/trait/builder.go @@ -96,6 +96,8 @@ func (t *builderTrait) Configure(e *Environment) (bool, *TraitCondition, error) condition = newOrAppend(condition, "Spectrum publishing strategy is deprecated and may be removed in future releases. Make sure to use any supported publishing strategy instead.") } + t.setPlatform(e) + if e.IntegrationKitInPhase(v1.IntegrationKitPhaseBuildSubmitted) { if trait := e.Catalog.GetTrait(quarkusTraitID); trait != nil { quarkus, ok := trait.(*quarkusTrait) @@ -630,3 +632,12 @@ func publishingOrUserTask(t v1.Task) bool { return false } + +// Will set a default platform if either specified in the trait or the platform/profile configuration. +func (t *builderTrait) setPlatform(e *Environment) { + if t.ImagePlatforms == nil { + if e.Platform != nil && e.Platform.Status.Build.BuildConfiguration.ImagePlatforms != nil { + t.ImagePlatforms = e.Platform.Status.Build.BuildConfiguration.ImagePlatforms + } + } +}