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 #5297

Closed
Tracked by #5312
serenamarie125 opened this issue Dec 16, 2021 · 6 comments · Fixed by #5348
Closed
Tracked by #5312

odo init #5297

serenamarie125 opened this issue Dec 16, 2021 · 6 comments · Fixed by #5348
Assignees
Labels
estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation
Milestone

Comments

@serenamarie125
Copy link

serenamarie125 commented Dec 16, 2021

description by @kadel:

Which functionality do you think we should add?

Odo needs a new clean command with a nice interactive mode to help users bootstrap new project.

Example

$ odo init                                                                                                                       
TODO: Intro text (Include  goal as well as the steps that they are going to take ( including terminology ))                        
? Select language:  [Use arrows to move, type to filter]                                                                           
> dotnet                                                                                                                           
  go                                                                                                                               
  java                                                                                                                             
  javascript                                                                                                                       
  typescript                                                                                                                       
  php                                                                                                                              
  python  
? Select project type:  [Use arrows to move, type to filter]                                                                       
  .NET 5.0                                                                                                                         
> .NET 6.0                                                                                                                         
  .NET Core 3.1                                                                                                                    
  ** GO BACK ** (not implemented)      
? Which starter project do you want to use?  [Use arrows to move, type to filter]                                                   
> starter1                                                                                                                         
  starter2                            
? Enter component name: mydotnetapp  

⠏ Downloading "dotnet60". DONE                                                                                                     
⠏ Downloading starter project "starter1" ... DONE                                                                                  
Your new component "mydotnetapp" is ready in the current directory.                                                                
To start editing your component, use “odo dev” and open this folder in your favorite IDE.                                            
Changes will be directly reflected on the cluster.                                                                                 
To deploy your component to a cluster use “odo deploy”.   

Proof of concept was implemented in https://github.com/kadel/odo-v3-prototype/blob/main/cmd/init.go

User prompts

"Select language:"

Shows list of all values of metadata.language fields from all devfiles in the current active Devfile registry. (every language only once)

"Select project type:"

Select all possible values of metadata.projectType fields from all Devfiles that have selected language.
If there is a Devfile that doesn't have metadata.projectType it should display its metadata.name.

If there there is more than one devfile with the same projectType the list item should include the metadata.name and registry name. For example if there are the same devfiles in multiple registries

SpringBoot (java-springboot, registry: DefaultRegistry)
SpringBoot (java-springboot, registry: MyRegistry)

or if there is the same projectType in mulitple Devfiles

SpringBoot (java-maven-springboot, registry: MyRegistry)
SpringBoot (java-gradle-springboot, registry: MyRegistry)

"Which starter project do you want to use:"

At this point, the previous answers should be enough to uniquely select one Devfile from registry.
List of all starter projects defined in selected devfile.

"Enter component name:"

Name of the component.
This should be saved in the local devfile.yaml as a value for metadata.name field.

Flags

--name - name of the component (required)
--devfile - name of the devfile in devfile registry (required if --devfile-path is not defined)
--registry - name of the devfile registry (as configured in odo registry). It can be used in combination with --devfile, but not with --devfile-path (optional)
--starter - name of the starter project (optional)
--devfile-path - path to a devfile. This is alternative to using devfile from Devfile registry. It can be local filesystem path or http(s) URL (required if --devfile is not defined)

If no flag is specified it should enter interactive mode.
If even a single optional flag is specified then run in non-interactive mode and requires all required flags.

command behavior and error states

  • The result of running odo init command should be local devfile.yaml saved in the current directory, and starter project extracted in the current directory (if user picked one)
  • running odo init in non-empty directory exits with error
    The current directory is not empty. You can bootstrap new component only in empty directory.
    If you have existing code that you want to deploy use `odo deploy` or use `odo dev` command to quickly iterate on your component.
    
  • command should use registry as configured in odo registry command. If there is multiple registries configured it should use all of them.
@serenamarie125 serenamarie125 added this to the 3.0 (planning) milestone Dec 16, 2021
@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Dec 16, 2021
@kadel kadel mentioned this issue Jan 1, 2022
13 tasks
@dharmit
Copy link
Member

dharmit commented Jan 5, 2022

  • running odo init in non-empty directory exits with error
    The current directory is not empty. You can bootstrap new application only in empty directory.
    If you have existing code that you want to deploy use `odo deploy` or use `odo dev` command to quickly iterate on your application.
    

So are we settling upon renaming what's currently called as a "component" to an "application"? Under odo init on #5312, I see us calling it "project":

Used for bootstrapping completely new project (starting from empty directory)

I'm asking because I don't see it clearly stated anywhere.

@kadel
Copy link
Member

kadel commented Jan 10, 2022

So are we settling upon renaming what's currently called as a "component" to an "application"? Under odo init on #5312, I see us calling it "project":

I need to update it. We will still call it a "component" to avoid conflicts with "application" (group of components) or "project" (openshift's term for namespace).

I'll update it

@joshira-rh joshira-rh added the triage/needs-information Indicates an issue needs more information in order to work on it. label Jan 10, 2022
@kadel kadel changed the title odo init - Guided flow odo init Jan 11, 2022
@joshira-rh joshira-rh added the estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person label Jan 12, 2022
@kadel kadel removed the triage/needs-information Indicates an issue needs more information in order to work on it. label Jan 13, 2022
@feloy feloy mentioned this issue Jan 13, 2022
6 tasks
@feloy
Copy link
Contributor

feloy commented Jan 14, 2022

"Select language:"
Shows list of all values of metadata.language fields from all devfiles in the current active Devfile registry. (every language only once)

Is there such an "active Devfile registry"? I cannot see how to select an active registry with odo registry.
Or should odo get languages from all registries?

@kadel
Copy link
Member

kadel commented Jan 17, 2022

Is there such an "active Devfile registry"? I cannot see how to select an active registry with odo registry.
Or should odo get languages from all registries?

That was bad wording, sorry. It should get languages from all registries that are configured.
Note that odo v2 supports two types of registries, official devfile registry implementation based on OCI registry, and GitHub-based registries. In odo v3 we will support only the official OCI based one.

@feloy
Copy link
Contributor

feloy commented Jan 19, 2022

--devfile-registry - name of the devfile registry (as configured in odo registry). It can be used in combination with --devfile, but not with --devfile-path (optional)

What is the logic behind having the devfile registry optional when --devfile is used? I understand that it is not necessary when there is only one registry in the preferences, but should it be required when there is more than one registry saved? Or is there some order in the registry list so we can get the first one by default?

@kadel
Copy link
Member

kadel commented Jan 21, 2022

What is the logic behind having the devfile registry optional when --devfile is used? I understand that it is not necessary when there is only one registry in the preferences, but should it be required when there is more than one registry saved? Or is there some order in the registry list so we can get the first one by default?

If odo is configured with multiple registries it means that it should use all registries that are available. The order in which the registries are configured is significant. They are ordered by priority. If there are multiple registries in odo, it should simply pick the devfile from the first registry that has it. The --devfile-registry flag is there mainly for cases where users want to "force" a specific registry to make sure that it is used even if the registry with higher priority has it. I think that we already have similar behaviour in odo create in v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants