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 b86a7fb72 fix(trait): catalog to drive dependencies
b86a7fb72 is described below

commit b86a7fb72ff5bedbc2a96b9c40fb40a693aa3b9b
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Fri Jan 26 15:31:08 2024 +0100

    fix(trait): catalog to drive dependencies
---
 addons/vault/aws/aws_secrets_manager.go   |  3 --
 addons/vault/azure/azure_key_vault.go     |  3 --
 addons/vault/gcp/gcp_secret_manager.go    |  3 --
 addons/vault/hashicorp/hashicorp_vault.go |  3 --
 pkg/trait/knative.go                      |  6 ---
 pkg/trait/prometheus.go                   |  5 ---
 pkg/util/camel/camel_runtime_test.go      | 65 +++++++++++++++++++++++++++++++
 7 files changed, 65 insertions(+), 23 deletions(-)

diff --git a/addons/vault/aws/aws_secrets_manager.go 
b/addons/vault/aws/aws_secrets_manager.go
index 1a98e0324..86d1c31b6 100644
--- a/addons/vault/aws/aws_secrets_manager.go
+++ b/addons/vault/aws/aws_secrets_manager.go
@@ -108,9 +108,6 @@ func (t *awsSecretsManagerTrait) Apply(environment 
*trait.Environment) error {
        rex := 
regexp.MustCompile(`^(configmap|secret):([a-zA-Z0-9][a-zA-Z0-9-]*)(/([a-zA-Z0-9].*))?$`)
        if environment.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
                
util.StringSliceUniqueAdd(&environment.Integration.Status.Capabilities, 
v1.CapabilityAwsSecretsManager)
-               // Deprecated
-               // remove dependencies after Camel K Runtime > 2.16.0 and no 
longer supported or LTS
-               
util.StringSliceUniqueAdd(&environment.Integration.Status.Dependencies, 
"mvn:org.apache.camel.quarkus:camel-quarkus-aws-secrets-manager")
        }
 
        if environment.IntegrationInRunningPhases() {
diff --git a/addons/vault/azure/azure_key_vault.go 
b/addons/vault/azure/azure_key_vault.go
index 04281fe04..6a639442b 100644
--- a/addons/vault/azure/azure_key_vault.go
+++ b/addons/vault/azure/azure_key_vault.go
@@ -114,9 +114,6 @@ func (t *azureKeyVaultTrait) Apply(environment 
*trait.Environment) error {
        rex := 
regexp.MustCompile(`^(configmap|secret):([a-zA-Z0-9][a-zA-Z0-9-]*)(/([a-zA-Z0-9].*))?$`)
        if environment.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
                
util.StringSliceUniqueAdd(&environment.Integration.Status.Capabilities, 
v1.CapabilityAzureKeyVault)
-               // Deprecated
-               // remove dependencies after Camel K Runtime > 2.16.0 and no 
longer supported or LTS
-               
util.StringSliceUniqueAdd(&environment.Integration.Status.Dependencies, 
"mvn:org.apache.camel.quarkus:camel-quarkus-azure-key-vault")
        }
 
        if environment.IntegrationInRunningPhases() {
diff --git a/addons/vault/gcp/gcp_secret_manager.go 
b/addons/vault/gcp/gcp_secret_manager.go
index 7f9810dbc..12ae1a2d3 100644
--- a/addons/vault/gcp/gcp_secret_manager.go
+++ b/addons/vault/gcp/gcp_secret_manager.go
@@ -102,9 +102,6 @@ func (t *gcpSecretManagerTrait) Configure(environment 
*trait.Environment) (bool,
 func (t *gcpSecretManagerTrait) Apply(environment *trait.Environment) error {
        if environment.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
                
util.StringSliceUniqueAdd(&environment.Integration.Status.Capabilities, 
v1.CapabilityGcpSecretManager)
-               // Deprecated
-               // remove dependencies after Camel K Runtime > 2.16.0 and no 
longer supported or LTS
-               
util.StringSliceUniqueAdd(&environment.Integration.Status.Dependencies, 
"mvn:org.apache.camel.quarkus:camel-quarkus-google-secret-manager")
        }
 
        if environment.IntegrationInRunningPhases() {
diff --git a/addons/vault/hashicorp/hashicorp_vault.go 
b/addons/vault/hashicorp/hashicorp_vault.go
index 616409a17..914ca3f7d 100644
--- a/addons/vault/hashicorp/hashicorp_vault.go
+++ b/addons/vault/hashicorp/hashicorp_vault.go
@@ -84,9 +84,6 @@ func (t *hashicorpVaultTrait) Apply(environment 
*trait.Environment) error {
        rex := 
regexp.MustCompile(`^(configmap|secret):([a-zA-Z0-9][a-zA-Z0-9-]*)(/([a-zA-Z0-9].*))?$`)
        if environment.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
                
util.StringSliceUniqueAdd(&environment.Integration.Status.Capabilities, 
v1.CapabilityHashicorpVault)
-               // Deprecated
-               // remove dependencies after Camel K Runtime > 2.16.0 and no 
longer supported or LTS
-               
util.StringSliceUniqueAdd(&environment.Integration.Status.Dependencies, 
"mvn:org.apache.camel.quarkus:camel-quarkus-hashicorp-vault")
        }
 
        if environment.IntegrationInRunningPhases() {
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index 0775be5ec..5de71160c 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -159,12 +159,6 @@ func (t *knativeTrait) Apply(e *Environment) error {
        if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
                util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities, 
v1.CapabilityKnative)
        }
-       // Deprecated
-       // remove dependencies after Camel K Runtime > 2.16.0 and no longer 
supported or LTS
-       if pointer.BoolDeref(t.SinkBinding, false) {
-               util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, 
"camel:knative")
-               util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, 
"mvn:org.apache.camel.k:camel-k-knative-impl")
-       }
 
        if len(t.ChannelSources) > 0 || len(t.EndpointSources) > 0 || 
len(t.EventSources) > 0 {
                util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities, 
v1.CapabilityPlatformHTTP)
diff --git a/pkg/trait/prometheus.go b/pkg/trait/prometheus.go
index e0870a041..bbc93c9d1 100644
--- a/pkg/trait/prometheus.go
+++ b/pkg/trait/prometheus.go
@@ -56,11 +56,6 @@ func (t *prometheusTrait) Configure(e *Environment) (bool, 
*TraitCondition, erro
 func (t *prometheusTrait) Apply(e *Environment) error {
        if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
                util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities, 
v1.CapabilityPrometheus)
-               // Deprecated
-               // remove dependencies after Camel K Runtime > 2.16.0 and no 
longer supported or LTS
-               util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, 
"mvn:org.apache.camel.quarkus:camel-quarkus-micrometer")
-               util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, 
"mvn:io.micrometer:micrometer-registry-prometheus")
-               return nil
        }
 
        container := e.GetIntegrationContainer()
diff --git a/pkg/util/camel/camel_runtime_test.go 
b/pkg/util/camel/camel_runtime_test.go
new file mode 100644
index 000000000..3e18a83bd
--- /dev/null
+++ b/pkg/util/camel/camel_runtime_test.go
@@ -0,0 +1,65 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package camel
+
+import (
+       "context"
+       "os"
+       "testing"
+       "time"
+
+       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
+       "github.com/apache/camel-k/v2/pkg/util/defaults"
+       "github.com/apache/camel-k/v2/pkg/util/test"
+       "github.com/stretchr/testify/assert"
+       metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+func TestCreateCatalog(t *testing.T) {
+       ip := v1.IntegrationPlatform{}
+       ip.Status.Build.Timeout = &metav1.Duration{
+               Duration: 5 * time.Minute,
+       }
+       c, err := test.NewFakeClient()
+       assert.Nil(t, err)
+       // use local Maven executable in tests
+       t.Setenv("MAVEN_WRAPPER", "false")
+       _, ok := os.LookupEnv("MAVEN_CMD")
+       if !ok {
+               t.Setenv("MAVEN_CMD", "mvn")
+       }
+       catalog, err := CreateCatalog(
+               context.TODO(),
+               c,
+               "",
+               &ip,
+               v1.RuntimeSpec{Provider: v1.RuntimeProviderQuarkus, Version: 
defaults.DefaultRuntimeVersion})
+       assert.Nil(t, err)
+       assert.NotNil(t, catalog)
+       assert.Equal(t, defaults.DefaultRuntimeVersion, catalog.Runtime.Version)
+       assert.Equal(t, v1.RuntimeProviderQuarkus, catalog.Runtime.Provider)
+       assert.NotEmpty(t, catalog.Runtime.Capabilities)
+
+       camelCatalog := v1.CamelCatalog{
+               Spec:   catalog.CamelCatalogSpec,
+               Status: catalog.CamelCatalogStatus,
+       }
+
+       rtCat := NewRuntimeCatalog(camelCatalog)
+       assert.NotNil(t, rtCat.Runtime.Capabilities["knative"])
+}

Reply via email to