Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odo dev: hotReloadCapable command part of composite run command not executed #6129

Open
rm3l opened this issue Sep 16, 2022 · 3 comments
Open
Labels
area/dev Issues or PRs related to `odo dev` area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/Medium Nice to have issue. Getting it done before priority changes would be great.

Comments

@rm3l
Copy link
Member

rm3l commented Sep 16, 2022

/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?

  1. Starting with a Quarkus starter project, which is known to have a hotReloadCapable default run command:
odo init --name my-quarkus-app --devfile java-quarkus --starter community
  1. 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}
  1. Now start odo dev, and wait until the Dev session is up and running. We can see from the logs that the dev-run command 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
  1. 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.

@openshift-ci openshift-ci bot added kind/bug Categorizes issue or PR as related to a bug. area/dev Issues or PRs related to `odo dev` labels Sep 16, 2022
@rm3l rm3l added this to odo v3.0.0 Sep 19, 2022
@rm3l rm3l added this to the v3.1.0 🚀 milestone Sep 30, 2022
@rm3l rm3l added this to odo Project Sep 30, 2022
@rm3l rm3l modified the milestones: v3.1.0 🚀, v3.2.0 🚀 Oct 12, 2022
@rm3l rm3l modified the milestones: v3.2.0 🚀, v3.3.0 🚀 Oct 26, 2022
@rm3l rm3l removed this from the v3.3.0 🚀 milestone Nov 18, 2022
@kadel kadel added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Feb 23, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

A friendly reminder that this issue had no activity for 90 days. Stale issues will be closed after an additional 30 days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 6, 2023
@rm3l
Copy link
Member Author

rm3l commented Sep 6, 2023

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

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 6, 2023
@rm3l rm3l added the area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. label Sep 6, 2023
Copy link
Contributor

github-actions bot commented Dec 6, 2023

A friendly reminder that this issue had no activity for 90 days. Stale issues will be closed after an additional 30 days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 6, 2023
@rm3l rm3l added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dev Issues or PRs related to `odo dev` area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/Medium Nice to have issue. Getting it done before priority changes would be great.
Projects
Status: No status
Status: No status
Development

No branches or pull requests

2 participants