Skip to content

Commit

Permalink
fix(trait): inherit platform configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Apr 18, 2024
1 parent c9f6c2a commit 99a3a18
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 @@ -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)
Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 99a3a18

Please sign in to comment.