This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit bfcf7d7bdae18ea35ba3963ef725567ebd185c12
Author: Antonin Stefanutti <anto...@stefanutti.fr>
AuthorDate: Mon Jan 25 13:56:29 2021 +0100

    chore(cli): Skip version compatibility check for install command
---
 pkg/cmd/install.go |  4 +++-
 pkg/cmd/root.go    | 10 +++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 3d89969..321082e 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -46,12 +46,14 @@ import (
        "github.com/apache/camel-k/pkg/util/watch"
 )
 
+const installCommand = "install"
+
 func newCmdInstall(rootCmdOptions *RootCmdOptions) (*cobra.Command, 
*installCmdOptions) {
        options := installCmdOptions{
                RootCmdOptions: rootCmdOptions,
        }
        cmd := cobra.Command{
-               Use:     "install",
+               Use:     installCommand,
                Short:   "Install Camel K on a Kubernetes cluster",
                Long:    `Install Camel K on a Kubernetes or OpenShift 
cluster.`,
                PreRunE: options.decode,
diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go
index 3328c60..0f10dc6 100644
--- a/pkg/cmd/root.go
+++ b/pkg/cmd/root.go
@@ -186,7 +186,15 @@ func (command *RootCmdOptions) preRun(cmd *cobra.Command, 
_ []string) error {
                                return err
                        }
                }
-               checkAndShowCompatibilityWarning(command.Context, c, 
command.Namespace)
+               // Check that the Kamel CLI matches that of the operator.
+               // The check relies on the version reported in the 
IntegrationPlatform status,
+               // which requires the operator is running and the 
IntegrationPlatform resource
+               // reconciled. Hence the compatibility check is skipped for the 
install command.
+               // Furthermore, there can be any incompatibilities, as the 
install command deploys
+               // the operator version it's compatible with.
+               if cmd.Use != installCommand {
+                       checkAndShowCompatibilityWarning(command.Context, c, 
command.Namespace)
+               }
        }
 
        return nil

Reply via email to