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 e1d56fdf5 chore(trait): execute mount only when deploying
e1d56fdf5 is described below

commit e1d56fdf5a738e14dce35d39fd0a4990601fbe84
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Tue Oct 31 18:07:07 2023 +0100

    chore(trait): execute mount only when deploying
---
 pkg/trait/mount.go | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/pkg/trait/mount.go b/pkg/trait/mount.go
index ccb3b344b..35324a633 100644
--- a/pkg/trait/mount.go
+++ b/pkg/trait/mount.go
@@ -28,7 +28,6 @@ import (
 
        serving "knative.dev/serving/pkg/apis/serving/v1"
 
-       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/util/kubernetes"
        utilResource "github.com/apache/camel-k/v2/pkg/util/resource"
@@ -47,12 +46,7 @@ func newMountTrait() Trait {
 }
 
 func (t *mountTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
-       if e.Integration == nil {
-               return false, nil, nil
-       }
-
-       if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) ||
-               (!e.IntegrationInPhase(v1.IntegrationPhaseInitialization) && 
!e.IntegrationInRunningPhases()) {
+       if e.Integration == nil || !e.IntegrationInRunningPhases() {
                return false, nil, nil
        }
 
@@ -68,14 +62,11 @@ func (t *mountTrait) Configure(e *Environment) (bool, 
*TraitCondition, error) {
                }
        }
 
+       // mount trait needs always to be executed as it will process the 
sources
        return true, nil, nil
 }
 
 func (t *mountTrait) Apply(e *Environment) error {
-       if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
-               return nil
-       }
-
        container := e.GetIntegrationContainer()
        if container == nil {
                return fmt.Errorf("unable to find integration container: %s", 
e.Integration.Name)

Reply via email to