-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
new init prompt function and helper functions #5141
new init prompt function and helper functions #5141
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5141 +/- ##
==========================================
+ Coverage 72.14% 72.20% +0.05%
==========================================
Files 381 382 +1
Lines 13565 13589 +24
==========================================
+ Hits 9787 9812 +25
+ Misses 3061 3060 -1
Partials 717 717
Continue to review full report at Codecov.
|
} | ||
|
||
// ListDeployers returns a list of deployer names being used in the given deploy config. | ||
func ListDeployers(deploy *latest.DeployConfig) []string { |
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.
Looks good just thought this function might be useful since I used it for the same use case so I think it could help here too by using it as the underlying function. It just uses the yaml that deploy *latest.DeployConfig unmarshals to, to get the list of deployers.
meter.Deployers = yamltags.GetYamlTags(config.Deploy.DeployType) |
skaffold/pkg/skaffold/yamltags/tags.go
Lines 80 to 92 in 1f200b1
// GetYamlTags returns the tags of the non-nested fields of the given non-nil value | |
// If value interface{} is | |
// latest.DeployType{HelmDeploy: &HelmDeploy{...}, KustomizeDeploy: &KustomizeDeploy{...}} | |
// then this parses that interface as it's raw yaml: | |
// kubectl: | |
// manifests: | |
// - k8s/*.yaml | |
// kustomize: | |
// paths: | |
// - k8s/ | |
// and returns ["kubectl", "kustomize"] | |
// empty structs (e.g. latest.DeployType{}) when parsed look like "{}"" and so this function returns [] | |
func GetYamlTags(value interface{}) []string { |
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.
Also now realizing there's a tab right before kubectl
in the comment that shouldn't be there 😅
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.
thanks for sharing this, I think your function is probably what I should use here because it should be fine in the case of a new deployer being added to skaffold
Related: #4915
Description
This PR adds the functions that will be used to implement the transparent init feature.
The main is the ConfirmInitOptions() prompt function.
There are also some new util functions defined in pkg/skaffold/initializer/util
Follow-up Work
Use these functions to implement transparent init