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
commit e78e4cf58e03f7ac7b6c4746bc87fcd7ec958d55 Author: Pranjul Kalsi <[email protected]> AuthorDate: Sun Dec 14 15:16:26 2025 +0530 fix(cmd): clarify deploy/undeploy support for Integrations and Pipes --- e2e/common/cli/deploy_test.go | 19 +++++++++++++++++++ pkg/cmd/deploy.go | 9 ++++----- pkg/cmd/deploy_test.go | 4 ++-- pkg/cmd/undeploy.go | 8 ++++---- pkg/cmd/undeploy_test.go | 2 +- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/e2e/common/cli/deploy_test.go b/e2e/common/cli/deploy_test.go index 4f7a907b5..3be66f585 100644 --- a/e2e/common/cli/deploy_test.go +++ b/e2e/common/cli/deploy_test.go @@ -87,5 +87,24 @@ func TestPipeBuildDontRun(t *testing.T) { g.Eventually(PipeCondition(t, ctx, ns, name, v1.PipeConditionReady), TestTimeoutShort).Should( WithTransform(PipeConditionReason, Equal("BuildComplete"))) }) + t.Run("deploy the pipe", func(t *testing.T) { + t.Skip("Skipping: deploy/undeploy pipe lifecycle needs further investigation") + g.Expect(Kamel(t, ctx, "deploy", name, "-n", ns).Execute()).To(Succeed()) + g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning)) + g.Eventually(PipePhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.PipePhaseReady)) + g.Eventually(Deployment(t, ctx, ns, name)).ShouldNot(BeNil()) + g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium). + Should(Equal(corev1.ConditionTrue)) + g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutMedium).Should(ContainSubstring("HelloPipe")) + }) + t.Run("undeploy the pipe", func(t *testing.T) { + t.Skip("Skipping: deploy/undeploy pipe lifecycle needs further investigation") + g.Expect(Kamel(t, ctx, "undeploy", name, "-n", ns).Execute()).To(Succeed()) + g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseBuildComplete)) + g.Eventually(PipePhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.PipePhaseBuildComplete)) + g.Eventually(IntegrationPodsNumbers(t, ctx, ns, name)).Should(Equal(ptr.To(int32(0)))) + g.Eventually(Deployment(t, ctx, ns, name)).Should(BeNil()) + }) }) } diff --git a/pkg/cmd/deploy.go b/pkg/cmd/deploy.go index f44e09b74..8249110cf 100644 --- a/pkg/cmd/deploy.go +++ b/pkg/cmd/deploy.go @@ -32,9 +32,8 @@ func newCmdDeploy(rootCmdOptions *RootCmdOptions) (*cobra.Command, *deployCmdOpt RootCmdOptions: rootCmdOptions, } cmd := cobra.Command{ - Use: "deploy my-it", - Short: "Deploy an Integration", - Long: "Deploy an Integration that was previously built", + Use: "deploy <name>", + Short: "Deploy an Integration or Pipe that was previously built with --dont-run-after-build flag", PreRunE: decode(&options, options.Flags), RunE: options.run, } @@ -48,7 +47,7 @@ type deployCmdOptions struct { func (o *deployCmdOptions) validate(_ *cobra.Command, args []string) error { if len(args) != 1 { - return errors.New("deploy requires an Integration name argument") + return errors.New("deploy requires an Integration or Pipe name argument") } return nil @@ -67,7 +66,7 @@ func (o *deployCmdOptions) run(cmd *cobra.Command, args []string) error { existing, err := getIntegration(o.Context, c, name, o.Namespace) if err != nil { - return fmt.Errorf("could not get Integration "+name+": %w", err) + return fmt.Errorf("could not get Integration or Pipe "+name+": %w", err) } if existing.Status.Phase != v1.IntegrationPhaseBuildComplete { return fmt.Errorf("could not run an Integration in %s status", existing.Status.Phase) diff --git a/pkg/cmd/deploy_test.go b/pkg/cmd/deploy_test.go index dfe4934df..066190c63 100644 --- a/pkg/cmd/deploy_test.go +++ b/pkg/cmd/deploy_test.go @@ -60,14 +60,14 @@ func TestDeployMissingInput(t *testing.T) { cmd, _ := initializeDeployCmdOptions(t) _, err := ExecuteCommand(cmd, cmdDeploy) require.Error(t, err) - assert.Equal(t, "deploy requires an Integration name argument", err.Error()) + assert.Equal(t, "deploy requires an Integration or Pipe name argument", err.Error()) } func TestDeployMissingIntegration(t *testing.T) { cmd, _ := initializeDeployCmdOptions(t) _, err := ExecuteCommand(cmd, cmdDeploy, "missing-it") require.Error(t, err) - assert.Equal(t, "could not get Integration missing-it: integrations.camel.apache.org \"missing-it\" not found", err.Error()) + assert.Equal(t, "could not get Integration or Pipe missing-it: integrations.camel.apache.org \"missing-it\" not found", err.Error()) } func TestDeployCantDeployRunningIntegration(t *testing.T) { diff --git a/pkg/cmd/undeploy.go b/pkg/cmd/undeploy.go index 92039df85..fcb7495da 100644 --- a/pkg/cmd/undeploy.go +++ b/pkg/cmd/undeploy.go @@ -33,9 +33,9 @@ func newCmdUndeploy(rootCmdOptions *RootCmdOptions) (*cobra.Command, *undeployCm RootCmdOptions: rootCmdOptions, } cmd := cobra.Command{ - Use: "undeploy [integration1] [integration2] ...", - Short: "Undeploy one or more integrations previously deployed.", - Long: `Clear the state of one or more integrations causing them to move back to a Build Complete status.`, + Use: "undeploy [name1] [name2] ...", + Short: "Undeploy one or more Integrations or Pipes previously deployed.", + Long: `Clear the state of one or more Integrations or Pipes causing them to move back to a Build Complete status.`, PreRunE: decode(&options, options.Flags), RunE: func(cmd *cobra.Command, args []string) error { if err := options.validate(args); err != nil { @@ -55,7 +55,7 @@ type undeployCmdOptions struct { func (o *undeployCmdOptions) validate(args []string) error { if len(args) == 0 { - return errors.New("undeploy requires an Integration name argument") + return errors.New("undeploy requires an Integration or Pipe name argument") } return nil diff --git a/pkg/cmd/undeploy_test.go b/pkg/cmd/undeploy_test.go index 2649fb8e7..380c6d851 100644 --- a/pkg/cmd/undeploy_test.go +++ b/pkg/cmd/undeploy_test.go @@ -60,7 +60,7 @@ func TestUndeployNoArgs(t *testing.T) { cmd, _ := initializeUndeployCmdOptions(t) _, err := ExecuteCommand(cmd, cmdUndeploy) require.Error(t, err) - assert.Equal(t, "undeploy requires an Integration name argument", err.Error()) + assert.Equal(t, "undeploy requires an Integration or Pipe name argument", err.Error()) } func TestUndeployMissingIntegrations(t *testing.T) {
