-
Notifications
You must be signed in to change notification settings - Fork 21
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
⭐️ inventory template support #3940
Conversation
6f2bc2a
to
109bf5b
Compare
@@ -214,16 +214,12 @@ func getCobraScanConfig(cmd *cobra.Command, runtime *providers.Runtime, cliRes * | |||
config.DisplayUsedConfig() | |||
|
|||
props := viper.GetStringMapString("props") | |||
annotations := viper.GetStringMapString("annotation") |
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.
the binding was wrong, so this never worked before
// for all assets | ||
_ = viper.BindPFlag("incognito", cmd.Flags().Lookup("incognito")) | ||
_ = viper.BindPFlag("insecure", cmd.Flags().Lookup("insecure")) | ||
_ = viper.BindPFlag("querypacks", cmd.Flags().Lookup("querypack")) | ||
_ = viper.BindPFlag("sudo.active", cmd.Flags().Lookup("sudo")) | ||
_ = viper.BindPFlag("record", cmd.Flags().Lookup("record")) | ||
// NOTE: we may "annotation" to "annotations" to align it with the internal config struct | ||
_ = viper.BindPFlag("annotations", cmd.Flags().Lookup("annotation")) |
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.
required since the options use "annotations"
109bf5b
to
2e5bf05
Compare
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.
LGTM!
Test Results2 985 tests +1 2 984 ✅ +1 1m 19s ⏱️ -5s Results for commit 2e5bf05. ± Comparison against base commit 3a2bb65. This pull request removes 3 and adds 4 tests. Note that renamed tests count towards both.
|
When cnquery is used in CI/CD pipelines, users want to leverage the inventory file which allows a lot of pre-configuration. If you want to scan different assets for different environments you also want to re-use the same template but allow some custom variables so that usage in CI/CD is easier. This PR introduces inventory templates. Just define a template and use the
getenv
function to access environment variables:This inventory can now be used as following: