`odo dev`: `hotReloadCapable` command part of composite `run` command not executed
/kind bug /area dev
What versions of software are you using?
Operating System: Fedora 36
Output of odo version:
odo v3.0.0-rc1 (995e0deed)
Server: https://10.10.10.105:6443
Kubernetes: v1.24.4
How did you run odo exactly?
- Starting with a Quarkus starter project, which is known to have a
hotReloadCapabledefault run command:
odo init --name my-quarkus-app --devfile java-quarkus --starter community
- Changing the default run command to a composite one that includes the previous command, with the following diff:
diff --git a/devfile.yaml b/devfile.yaml
index 2246005..9e0e1bc 100644
--- a/devfile.yaml
+++ b/devfile.yaml
@@ -9,11 +9,24 @@ commands:
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
component: tools
group:
- isDefault: true
+ isDefault: false
kind: run
hotReloadCapable: true
workingDir: ${PROJECT_SOURCE}
id: dev-run
+- exec:
+ commandLine: echo Running my first command
+ component: tools
+ workingDir: ${PROJECT_SOURCE}
+ id: echo
+- composite:
+ commands:
+ - echo
+ - dev-run
+ group:
+ isDefault: true
+ kind: run
+ id: my-run
- exec:
commandLine: mvn -Dmaven.repo.local=/home/user/.m2/repository quarkus:dev -Dquarkus.http.host=0.0.0.0
-Djava.util.logging.manager=org.jboss.logmanager.LogManager -Ddebug=${DEBUG_PORT}
- Now start
odo dev, and wait until the Dev session is up and running. We can see from the logs that thedev-runcommand was not executed:
❯ odo dev
__
/ \__ Developing using the my-quarkus-app Devfile
\__/ \ Namespace: default
/ \__/ odo version: v3.0.0-rc1
\__/
↪ Deploying to the cluster in developer mode
• Waiting for Kubernetes resources ...
✓ Added storage m2 to component
⚠ Pod is Pending
✓ Pod is Running
✓ Syncing files into the container [107ms]
✓ Executing init-compile command "mvn -Dmaven.repo.local=/home/user/.m2/repository compile" on container "tools" [1m]
• Executing the application (command: echo) ...
✓ Finished executing the application (command: echo) [213ms]
- Forwarding from 127.0.0.1:40001 -> 8080
- Users are unable to access the application:
❯ curl -i http://localhost:40001/hello
curl: (52) Empty reply from server
Actual behavior
The hotReloadCapable command is not run, preventing users from iterating on their application.
Expected behavior
All commands part of the composite run command should be executed once, regardless of their hotReloadCapable field.
I think that besides detecting that a command is hotReloadCapable, we should always check the corresponding process status in the container, and if it not running, execute the command remotely in the container.
The application is expected to be reachable:
❯ curl -i http://localhost:40001/hello
HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
content-length: 14
Hello RESTEasy
Any logs, error output, etc?
If I start odo dev with more verbosity, we can see this message:
I0916 12:03:42.803799 2027026 commandhandler.go:90] command is hot-reload capable, not restarting dev-run
Full logs attached: odo_dev_logs.txt
Workaround
A workaround is to change the hotReloadCapable field of the command to false in the Devfile prior to starting odo dev, then reset it back to true. The changes will be handled automatically by odo dev.
A friendly reminder that this issue had no activity for 90 days. Stale issues will be closed after an additional 30 days of inactivity.
Issue still relevant and still present in odo v3.14.0:
$ odo dev
__
/ \__ Developing using the "my-quarkus-app" Devfile
\__/ \ Namespace: default
/ \__/ odo version: v3.14.0
\__/
⚠ You are using "default" namespace, odo may not work as expected in the default namespace.
⚠ You may set a new namespace by running `odo create namespace <name>`, or set an existing one by running `odo set namespace <name>`
↪ Running on the cluster in Dev mode
✓ Web console accessible at http://localhost:20000/
✓ API Server started at http://localhost:20000/api/v1
✓ API documentation accessible at http://localhost:20000/swagger-ui/
• Waiting for Kubernetes resources ...
✓ Added storage m2 to component
⚠ Pod is Pending
✓ Pod is Running
✓ Syncing files into the container [117ms]
✓ Executing post-start command in container (command: init-compile) [2m]
• Executing the application (command: echo) ...
✓ Finished executing the application (command: echo) [145ms]
✗ Waiting for the application to be ready [1m]
⚠ Port forwarding might not work correctly: timeout while checking for ports; ports not listening: (8080 in container "tools"): context deadline exceeded
⚠ Running `odo logs --follow` might help in identifying the problem.
- Forwarding from 127.0.0.1:20001 -> 8080
↪ Dev mode
Status:
Watching for changes in the current directory /home/asoro/work/tmp/6129-odo-dev-hotreloadcapable-command-part-of-composite-run-command-not-executed
Web console accessible at http://localhost:20000/
Keyboard Commands:
[Ctrl+c] - Exit and delete resources from the cluster
[p] - Manually apply local changes to the application on the cluster
/remove-lifecycle stale
A friendly reminder that this issue had no activity for 90 days. Stale issues will be closed after an additional 30 days of inactivity.