-
Notifications
You must be signed in to change notification settings - Fork 2
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
dkirillov/gh-26: Renderer and Executor determined by the shore config #73
base: main
Are you sure you want to change the base?
Conversation
loading of shore config happens in PersistentPreRun
Made use of ShoreConfigOpts
update the unit test
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.
Thank you very much for this last mile work 🙏
truly appreciated.
My questions/comments are mainly on styling and architectural design choices.
The UX was discussed multiple times and seems very solid.
Let's iterate on the comments and get this feature out!
pkg/command/dependencies.go
Outdated
// Select the Renderer | ||
switch strings.ToLower(shoreConfig.Renderer[`type`].(string)) { | ||
case JSONNET: | ||
d.Logger.Debug("Using the Jsonnet Renderer") | ||
chosenRenderer = jsonnet.NewRenderer(d.Project.FS, d.Project.Log) | ||
default: | ||
return fmt.Errorf("the following Renderer is undefined: %s", shoreConfig.Renderer[`type`].(string)) | ||
} | ||
d.Renderer = chosenRenderer |
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.
Please move this sections to it's own function.
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.
Done.
Looks a bit cleaner.
pkg/command/dependencies.go
Outdated
// Select the Backend | ||
switch strings.ToLower(shoreConfig.Executor[`type`].(string)) { | ||
case SPINNAKER: | ||
d.Logger.Debug("Using the Spinnaker Backend") | ||
chosenBackend = spinnaker.NewClient(d.Project.Log) | ||
default: | ||
return fmt.Errorf("the following Executor is undefined: %s", shoreConfig.Executor[`type`].(string)) | ||
} | ||
d.Backend = chosenBackend |
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.
Please move this section to it's own function (I.E. loadBackend
).
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.
Done.
ShoreConfig config.ShoreConfig | ||
ShoreConfigOpts config.ShoreConfigOpts |
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.
Aside from tests, where are these fields used?
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.
Currently, they're not being used anywhere.
The intent is to have them there early so when render/save/execute/test-remote commands start making use of the shore config the information will already be there.
For instance, when the render command is ran it will have the shore config loaded in the dependencies as well as the chosen profile - and so it will be able to use the correct config based on the profile (all of which it will have access to).
Overview
Github Issue: #26
Summary (required always)
This PR makes use of the new shore config, by loading it and using it to determine the type of renderer and executor to use.
(Functionality of
LoadShoreConfig
introduced in 7c38b57)Done on a project that has a shore config, it will load it and use the types defined for the renderer and executor.
When a project does not have a shore config, it will drop a default one.
Notes
Unit tests pass
To test, installed a local version from branch's source
shore help
requires no configuration and should always work, so it was tested.shore help
- outside a shore project - should workshore help
- inside a shore project - should workshore render
andshore save
were picked and tested becauserender
relies on the renderer type being set, andsave
relies on the renderer type and the executor type being set.shore render
- outside a shore project - shouldn't workshore render
- inside a shore project - should work - also drops a new shore configThis was the first time that this was ran in this shore project, so a shore config was created.
shore save
- outside a shore project - shouldn't workshore save
- inside a shore project - should work - also loads an existing shore configThis was ran after
shore render
, and so the shore config was already there and was loaded and used.shore render
- inside a shore project, bad renderer type - shouldn't workshore save
- inside a shore project, bad executor type - shouldn't workChecklist
<username>/<gh-issue-#number>:<short-description>