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 0da7fa11f fix(trait): telemetry workaround
0da7fa11f is described below

commit 0da7fa11fd7b46ebf66c0987d075434ad7ec317a
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Tue Jan 28 18:42:03 2025 +0100

    fix(trait): telemetry workaround
    
    Closes #6002
---
 pkg/trait/telemetry.go | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/pkg/trait/telemetry.go b/pkg/trait/telemetry.go
index e4ab41ec8..54c0f7cf4 100644
--- a/pkg/trait/telemetry.go
+++ b/pkg/trait/telemetry.go
@@ -20,6 +20,7 @@ package trait
 import (
        "fmt"
 
+       "github.com/Masterminds/semver"
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
        "github.com/apache/camel-k/v2/pkg/trait/discovery"
@@ -130,11 +131,20 @@ func (t *telemetryTrait) Configure(e *Environment) (bool, 
*TraitCondition, error
 func (t *telemetryTrait) Apply(e *Environment) error {
        util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities, 
v1.CapabilityTelemetry)
 
-       // Hack for camel-k-runtime 3.15.0
-       if e.CamelCatalog.CamelCatalogSpec.Runtime.Provider.IsQuarkusBased() &&
-               e.CamelCatalog.CamelCatalogSpec.Runtime.Version == "3.15.0" {
-               t.setRuntimeProviderQuarkus315Properties(e)
-               return nil
+       if e.CamelCatalog.CamelCatalogSpec.Runtime.Provider.IsQuarkusBased() {
+               // Hack for camel-k-runtime >= 3.15.0
+               ck315, err := semver.NewVersion("3.15.0")
+               if err != nil {
+                       return err
+               }
+               qv, err := 
semver.NewVersion(e.CamelCatalog.CamelCatalogSpec.Runtime.Version)
+               if err != nil {
+                       return err
+               }
+               if qv.Compare(ck315) >= 0 {
+                       t.setRuntimeProviderQuarkus315Properties(e)
+                       return nil
+               }
        }
        if e.CamelCatalog.Runtime.Capabilities["telemetry"].RuntimeProperties 
!= nil {
                t.setCatalogConfiguration(e)

Reply via email to