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 init: Add new --run-port flag to set ports into initial Devfile #6925

Closed
5 tasks done
rm3l opened this issue Jun 22, 2023 · 2 comments · Fixed by #6953
Closed
5 tasks done

odo init: Add new --run-port flag to set ports into initial Devfile #6925

rm3l opened this issue Jun 22, 2023 · 2 comments · Fixed by #6953
Assignees
Labels
area/init Issues or PRs related to `odo init` 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

@rm3l
Copy link
Member

rm3l commented Jun 22, 2023

/kind user-story
/area init

User Story

As an odo user, I want to be able to set the ports when calling odo init non-interactively So that I can have my Devfile initialized right away with the right ports without having to edit it later on.

#5863 added the ability to automatically detect my application ports from the source code and use that as ports when initializing a Devfile interactively. Still, as a user, I also want to be able to specify such port(s) non-interactively.

This is mainly useful to support the port detection feature in the IDE extensions: redhat-developer/vscode-openshift-tools#2781. The IDE extensions workflow would be:

  1. Run odo analyze to detect things from the source code, like the Devfile, the component name, and application ports
  2. Pass this information to odo init to (non-interactively) initialize a Devfile with the ports set in the right container component

As discussed in #6211 (comment), there might be issues with Devfiles with more than one container component.

Acceptance Criteria

  • It should expose a repeatable --run-port int flag, which would look for any default run command (or the single non-default run command if any) and find the container component in which this run command runs.
  • It should error out if the run command is not an exec command
  • It should overwrite the container endpoints definition with the ones coming from this new flag
  • It should clearly document the limitations of this flag:
    • only supporting single exec run command

Examples:

$ odo init --run-port 8080 --run-port 8081

Links

/kind user-story

@rm3l rm3l added this to odo Project Jun 22, 2023
@rm3l rm3l converted this from a draft issue Jun 22, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Jun 22, 2023
@rm3l rm3l added the area/init Issues or PRs related to `odo init` label Jun 22, 2023
@rm3l rm3l added this to the v3.13.0 🚀 milestone Jun 22, 2023
@rm3l rm3l added priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). kind/user-story An issue of user-story kind and removed needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. labels Jun 22, 2023
@rm3l rm3l self-assigned this Jun 22, 2023
@rm3l
Copy link
Member Author

rm3l commented Jun 22, 2023

@rm3l Change the description

@rm3l
Copy link
Member Author

rm3l commented Jun 22, 2023

/unassign

Description updated and issue ready to be planned into the upcoming sprint.

@rm3l rm3l assigned rm3l and unassigned rm3l Jun 22, 2023
@rm3l rm3l added the sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint. label Jun 27, 2023
@rm3l rm3l moved this to In Progress 🚧 in odo Project Jul 4, 2023
rm3l added a commit to rm3l/odo that referenced this issue Jul 6, 2023
As depicted in [1], this leverages the default (or single non-default) run command to find the linked container component.
As such, it assumes that the command found is an exec command,
and that the linked component is a container component.

[1] redhat-developer#6925
@rm3l rm3l moved this from In Progress 🚧 to In Review 👀 in odo Project Jul 6, 2023
openshift-merge-robot pushed a commit that referenced this issue Jul 6, 2023
#6953)

* Add new `--run-port` flag to `odo init` to set ports non-interactively

As depicted in [1], this leverages the default (or single non-default) run command to find the linked container component.
As such, it assumes that the command found is an exec command,
and that the linked component is a container component.

[1] #6925

* Add unit and integration tests highlighting the expectations

* Document the new `--run-port` flag

* Fix some typos and language correctness issues in the `odo init` doc

* Add doc automation test for the output of `odo init --run-port`

This ensures the output and sample in the doc are kept in sync with the code base.
@github-project-automation github-project-automation bot moved this from In Review 👀 to Done ✅ in odo Project Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/init Issues or PRs related to `odo init` 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
1 participant