Skip to content

Commit

Permalink
add --extra-helm-args to ct lint (helm#552)
Browse files Browse the repository at this point in the history
Signed-off-by: AndersBennedsgaard <[email protected]>
  • Loading branch information
AndersBennedsgaard authored Jul 10, 2023
1 parent 585f1b3 commit 0d4ab80
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
3 changes: 0 additions & 3 deletions ct/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ func addInstallFlags(flags *flag.FlagSet) {
An optional, arbitrary identifier that is added to the name of the namespace a
chart is installed into. In a CI environment, this could be the build number or
the ID of a pull request. If not specified, the name of the chart is used`))
flags.String("helm-extra-args", "", heredoc.Doc(`
Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500s"`))
flags.Bool("upgrade", false, heredoc.Doc(`
Whether to test an in-place upgrade of each chart from its previous revision if the
current version should not introduce a breaking change according to the SemVer spec`))
Expand Down
28 changes: 14 additions & 14 deletions ct/cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,26 @@ func newLintCmd() *cobra.Command {

func addLintFlags(flags *flag.FlagSet) {
flags.String("lint-conf", "", heredoc.Doc(`
The config file for YAML linting. If not specified, 'lintconf.yaml'
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
that order`))
The config file for YAML linting. If not specified, 'lintconf.yaml'
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
that order`))
flags.String("chart-yaml-schema", "", heredoc.Doc(`
The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
that order.`))
The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
that order.`))
flags.Bool("validate-maintainers", true, heredoc.Doc(`
Enable validation of maintainer account names in chart.yml.
Works for GitHub, GitLab, and Bitbucket`))
Enable validation of maintainer account names in chart.yml.
Works for GitHub, GitLab, and Bitbucket`))
flags.Bool("check-version-increment", true, "Activates a check for chart version increments")
flags.Bool("validate-chart-schema", true, heredoc.Doc(`
Enable schema validation of 'Chart.yaml' using Yamale`))
Enable schema validation of 'Chart.yaml' using Yamale`))
flags.Bool("validate-yaml", true, heredoc.Doc(`
Enable linting of 'Chart.yaml' and values files`))
Enable linting of 'Chart.yaml' and values files`))
flags.StringSlice("additional-commands", []string{}, heredoc.Doc(`
Additional commands to run per chart (default: [])
Commands will be executed in the same order as provided in the list and will
be rendered with go template before being executed.
Example: "helm unittest --helm3 -f tests/*.yaml {{ .Path }}"`))
Additional commands to run per chart (default: [])
Commands will be executed in the same order as provided in the list and will
be rendered with go template before being executed.
Example: "helm unittest --helm3 -f tests/*.yaml {{ .Path }}"`))
}

func lint(cmd *cobra.Command, _ []string) error {
Expand Down
3 changes: 3 additions & 0 deletions ct/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ func addCommonLintAndInstallFlags(flags *pflag.FlagSet) {
Additional chart repositories for dependency resolutions.
Repositories should be formatted as 'name=url' (ex: local=http://127.0.0.1:8879/charts).
May be specified multiple times or separate values with commas`))
flags.String("helm-extra-args", "", heredoc.Doc(`
Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500s")`))
flags.StringSlice("helm-repo-extra-args", []string{}, heredoc.Doc(`
Additional arguments for the 'helm repo add' command to be
specified on a per-repo basis with an equals sign as delimiter
Expand Down
2 changes: 1 addition & 1 deletion doc/ct_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ct install [flags]
for command output
--helm-dependency-extra-args strings Additional arguments for 'helm dependency build' (e.g. ["--skip-refresh"]
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500s"
(e.g. "--timeout 500s")
--helm-extra-set-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--set=name=value"
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
Expand Down
2 changes: 1 addition & 1 deletion doc/ct_lint-and-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ct lint-and-install [flags]
for command output
--helm-dependency-extra-args strings Additional arguments for 'helm dependency build' (e.g. ["--skip-refresh"]
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500s"
(e.g. "--timeout 500s")
--helm-extra-set-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--set=name=value"
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
Expand Down
2 changes: 2 additions & 0 deletions doc/ct_lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ ct lint [flags]
--github-groups Change the delimiters for github to create collapsible groups
for command output
--helm-dependency-extra-args strings Additional arguments for 'helm dependency build' (e.g. ["--skip-refresh"]
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500s")
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
specified on a per-repo basis with an equals sign as delimiter
(e.g. 'myrepo=--username test --password secret'). May be specified
Expand Down
2 changes: 1 addition & 1 deletion pkg/tool/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (h Helm) LintWithValues(chart string, valuesFile string) error {
values = []string{"--values", valuesFile}
}

return h.exec.RunProcess("helm", "lint", chart, values)
return h.exec.RunProcess("helm", "lint", chart, values, h.extraArgs)
}

func (h Helm) InstallWithValues(chart string, valuesFile string, namespace string, release string) error {
Expand Down

0 comments on commit 0d4ab80

Please sign in to comment.