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 17129bcc0 chore(cmd): deprecate --dev/--sync
17129bcc0 is described below

commit 17129bcc0b31fbeb6d403bab6bba95f635e6a9ed
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Sat Nov 15 08:51:34 2025 +0100

    chore(cmd): deprecate --dev/--sync
    
    Local development should be done with Camel JBang instead.
    
    Closes #6364
---
 docs/modules/ROOT/pages/running/promoting.adoc   |   2 +-
 docs/modules/ROOT/pages/running/running-cli.adoc |  31 ------
 docs/modules/traits/pages/route.adoc             |  10 +-
 e2e/advanced/promote_test.go                     |   2 +-
 e2e/common/cli/dev_mode_test.go                  | 136 -----------------------
 e2e/common/config/config_test.go                 |   2 +-
 pkg/cmd/run.go                                   |  19 +++-
 7 files changed, 21 insertions(+), 181 deletions(-)

diff --git a/docs/modules/ROOT/pages/running/promoting.adoc 
b/docs/modules/ROOT/pages/running/promoting.adoc
index b4ec63f29..8747d947c 100644
--- a/docs/modules/ROOT/pages/running/promoting.adoc
+++ b/docs/modules/ROOT/pages/running/promoting.adoc
@@ -28,7 +28,7 @@ public class PromoteServer extends RouteBuilder {
 ```
 Let's run it:
 ```
-kamel run --dev -n development PromoteServer.java --config configmap:my-cm [-t 
service.node-port=true]
+kamel run -n development PromoteServer.java --config configmap:my-cm [-t 
service.node-port=true]
 ```
 Note that you may need to tweak the service trait, depending on the Kubernetes 
platform and the level of exposure you want to provide. As soon as it is 
finished, we can test it as well:
 ```
diff --git a/docs/modules/ROOT/pages/running/running-cli.adoc 
b/docs/modules/ROOT/pages/running/running-cli.adoc
index f2ead71ff..67c8d14d9 100644
--- a/docs/modules/ROOT/pages/running/running-cli.adoc
+++ b/docs/modules/ROOT/pages/running/running-cli.adoc
@@ -52,37 +52,6 @@ kamel logs hello
 
 NOTE: if the above example failed, have a look at 
xref:troubleshooting/troubleshooting.adoc[how to troubleshoot a Camel K 
Integration].
 
-[[dev-mode-integration]]
-== Running in dev mode
-
-Camel K provides a specific flag for quickly iterating on integrations during 
development and have fast feedbacks on the code you're writing. It's called 
*dev mode*. Differently from other frameworks, artifacts generated by Camel K 
in dev mode are no different from the one you run in production. Dev mode is 
just a helper to let you be quicker during development. To enable dev mode, 
just add the `--dev` flag when running the integration:
-
-```
-kamel run examples/languages/Sample.java --dev
-```
-
-The `--dev` flag deploys immediately the Integration and shows the Integration 
logs in the console. You can then change the code and see the **changes 
automatically applied (instantly)** to the remote Integration Pod. The console 
follows automatically all redeploys of the integration.
-
-Here's an example of the output:
-
-```
-$ kamel run examples/languages/Sample.java --dev
-integration "sample" created
-integration "sample" in phase Initialization
-integration "sample" in phase Building Kit
-integration "sample" in phase Deploying
-integration "sample" in phase Running
-...
-[1] 2019-12-16 11:33:43.918 INFO  [main] DefaultCamelContext - Apache Camel 
3.0.0 (CamelContext: camel-k) is starting
-[1] 2019-12-16 11:33:43.919 INFO  [main] DefaultManagementStrategy - JMX is 
disabled
-[1] 2019-12-16 11:33:44.099 INFO  [main] DefaultCamelContext - StreamCaching 
is not in use. If using streams then its recommended to enable stream caching. 
See more details at http://camel.apache.org/stream-caching.html
-[1] 2019-12-16 11:33:44.109 INFO  [main] DefaultCamelContext - Route: route1 
started and consuming from: timer://tick
-[1] 2019-12-16 11:33:44.116 INFO  [main] DefaultCamelContext - Total 1 routes, 
of which 1 are started
-[1] 2019-12-16 11:33:44.119 INFO  [main] DefaultCamelContext - Apache Camel 
3.0.0 (CamelContext: camel-k) started in 0.199 seconds
-[1] 2019-12-16 11:33:44.123 INFO  [main] ApplicationRuntime - Listener 
org.apache.camel.k.listener.RoutesDumper@2b6faea6 executed in phase Started
-[1] 2019-12-16 11:33:45.127 INFO  [Camel (camel-k) thread #1 - timer://tick] 
route1 - Hello Camel K!
-...
-```
 [[dry-run]]
 == Dry Run
 
diff --git a/docs/modules/traits/pages/route.adoc 
b/docs/modules/traits/pages/route.adoc
index 7cff47a7d..923d33788 100755
--- a/docs/modules/traits/pages/route.adoc
+++ b/docs/modules/traits/pages/route.adoc
@@ -143,22 +143,22 @@ curl -k https://platform-http-server-`oc config view 
--minify -o 'jsonpath={..na
 * To add an *edge* route using secrets, use the parameters ending in `-secret` 
to set the secret name which contains the certificate. This route example trait 
references a secret named `my-combined-certs` which contains two keys named 
`tls.key` and `tls.crt`.
 +
 [source,console]
-kamel run --dev PlatformHttpServer.java -t route.tls-termination=edge -t 
route.tls-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-key-secret=my-combined-certs/tls.key
+kamel run PlatformHttpServer.java -t route.tls-termination=edge -t 
route.tls-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-key-secret=my-combined-certs/tls.key
 
 * To add a *passthrough* route using secrets, the TLS is setup in the 
integration pod, the keys and certificates should be visible in the running 
integration pod, to achieve this we are using the `--resource` kamel parameter 
to mount the secret in the integration pod, then we use some camel quarkus 
parameters to reference these certificate files in the running pod, they start 
with `-p quarkus.http.ssl.certificate`. This route example trait references a 
secret named `my-combined-certs` wh [...]
 +
 [source,console]
-kamel run --dev PlatformHttpServer.java --resource 
secret:my-combined-certs@/etc/ssl/my-combined-certs -p 
quarkus.http.ssl.certificate.files=/etc/ssl/my-combined-certs/tls.crt -p 
quarkus.http.ssl.certificate.key-files=/etc/ssl/my-combined-certs/tls.key -t 
route.tls-termination=passthrough -t container.port=8443
+kamel run PlatformHttpServer.java --resource 
secret:my-combined-certs@/etc/ssl/my-combined-certs -p 
quarkus.http.ssl.certificate.files=/etc/ssl/my-combined-certs/tls.crt -p 
quarkus.http.ssl.certificate.key-files=/etc/ssl/my-combined-certs/tls.key -t 
route.tls-termination=passthrough -t container.port=8443
 
 * To add a *reencrypt* route using secrets, the TLS is setup in the 
integration pod, the keys and certificates should be visible in the running 
integration pod, to achieve this we are using the `--resource` kamel parameter 
to mount the secret in the integration pod, then we use some camel quarkus 
parameters to reference these certificate files in the running pod, they start 
with `-p quarkus.http.ssl.certificate`. This route example trait references a 
secret named `my-combined-certs` whic [...]
 +
 [source,console]
-kamel run --dev PlatformHttpServer.java --resource 
secret:my-combined-certs@/etc/ssl/my-combined-certs  -p 
quarkus.http.ssl.certificate.files=/etc/ssl/my-combined-certs/tls.crt -p 
quarkus.http.ssl.certificate.key-files=/etc/ssl/my-combined-certs/tls.key -t 
route.tls-termination=reencrypt -t 
route.tls-destination-ca-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
+kamel run PlatformHttpServer.java --resource 
secret:my-combined-certs@/etc/ssl/my-combined-certs  -p 
quarkus.http.ssl.certificate.files=/etc/ssl/my-combined-certs/tls.crt -p 
quarkus.http.ssl.certificate.key-files=/etc/ssl/my-combined-certs/tls.key -t 
route.tls-termination=reencrypt -t 
route.tls-destination-ca-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
 
 * To add a *reencrypt* route using a specific certificate from a secret for 
the route and 
https://docs.openshift.com/container-platform/4.8/security/certificates/service-serving-certificate.html#add-service-certificate_service-serving-certificate[OpenShift
 service serving certificates] for the integration endpoint. This way the 
OpenShift service serving certificates is set up only in the integration pod. 
The keys and certificates should be visible in the running integration pod, to 
achie [...]
 +
 [source,console]
-kamel run --dev PlatformHttpServer.java --resource 
secret:cert-from-openshift@/etc/ssl/cert-from-openshift  -p 
quarkus.http.ssl.certificate.files=/etc/ssl/cert-from-openshift/tls.crt -p 
quarkus.http.ssl.certificate.key-files=/etc/ssl/cert-from-openshift/tls.key -t 
route.tls-termination=reencrypt -t 
route.tls-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
+kamel run PlatformHttpServer.java --resource 
secret:cert-from-openshift@/etc/ssl/cert-from-openshift  -p 
quarkus.http.ssl.certificate.files=/etc/ssl/cert-from-openshift/tls.crt -p 
quarkus.http.ssl.certificate.key-files=/etc/ssl/cert-from-openshift/tls.key -t 
route.tls-termination=reencrypt -t 
route.tls-certificate-secret=my-combined-certs/tls.crt -t 
route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
 +
 Then you should annotate the integration service to inject the OpenShift 
service serving certificates
 +
@@ -168,4 +168,4 @@ oc annotate service platform-http-server 
service.beta.openshift.io/serving-cert-
 * To add an *edge* route using a certificate and a private key provided from 
your local filesystem. This example uses inline scripts to read the certificate 
and private key file contents, then remove all new line characters, (this is 
required to set the certificate as parameter's values), so the values are in a 
single line.
 +
 [source,console]
-kamel run PlatformHttpServer.java --dev -t route.tls-termination=edge -t 
route.tls-certificate="$(cat tls.crt|awk 'NF {sub(/\r/, ""); printf 
"%s\\n",$0;}')" -t route.tls-key="$(cat tls.key|awk 'NF {sub(/\r/, ""); printf 
"%s\\n",$0;}')"
+kamel run PlatformHttpServer.java -t route.tls-termination=edge -t 
route.tls-certificate="$(cat tls.crt|awk 'NF {sub(/\r/, ""); printf 
"%s\\n",$0;}')" -t route.tls-key="$(cat tls.key|awk 'NF {sub(/\r/, ""); printf 
"%s\\n",$0;}')"
diff --git a/e2e/advanced/promote_test.go b/e2e/advanced/promote_test.go
index ee405c9f6..5e5c060f5 100644
--- a/e2e/advanced/promote_test.go
+++ b/e2e/advanced/promote_test.go
@@ -59,7 +59,7 @@ func TestKamelCLIPromote(t *testing.T) {
                        kubectl create configmap my-cm-promote 
--from-literal=my-configmap-key="I am development configmap"
                        kubectl create secret generic my-sec-promote 
--from-literal=my-secret-key="very top secret development"
 
-                       kamel run --dev e2e/advanced/files/promote-route.yaml 
--config configmap:my-cm-promote --config secret:my-sec-promote
+                       kamel run e2e/advanced/files/promote-route.yaml 
--config configmap:my-cm-promote --config secret:my-sec-promote
                */
 
                t.Run("plain integration dev", func(t *testing.T) {
diff --git a/e2e/common/cli/dev_mode_test.go b/e2e/common/cli/dev_mode_test.go
deleted file mode 100644
index 30398b9b1..000000000
--- a/e2e/common/cli/dev_mode_test.go
+++ /dev/null
@@ -1,136 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> 
Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package common
-
-import (
-       "context"
-       "io"
-       "os"
-       "testing"
-       "time"
-
-       . "github.com/onsi/gomega"
-       corev1 "k8s.io/api/core/v1"
-
-       . "github.com/apache/camel-k/v2/e2e/support"
-       "github.com/apache/camel-k/v2/e2e/support/util"
-       "github.com/apache/camel-k/v2/pkg/platform"
-)
-
-func TestRunDevMode(t *testing.T) {
-       t.Parallel()
-       WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
-               t.Run("run yaml dev mode", func(t *testing.T) {
-                       ctx, cancel := context.WithCancel(ctx)
-                       defer cancel()
-                       piper, pipew := io.Pipe()
-                       defer pipew.Close()
-                       defer piper.Close()
-
-                       file := util.MakeTempCopy(t, "files/yaml.yaml")
-                       name := RandomizedSuffixName("yaml")
-
-                       kamelRun := KamelRunWithContext(t, ctx, 
platform.DefaultPlatformName, ns, file, "--name", name, "--dev")
-                       kamelRun.SetOut(pipew)
-
-                       logScanner := util.NewLogScanner(ctx, piper, 
`integration "`+name+`" in phase Running`, "Magicstring!", "Magicjordan!")
-
-                       args := os.Args
-                       defer func() { os.Args = args }()
-
-                       os.Args = []string{"kamel", "run", "-n", ns, 
"--operator-id", platform.DefaultPlatformName, file, "--name", name, "--dev"}
-                       go kamelRun.Execute()
-
-                       g.Eventually(logScanner.IsFound(`integration "`+name+`" 
in phase Running`), TestTimeoutMedium).Should(BeTrue())
-                       g.Eventually(logScanner.IsFound("Magicstring!"), 
TestTimeoutMedium).Should(BeTrue())
-                       
g.Expect(logScanner.IsFound("Magicjordan!")()).To(BeFalse())
-
-                       util.ReplaceInFile(t, file, "string!", "jordan!")
-                       g.Eventually(logScanner.IsFound("Magicjordan!"), 
TestTimeoutMedium).Should(BeTrue())
-               })
-
-               t.Run("run yaml remote dev mode", func(t *testing.T) {
-                       ctx, cancel := context.WithCancel(ctx)
-                       defer cancel()
-                       piper, pipew := io.Pipe()
-                       defer pipew.Close()
-                       defer piper.Close()
-
-                       remoteFile := 
"https://raw.githubusercontent.com/apache/camel-k/b29333f0a878d5d09fb3965be8fe586d77dd95d0/e2e/common/files/yaml.yaml";
-                       name := RandomizedSuffixName("yaml")
-                       kamelRun := KamelRunWithContext(t, ctx, 
platform.DefaultPlatformName, ns, remoteFile, "--name", name, "--dev")
-                       kamelRun.SetOut(pipew)
-
-                       logScanner := util.NewLogScanner(ctx, piper, 
"Magicstring!")
-
-                       args := os.Args
-                       defer func() { os.Args = args }()
-
-                       os.Args = []string{"kamel", "run", "-n", ns, 
"--operator-id", platform.DefaultPlatformName, remoteFile, "--name", name, 
"--dev"}
-
-                       go kamelRun.Execute()
-
-                       g.Eventually(logScanner.IsFound("Magicstring!"), 
TestTimeoutMedium).Should(BeTrue())
-               })
-
-               // This test makes sure that `kamel run --dev` runs in seconds 
after initial build is
-               // already done for the same integration.
-               t.Run("dev mode rebuild in seconds", func(t *testing.T) {
-                       name := RandomizedSuffixName("yaml")
-
-                       // First run (warm up)
-                       g.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml", 
"--name", name).Execute()).To(Succeed())
-                       g.Eventually(IntegrationPodPhase(t, ctx, ns, name), 
TestTimeoutShort).Should(Equal(corev1.PodRunning))
-                       g.Eventually(IntegrationLogs(t, ctx, ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-                       g.Expect(Kamel(t, ctx, "delete", name, "-n", 
ns).Execute()).To(Succeed())
-                       g.Eventually(Integration(t, ctx, ns, 
name)).Should(BeNil())
-                       g.Eventually(IntegrationPod(t, ctx, ns, name), 
TestTimeoutMedium).Should(BeNil())
-
-                       // Second run (rebuild)
-                       ctx, cancel := context.WithCancel(ctx)
-                       defer cancel()
-                       piper, pipew := io.Pipe()
-                       defer pipew.Close()
-                       defer piper.Close()
-
-                       file := util.MakeTempCopy(t, "files/yaml.yaml")
-
-                       kamelRun := KamelRunWithContext(t, ctx, 
platform.DefaultPlatformName, ns, file, "--name", name, "--dev")
-                       kamelRun.SetOut(pipew)
-
-                       logScanner := util.NewLogScanner(ctx, piper, 
`integration "`+name+`" in phase Running`, "Magicstring!")
-
-                       args := os.Args
-                       defer func() { os.Args = args }()
-
-                       os.Args = []string{"kamel", "run", "-n", ns, 
"--operator-id", platform.DefaultPlatformName, file, "--name", name, "--dev"}
-
-                       go kamelRun.Execute()
-
-                       // Second run should start up within a few seconds
-                       timeout := 20 * time.Second
-                       g.Eventually(logScanner.IsFound(`integration "`+name+`" 
in phase Running`), timeout).Should(BeTrue())
-                       g.Eventually(logScanner.IsFound("Magicstring!"), 
timeout).Should(BeTrue())
-               })
-       })
-}
diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go
index f8b1ed7bf..49a67351c 100644
--- a/e2e/common/config/config_test.go
+++ b/e2e/common/config/config_test.go
@@ -194,7 +194,7 @@ func TestRunConfigSecrets(t *testing.T) {
                })
 
                /*
-                       kamel run --dev --config 
secret:my-sec-multi/my-secret-key-2 
./e2e/common/config/files/config-secret-key-route.yaml
+                       kamel run --config secret:my-sec-multi/my-secret-key-2 
./e2e/common/config/files/config-secret-key-route.yaml
                */
 
                t.Run("Secret with filtered key", func(t *testing.T) {
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 12436e224..063725aa3 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -93,8 +93,8 @@ func newCmdRun(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *runCmdOptions)
                "key optionally represents the configmap/secret key to be 
filtered and path represents the destination path)")
        cmd.Flags().StringArray("maven-repository", nil, "Add a maven 
repository")
        cmd.Flags().Bool("logs", false, "Print integration logs")
-       cmd.Flags().Bool("sync", false, "Synchronize the local source file with 
the cluster, republishing at each change")
-       cmd.Flags().Bool("dev", false, "Enable Dev mode (equivalent to \"-w 
--logs --sync\")")
+       cmd.Flags().Bool("sync", false, "[Deprecated] Synchronize the local 
source file with the cluster, republishing at each change")
+       cmd.Flags().Bool("dev", false, "[Deprecated] Enable Dev mode 
(equivalent to \"-w --logs --sync\")")
        cmd.Flags().Bool("use-flows", true, "Write yaml sources as Flow objects 
in the integration custom resource")
        cmd.Flags().StringP("operator-id", "x", "camel-k", "Operator id 
selected to manage this integration.")
        cmd.Flags().String("profile", "", "Trait profile used for deployment")
@@ -128,10 +128,12 @@ type runCmdOptions struct {
        Compression bool `mapstructure:"compression" yaml:",omitempty"`
        Wait        bool `mapstructure:"wait" yaml:",omitempty"`
        Logs        bool `mapstructure:"logs" yaml:",omitempty"`
-       Sync        bool `mapstructure:"sync" yaml:",omitempty"`
-       Dev         bool `mapstructure:"dev" yaml:",omitempty"`
-       UseFlows    bool `mapstructure:"use-flows" yaml:",omitempty"`
-       Save        bool `mapstructure:"save" yaml:",omitempty" 
kamel:"omitsave"`
+       // Deprecated: won't be supported in the future
+       Sync bool `mapstructure:"sync" yaml:",omitempty"`
+       // Deprecated: won't be supported in the future
+       Dev      bool `mapstructure:"dev" yaml:",omitempty"`
+       UseFlows bool `mapstructure:"use-flows" yaml:",omitempty"`
+       Save     bool `mapstructure:"save" yaml:",omitempty" kamel:"omitsave"`
        // Deprecated: won't be supported in the future
        IntegrationKit     string `mapstructure:"kit" yaml:",omitempty"`
        IntegrationName    string `mapstructure:"name" yaml:",omitempty"`
@@ -300,6 +302,11 @@ func (o *runCmdOptions) validate(cmd *cobra.Command) error 
{
                fmt.Fprintf(cmd.OutOrStdout(), "Compression property is 
deprecated. It will be removed from future releases.\n")
        }
 
+       // Deprecated: to be removed
+       if o.Sync || o.Dev {
+               fmt.Fprintf(cmd.OutOrStdout(), "Dev and Sync properties are 
deprecated. They will be removed from future releases.\n")
+       }
+
        var client client.Client
        if !isOfflineCommand(cmd) {
                client, err = o.GetCmdClient()

Reply via email to