Skip to content

Commit

Permalink
fix(trait): inherit platform configuration
Browse files Browse the repository at this point in the history
Closes #5289
  • Loading branch information
squakez committed Apr 19, 2024
1 parent adf2988 commit c6b73de
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/trait/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ func (t *builderTrait) Configure(e *Environment) (bool, *TraitCondition, error)

condition := t.adaptDeprecatedFields()

t.setPlatform(e)

if e.IntegrationKitInPhase(v1.IntegrationKitPhaseBuildSubmitted) {
if trait := e.Catalog.GetTrait(quarkusTraitID); trait != nil {
quarkus, ok := trait.(*quarkusTrait)
Expand Down Expand Up @@ -627,3 +629,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
}
}
}

0 comments on commit c6b73de

Please sign in to comment.