You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2025/11/05 14:49:48 UTC
(camel-k) branch main updated (5b51b04e6 -> 2704bfed8)
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
from 5b51b04e6 chore(ci): draft, while fixing
new 177b1c1ed cli(reset): add force flag, namespace confirmation prompt, update e2e tests
new 076cd61dd fix: remove BoolVarP and use decode for force flag
new 2704bfed8 cli(reset): Fix bind force flag correctly in e2e test
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
e2e/advanced/reset_test.go | 6 +++---
pkg/cmd/reset.go | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
(camel-k) 01/03: cli(reset): add force flag, namespace confirmation prompt, update e2e tests
Posted by pc...@apache.org.
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 177b1c1edaca74f3152027c8137a9898a7ee9f10
Author: pkalsi97 <pr...@gmail.com>
AuthorDate: Tue Nov 4 14:56:53 2025 +0530
cli(reset): add force flag, namespace confirmation prompt, update e2e tests
---
e2e/advanced/reset_test.go | 6 +++---
pkg/cmd/reset.go | 18 ++++++++++++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/e2e/advanced/reset_test.go b/e2e/advanced/reset_test.go
index c2976c570..bc6564760 100644
--- a/e2e/advanced/reset_test.go
+++ b/e2e/advanced/reset_test.go
@@ -46,7 +46,7 @@ func TestKamelReset(t *testing.T) {
g.Eventually(Kit(t, ctx, ns, IntegrationKit(t, ctx, ns, name)())).Should(Not(BeNil()))
g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, ctx, "reset", "-n", ns).Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "-f").Execute()).To(Succeed())
g.Expect(Integration(t, ctx, ns, name)()).To(BeNil())
g.Expect(Kits(t, ctx, ns)()).To(HaveLen(0))
})
@@ -59,7 +59,7 @@ func TestKamelReset(t *testing.T) {
g.Eventually(Kit(t, ctx, ns, IntegrationKit(t, ctx, ns, name)())).Should(Not(BeNil()))
g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-integrations").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-integrations", "-f").Execute()).To(Succeed())
g.Expect(Integration(t, ctx, ns, name)()).To(Not(BeNil()))
g.Expect(Kits(t, ctx, ns)()).To(HaveLen(0))
})
@@ -73,7 +73,7 @@ func TestKamelReset(t *testing.T) {
g.Eventually(Kit(t, ctx, ns, kitName)).Should(Not(BeNil()))
g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-kits").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-kits", "-f").Execute()).To(Succeed())
g.Expect(Integration(t, ctx, ns, name)()).To(BeNil())
g.Expect(Kit(t, ctx, ns, kitName)()).To(Not(BeNil()))
})
diff --git a/pkg/cmd/reset.go b/pkg/cmd/reset.go
index 251e711eb..a1cdb9aac 100644
--- a/pkg/cmd/reset.go
+++ b/pkg/cmd/reset.go
@@ -19,6 +19,7 @@ package cmd
import (
"fmt"
+ "os"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/client"
@@ -43,6 +44,7 @@ func newCmdReset(rootCmdOptions *RootCmdOptions) (*cobra.Command, *resetCmdOptio
cmd.Flags().Bool("skip-kits", false, "Do not delete the integration kits")
cmd.Flags().Bool("skip-integrations", false, "Do not delete the integrations")
cmd.Flags().Bool("skip-bindings", false, "Do not delete the bindings/pipes")
+ cmd.Flags().BoolVarP(&options.Force, "force", "f", false, "Force reset without confirmation")
return &cmd, &options
}
@@ -53,9 +55,25 @@ type resetCmdOptions struct {
SkipKits bool `mapstructure:"skip-kits"`
SkipIntegrations bool `mapstructure:"skip-integrations"`
SkipBindings bool `mapstructure:"skip-bindings"`
+ Force bool `mapstructure:"force"`
}
func (o *resetCmdOptions) reset(cmd *cobra.Command, _ []string) {
+ if !o.Force {
+ fmt.Printf("Reset will delete Camel K resources in namespace '%s'.\n", o.Namespace)
+ fmt.Fprint(cmd.OutOrStdout(), "Type the namespace to confirm: ")
+
+ var input string
+ if _, err := fmt.Fscan(os.Stdin, &input); err != nil {
+ fmt.Fprint(cmd.ErrOrStderr(), err)
+ return
+ }
+ if input != o.Namespace {
+ fmt.Fprintln(cmd.OutOrStdout(), "confirmation failed. aborting.")
+ return
+ }
+ }
+
c, err := o.GetCmdClient()
if err != nil {
fmt.Fprint(cmd.ErrOrStderr(), err)
(camel-k) 03/03: cli(reset): Fix bind force flag correctly in e2e test
Posted by pc...@apache.org.
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 2704bfed8ad06dfd25b15844a4db3eac18dca3cd
Author: pkalsi97 <pr...@gmail.com>
AuthorDate: Wed Nov 5 12:30:17 2025 +0530
cli(reset): Fix bind force flag correctly in e2e test
---
e2e/advanced/reset_test.go | 6 +++---
pkg/cmd/reset.go | 3 +--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/e2e/advanced/reset_test.go b/e2e/advanced/reset_test.go
index bc6564760..5d20474d3 100644
--- a/e2e/advanced/reset_test.go
+++ b/e2e/advanced/reset_test.go
@@ -46,7 +46,7 @@ func TestKamelReset(t *testing.T) {
g.Eventually(Kit(t, ctx, ns, IntegrationKit(t, ctx, ns, name)())).Should(Not(BeNil()))
g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, ctx, "reset", "-n", ns, "-f").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--force").Execute()).To(Succeed())
g.Expect(Integration(t, ctx, ns, name)()).To(BeNil())
g.Expect(Kits(t, ctx, ns)()).To(HaveLen(0))
})
@@ -59,7 +59,7 @@ func TestKamelReset(t *testing.T) {
g.Eventually(Kit(t, ctx, ns, IntegrationKit(t, ctx, ns, name)())).Should(Not(BeNil()))
g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-integrations", "-f").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-integrations", "--force").Execute()).To(Succeed())
g.Expect(Integration(t, ctx, ns, name)()).To(Not(BeNil()))
g.Expect(Kits(t, ctx, ns)()).To(HaveLen(0))
})
@@ -73,7 +73,7 @@ func TestKamelReset(t *testing.T) {
g.Eventually(Kit(t, ctx, ns, kitName)).Should(Not(BeNil()))
g.Eventually(Integration(t, ctx, ns, name)).Should(Not(BeNil()))
- g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-kits", "-f").Execute()).To(Succeed())
+ g.Expect(Kamel(t, ctx, "reset", "-n", ns, "--skip-kits", "--force").Execute()).To(Succeed())
g.Expect(Integration(t, ctx, ns, name)()).To(BeNil())
g.Expect(Kit(t, ctx, ns, kitName)()).To(Not(BeNil()))
})
diff --git a/pkg/cmd/reset.go b/pkg/cmd/reset.go
index 59c40a9c4..20cc9d8bf 100644
--- a/pkg/cmd/reset.go
+++ b/pkg/cmd/reset.go
@@ -19,7 +19,6 @@ package cmd
import (
"fmt"
- "os"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/client"
@@ -64,7 +63,7 @@ func (o *resetCmdOptions) reset(cmd *cobra.Command, _ []string) {
fmt.Fprint(cmd.OutOrStdout(), "Type the namespace to confirm: ")
var input string
- if _, err := fmt.Fscan(os.Stdin, &input); err != nil {
+ if _, err := fmt.Fscan(cmd.InOrStdin(), &input); err != nil {
fmt.Fprint(cmd.ErrOrStderr(), err)
return
}
(camel-k) 02/03: fix: remove BoolVarP and use decode for force flag
Posted by pc...@apache.org.
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 076cd61ddb1655ebf78408d80f68fa127df332d9
Author: pkalsi97 <pr...@gmail.com>
AuthorDate: Tue Nov 4 15:20:15 2025 +0530
fix: remove BoolVarP and use decode for force flag
---
pkg/cmd/reset.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/cmd/reset.go b/pkg/cmd/reset.go
index a1cdb9aac..59c40a9c4 100644
--- a/pkg/cmd/reset.go
+++ b/pkg/cmd/reset.go
@@ -44,7 +44,7 @@ func newCmdReset(rootCmdOptions *RootCmdOptions) (*cobra.Command, *resetCmdOptio
cmd.Flags().Bool("skip-kits", false, "Do not delete the integration kits")
cmd.Flags().Bool("skip-integrations", false, "Do not delete the integrations")
cmd.Flags().Bool("skip-bindings", false, "Do not delete the bindings/pipes")
- cmd.Flags().BoolVarP(&options.Force, "force", "f", false, "Force reset without confirmation")
+ cmd.Flags().Bool("force", false, "Force reset without confirmation")
return &cmd, &options
}