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 run <devfile-command> when odo dev is running #6568

Closed
10 tasks done
Tracked by #6478
kadel opened this issue Feb 3, 2023 · 5 comments · Fixed by #6865
Closed
10 tasks done
Tracked by #6478

odo run <devfile-command> when odo dev is running #6568

kadel opened this issue Feb 3, 2023 · 5 comments · Fixed by #6865
Assignees
Labels
kind/user-story An issue of user-story kind priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint.
Milestone

Comments

@kadel
Copy link
Member

kadel commented Feb 3, 2023

/kind user-story

User Story

As an odo user, I want to be able to start commands defined in the devfile when I need to So that I can run actions defined in the devfile, like, for example, running commands that test things, or nondefault build commands that do some optional extra work.

This will allow users to follow the same workflow as in IDEs and DevSpaces where the command are usually executed only upon user request.

Acceptance Criteria

  • there should be a command (odo run for example) that takes one argument that is the command name and executes the command defined in devfile
  • odo run assumes that odo dev is running in a separate terminal, if odo dev is not running (resources not present on the cluster) odo run errors out and tells the user to run odo dev first.
  • if the command is exec command and the container where the program needs to be started is not running, the command should be executed as a Job; for podman this can be running inside a pod/container.
  • if the command is exec and the container is already running, it should be just executed inside the running container
  • if command is apply it just applies what it needs to :-) kubernetes/openshift components get created, container component gets turned into Deployment is dedicatedPod: true
  • if command is composite that it performs all action based on the above rules
  • odo run streams logs into the terminal and waits for the command to finish.
  • user can interrupt the command by pressing  control-c; cleanup the resources.
  • the exit code of odo run command reflect the exit code of the last devfile command executed. If the last command was apply and it was successful it returns 0, if failed returns 1
  • Because odo dev is running, if Kubernetes/OpenShift resources are created with Apply commands, they should be deployed in "Dev" mode (to be cleanup when odo dev terminates) - make it clear it will be cleaned up.

Links

This will enable the implementation of #6070

related to #6478 epic

/kind user-story
/priority medium

@openshift-ci openshift-ci bot added kind/user-story An issue of user-story kind priority/Medium Nice to have issue. Getting it done before priority changes would be great. labels Feb 3, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Feb 3, 2023
@kadel kadel added priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). and removed priority/Medium Nice to have issue. Getting it done before priority changes would be great. labels Mar 14, 2023
@rm3l
Copy link
Member

rm3l commented Mar 30, 2023

/triage needs-information
/assign @kadel

Add more details

@openshift-ci openshift-ci bot added the triage/needs-information Indicates an issue needs more information in order to work on it. label Mar 30, 2023
@kadel kadel changed the title odo run <devfile-command> odo run <devfile-command> when odo dev is running Apr 4, 2023
@kadel kadel removed their assignment Apr 4, 2023
@kadel kadel removed the triage/needs-information Indicates an issue needs more information in order to work on it. label Apr 4, 2023
@valaparthvi
Copy link
Contributor

valaparthvi commented Apr 6, 2023

[Grooming Call April 6, 2023]

  • Implement this with command-first approach.
  • odo run running a long running command should terminate if the odo dev pod restarts.
  • Refactor the command handlers to be more generic. Design a new architecture. [To be handled in a separate issue].
  • Implement odo run with the new architecture. Refactor the command handlers to be more generic. Design a new architecture. #6723
  • Interactive mode to be added at a later stage.
  • Once the new arch has been implemented, modify odo dev and odo deploy to use it, as a last stage.

@kadel to add about the long term vision of implementing this issue.

@valaparthvi
Copy link
Contributor

/status blocked
#6723

We will wait on this issue until we have an architecture ready.

@valaparthvi valaparthvi added the status/blocked Denotes an issue or PR that is blocked on something (e.g., issue/PR in different repo) label Apr 6, 2023
@feloy feloy added epic/6478-devspaces and removed needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. status/blocked Denotes an issue or PR that is blocked on something (e.g., issue/PR in different repo) labels May 24, 2023
@feloy feloy self-assigned this May 30, 2023
@feloy feloy added the sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint. label May 30, 2023
@rm3l rm3l added this to the v3.12.0 🚀 milestone May 30, 2023
@feloy
Copy link
Contributor

feloy commented Jun 5, 2023

It seems we will have to introduce flags similar to Docker exec' and kubectl exec's -i (stdin) and -t (--tty), to give the user the possibility to set the terminal in raw mode or not, depending on the expectations.

  • In raw mode, stdout and stderr are both mixed in stdout
  • In raw mode, Ctrl-c is passed inside stdin, and the distant process receives it and is interrupted
  • In raw mode, the execution fails if stdin is not a terminal (integration tests)

@feloy
Copy link
Contributor

feloy commented Jun 12, 2023

It seems we will have to introduce flags similar to Docker exec' and kubectl exec's -i (stdin) and -t (--tty), to give the user the possibility to set the terminal in raw mode or not, depending on the expectations.

  • In raw mode, stdout and stderr are both mixed in stdout
  • In raw mode, Ctrl-c is passed inside stdin, and the distant process receives it and is interrupted
  • In raw mode, the execution fails if stdin is not a terminal (integration tests)

I have implemented it to detect if stdin/out are a terminal. The raw mode will be set only if they are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/user-story An issue of user-story kind priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants