Skip to content
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

add --extra-helm-args to ct lint #552

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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