You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2024/04/19 09:43:01 UTC
(camel-k) 02/03: fix(trait): inherit platform configuration
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch release-2.3.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit c6b73dec67e53f32ea357652da63ba539d001467
Author: Pasquale Congiusti <pa...@gmail.com>
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 b30fa0cbe..e4422eedf 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -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)
@@ -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
+ }
+ }
+}