-
Notifications
You must be signed in to change notification settings - Fork 25
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
chore(CLI): cache CDK API data in disk #1529
Conversation
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.
Found a problem.
> bin/lacework component install component-example --version 0.8.1
...
> bin/lacework component show component-example
STATUS NAME VERSION DESCRIPTION
--------------------------+-------------------+---------+------------------------
Tainted (Please update) component-example 0.8.1 Component description
The following versions of this component are available to install:
- 0.8.0
- 0.8.1 (installed)
- 0.8.2
Fix for this is:
line 517 cli/cmd/component.go
: catalog, err := lwcomponent.NewCatalog(cli.LwApi, lwcomponent.NewStageTarGz, true)
. Pass true instead of false.
Get this error thrown when I delete the cdk_cache file.
Different error when I
|
With caching/persist API info, we shouldn't need to call the API if the cache file is present. Example line 316 in Seems like we are calling the API when the info is cached. |
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.
Nicely done!
lwcomponent/catalog.go
Outdated
cachedComponentsApiInfo map[string]ApiInfo, | ||
) (*Catalog, error) { | ||
if stageConstructor == nil { | ||
return nil, errors.New("nil Catalog StageConstructor") |
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.
This error is not helpful to the user 🤔 what should the user do in this case?¿
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.
Updated to "StageConstructor is not specified to create new catalog". Not exactly sure what else to say and why we inject stage constructor here. Will there be other types of stagers? cc @jon-stewart
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.
Summary
LoadCatalog
. It will try to load the components from the CLI cache. If not found, send a API request.How did you test this change?
Manually run all the
lacework component
commandsIssue
https://lacework.atlassian.net/browse/GROW-2481