-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: set up charmil core features in starter #158
Conversation
Mentioning just to avoid any confusion: This PR is ready for review now :) CC @aerogear/charmil-core |
That will be problem for user who want to use starter. We need separate go.mod as starter should use released version of the core etc.
Those are valid points but my take is that this is tradeoff for now |
Plugins can use upsteam cobra markdown docs. |
Those are version and docs feature flags. We can kill it. Cobra has its own version command that we can extend (there is issue for it) but my take is to kill that with fire
Seems like good thing to do now
going to be tackled in @ankithans scafollding issue/PR #67
Lets remove generate docs.completely. |
@jackdelahunt @ankithans to go with specific review and verification |
## root completion | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have completion package in starter or in core till now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if you run the starter CLI you'll notice a command for the same over there.
BTW these docs were autogenerated by Cobra :)
@namit-chandwani how can I run starter CLI? $ go run ./starter/cmd/starter/
2021/07/14 11:06:21 open ./config.json: The system cannot find the file specified.
exit status 1 giving me this, after adding config file as well |
Move into the $ make binary $ ./starter No need to add a |
okay this works, but only first time it works. $ ./starter
2021/07/14 11:24:35 json: cannot unmarshal object into Go struct field Config.LocConfig.Files of type fs.FS |
Yes, you're right. Working on this right now |
TODO:
|
@wtrocki If our ultimate aim is to move the starter to a separate repo, isn't now the best time to do that? I remember that you had asked us about the same before merging that starter PR (Link: #145 (comment)), but I didn't comment as I wasn't aware of the drawbacks of a multi-module repo back then. To do so, we can follow these steps:
I feel that it'll be better if we do this now itself, to avoid the extra amount of maintenance that will be required if we keep starter in the same repo temporarily. WDYT? Edit: Even Kubernetes maintains the starter for kubectl plugins in a separate repo: https://github.com/kubernetes/sample-cli-plugin. CC @aerogear/charmil-core |
@wtrocki Really sorry for following up. Can you please have a look at the comment just above this one, whenever you're free? :) I believe you must have missed it due to many notifications at once. TIA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mainly this PR - adds test to config package and integrate it with starter + refactor some parts of starter
I've converted the This PR can be merged now :) |
Changes made
factory
to include config handler and update all examples according to it (Similar to changes made in PR: refactor: include config handler in factory #153).starter
from a sub-module to a package (by removinggo.mod
andgo.sum
files from thestarter
directory)core
instead of Rhoas SDKReasons why I converted
starter
from a sub-module to a packageReplace directives will be required in a multi-module repository to allow adjacent modules to import each other's code without first publishing and remotely fetching it, which might be difficult to maintain.
We lose the convenience of being able to run all of the unit tests in the repo for continuous integration. With a single module repository architecture, we can test all services/packages with a single
go test ./…
command, whereas we will require some sort of infrastructure to do the same in a multi-module repository (such as a script to run tests from each directory).Cobra uses a single-module repository to achieve something similar to our use case. Link: https://github.com/spf13/cobra/tree/master/cobra
I believe that our use case does not demand the use of multiple modules, and hence a single module repo with the least amount of maintenance would be a better option for us.
References: https://github.com/golang/go/wiki/Modules#should-i-have-multiple-modules-in-a-single-repository
Possible Future Changes
Didn't make the following changes as a part of this PR, as some of these might require some discussions with the team before proceeding.
After this PR gets merged, the only import that our starter CLI will be using from RHAOS would be that for generating command docs (
github.com/redhat-developer/app-services-cli/pkg/doc
). Maybe we can add a package with similar functionality to our core.Migrate packages like
build
andversion
to Charmil CoreModify the
load
method of config core to create an empty local config file, if it's not present already.Remove unwanted packages like
starter/pkg/cmd/starter
(debatable).Include the
GENERATE_DOCS
value inside the starter CLI config struct itself