You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "christophd (via GitHub)" <gi...@apache.org> on 2024/01/19 20:50:39 UTC

[PR] fix(#4776): Fix catalog loading in camel trait [camel-k]

christophd opened a new pull request, #5086:
URL: https://github.com/apache/camel-k/pull/5086

   - When new runtime version is used on integration the camel trait creates the catalog if it does not exist already
   - Use proper catalog namespace to verify that the catalog resource has been created during the camel trait execution
   
   Fixes #4776 
   
   **Release Note**
   ```release-note
   NONE
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(#4776): Fix catalog loading in camel trait [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #5086:
URL: https://github.com/apache/camel-k/pull/5086#discussion_r1461778750


##########
pkg/trait/camel.go:
##########
@@ -61,7 +61,11 @@ func (t *camelTrait) InfluencesBuild(this, prev map[string]interface{}) bool {
 
 func (t *camelTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
 	if t.RuntimeVersion == "" {
-		t.RuntimeVersion = determineRuntimeVersion(e)
+		if runtimeVersion, err := determineRuntimeVersion(e); err != nil {
+			return false, nil, err
+		} else {

Review Comment:
   Ah, yes. This is because of the scope of the `if` condition.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(#4776): Fix catalog loading in camel trait [camel-k]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd merged PR #5086:
URL: https://github.com/apache/camel-k/pull/5086


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(#4776): Fix catalog loading in camel trait [camel-k]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on code in PR #5086:
URL: https://github.com/apache/camel-k/pull/5086#discussion_r1461724333


##########
pkg/trait/camel.go:
##########
@@ -276,5 +278,5 @@ func determineRuntimeVersion(e *Environment) string {
 	if e.Platform != nil && e.Platform.Status.Build.RuntimeVersion != "" {
 		return e.Platform.Status.Build.RuntimeVersion
 	}
-	return ""

Review Comment:
   `determineRuntimeVersion()` now returns an error for this case. I think it is more clear this way



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(#4776): Fix catalog loading in camel trait [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #5086:
URL: https://github.com/apache/camel-k/pull/5086#discussion_r1461509673


##########
pkg/trait/camel.go:
##########
@@ -276,5 +278,5 @@ func determineRuntimeVersion(e *Environment) string {
 	if e.Platform != nil && e.Platform.Status.Build.RuntimeVersion != "" {
 		return e.Platform.Status.Build.RuntimeVersion
 	}
-	return ""

Review Comment:
   I think this was on purpose. When there is no runtime set in any of the status, it means something wrong happened. I think we need to keep the empty value here to avoid unpredictable errors later. You can see the `Configure()` func checking it and returning an error when this situation arises. Probably a comment on top of the func would be good to avoid future misunderstanding.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(#4776): Fix catalog loading in camel trait [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #5086:
URL: https://github.com/apache/camel-k/pull/5086#discussion_r1461735899


##########
pkg/trait/camel.go:
##########
@@ -61,7 +61,11 @@ func (t *camelTrait) InfluencesBuild(this, prev map[string]interface{}) bool {
 
 func (t *camelTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
 	if t.RuntimeVersion == "" {
-		t.RuntimeVersion = determineRuntimeVersion(e)
+		if runtimeVersion, err := determineRuntimeVersion(e); err != nil {
+			return false, nil, err
+		} else {

Review Comment:
   nitpick: else branch is not required



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(#4776): Fix catalog loading in camel trait [camel-k]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on code in PR #5086:
URL: https://github.com/apache/camel-k/pull/5086#discussion_r1461763874


##########
pkg/trait/camel.go:
##########
@@ -61,7 +61,11 @@ func (t *camelTrait) InfluencesBuild(this, prev map[string]interface{}) bool {
 
 func (t *camelTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
 	if t.RuntimeVersion == "" {
-		t.RuntimeVersion = determineRuntimeVersion(e)
+		if runtimeVersion, err := determineRuntimeVersion(e); err != nil {
+			return false, nil, err
+		} else {

Review Comment:
   I think `runtimeVersion` is only accessible in within the if-else as it gets declared as part of the if statement



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org