-
Notifications
You must be signed in to change notification settings - Fork 44
Ability for Codewind CLI to run extra commands when creating project #270
Comments
As discussed with @tobespc. Please tag as appropriate. |
We would need |
Note that because of requirements coming up from #292, we likely need to define 2 ways to run
|
So currently hardcoding seems to be the way forward to get it done quickly for release. ExtensionEach extension has an identifier (currently ProjectsEach project would store an FunctionsEach function (such as bind, create, stop etc) is assigned a hard-coded How it worksDiscovery
Function extensionEvery function that has an This design has the plus point of keeping the commands in the Extension, thereby allowing new extensions to automatically be incorporated or supplanted without keeping a close eye on the contents of every individual project.inf. The major problem of implementing this at the moment is of course that everything is hardcoded for Appsody already, and the decision has already been made to jam the entire extension yaml into the project.inf. I would very much like to know why that decision was made - certainly I'm open to persuasion as to why that is the correct way of doing it! Are we also expecting these systems to operate in tandem with the current system or will we be supplanting it? Do we have an existing list of extension points that stakeholders require? |
Re jamming the extension yaml into At the very least that saves the IDE from making an extra API call to query the extension metadata |
That's a good use case - I was thinking that querying the extension might provide better service in terms of ease of updating extension versions (which might have extra command structures, so every existing project will need to have it's project.inf updated with the new commands). I wonder if that would be something the current API call could be altered to provide, rather than maintaining (hopefully) identical sets of data in two different files. Do you know where in the current process the extension.yaml is inserted into the project.inf? So for this work should we squarely focus on the use case in hand (calling |
Perhaps it is here: https://github.com/eclipse/codewind/blob/master/src/pfe/portal/routes/projects/binding.route.js#L107 I agree that rather than writing a copy of the extension metadata into I was thinking the call to |
I'm struggling to think of a way to include #292 in this - any ideas I have rely on knowledge of the project.inf file, and I don't think we want extension providers to necessarily know the inner workings of that in case it gets corrupted. |
Couldn't we just define 2 commands? For appsody for example, extension would define: commands:
- name: postProjectValidate
command: "appsody init"
- name: postVanillaProjectValidate (better name TBD)
command: "appsody init <stack> --no-template" I mentioned in #292 (comment) that we would need to pass the I'm not sure why the extension would need to know about That said, I discussed with @sghung and given the timeline we don't want to rush #292 in so I think hardcoding the call to |
We could do it like that for sure, but then it stops being generic because we're adding custom extension points solely for Appsody. We need a way to tell the two different types of Appsody project appart. Perhaps modify the I was thinking we'd store some kind of |
It's not really a custom extension point for Appsody. The upcoming ODO extension would make use of the They would define something like: commands:
- name: postVanillaProjectValidate
command: "odo create <component_type>` (they only support the second scenario) cc: @jingfuwang @ssh24 |
Similar to Appsody projects, a vanilla project can be binded as an ODO project in codewind. Once a vanilla project is binded it creates an odo config file. The command Andrew provided above will be similar to what we are designing it as well. |
For my understanding Also can you please define the
I think if we already had appsody cli and odo cli in the system's path, we can get the generic command from |
So lets just quickly go back over how the codewind extension mechanism is intended to work. Each extension can define a list of commands that can be run at certain steps in the development process. For example, you could define a'build' step and supply the command you wish to run. What would then happen is during each development process in codewind, we would look to see if any registered extensions were available for the project type that were registered against that step and then execute that command. For appsody init, We should be adding a 'postcreate' step to the extension that we would then call during creation. That is where we would want the 'appsody init' step to defined |
Updated some previous comments to change Running extension commands post-validate is fine; it should cover what needed for appsody and ODO. |
I just realize that appsody has the mount issue for running |
Andrew came up with a more generic way to run commands that has a scope beyond project creation. Closing for now as the work required for 0.4.0 is done |
Codewind version:
OS:
Che version:
IDE extension version:
IDE version:
Kubernetes cluster:
Description of the enhancement:
When the CLI is used to create a new project, it would be good if it can run extra commands on the project depending on the type.
A use case for this is for appsody support. For appsody projects, we need to run the
appsody init
command to setup the local development environment for the project (e.g. copying a parent pom into the maven cache).Proposed solution:
In the appsody extension's
codewind.yaml
, there's a commands array which is not currently used: https://github.com/eclipse/codewind-appsody-extension/blob/master/codewind.yaml#L5We could defined a type of command there that is meant to run at certain point in the project creation workflow (to keep things generic and flexible for other extensions)
For example, something like this:
So when Codewind CLI sees that, it runs the command after the project is validated.
Of course, this would require for the appsody CLI to be available on system's path. I will open a separate issue (#271) to track how we would ensure that.
Edit: used to be
postProjectBind
but just found out bind is not done by the CLIThe text was updated successfully, but these errors were encountered: