This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 71172f8a0 fix(trait): inherit platform configuration
71172f8a0 is described below
commit 71172f8a0f8902345a60cdf415f74eee1e9cdb31
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Thu Apr 18 16:40:30 2024 +0200
fix(trait): inherit platform configuration
Closes #5289
---
pkg/trait/builder.go | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index 2bd7b88ec..115ea6d66 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
+ }
+ }
+}