mirror of
https://github.com/helm/chart-testing.git
synced 2026-02-05 09:45:14 +01:00
introduce helm-dependency-extra-args (#396)
addresses https://github.com/helm/chart-testing/issues/368 Signed-off-by: Krzysztof Nazarewski <3494992+nazarewk@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
aabb51e7dd
commit
3c014d8d38
@@ -95,6 +95,8 @@ func addCommonLintAndInstallFlags(flags *pflag.FlagSet) {
|
|||||||
specified on a per-repo basis with an equals sign as delimiter
|
specified on a per-repo basis with an equals sign as delimiter
|
||||||
(e.g. 'myrepo=--username test --password secret'). May be specified
|
(e.g. 'myrepo=--username test --password secret'). May be specified
|
||||||
multiple times or separate values with commas`))
|
multiple times or separate values with commas`))
|
||||||
|
flags.StringSlice("helm-dependency-extra-args", []string{}, heredoc.Doc(`
|
||||||
|
Additional arguments for 'helm dependency build' (e.g. ["--skip-refresh"]`))
|
||||||
flags.Bool("debug", false, heredoc.Doc(`
|
flags.Bool("debug", false, heredoc.Doc(`
|
||||||
Print CLI calls of external tools to stdout (caution: setting this may
|
Print CLI calls of external tools to stdout (caution: setting this may
|
||||||
expose sensitive data when helm-repo-extra-args contains passwords)`))
|
expose sensitive data when helm-repo-extra-args contains passwords)`))
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ in given chart directories.
|
|||||||
* [ct list-changed](ct_list-changed.md) - List changed charts
|
* [ct list-changed](ct_list-changed.md) - List changed charts
|
||||||
* [ct version](ct_version.md) - Print version information
|
* [ct version](ct_version.md) - Print version information
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 16-Mar-2022
|
###### Auto generated by spf13/cobra on 23-Mar-2022
|
||||||
|
|||||||
@@ -29,52 +29,53 @@ ct install [flags]
|
|||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
--all Process all charts except those explicitly excluded.
|
--all Process all charts except those explicitly excluded.
|
||||||
Disables changed charts detection and version increment checking
|
Disables changed charts detection and version increment checking
|
||||||
--build-id string An optional, arbitrary identifier that is added to the name of the namespace a
|
--build-id string 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
|
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
|
the ID of a pull request. If not specified, the name of the chart is used
|
||||||
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
|
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
|
||||||
or separate values with commas (default [charts])
|
or separate values with commas (default [charts])
|
||||||
--chart-repos strings Additional chart repositories for dependency resolutions.
|
--chart-repos strings Additional chart repositories for dependency resolutions.
|
||||||
Repositories should be formatted as 'name=url' (ex: local=http://127.0.0.1:8879/charts).
|
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
|
May be specified multiple times or separate values with commas
|
||||||
--charts strings Specific charts to test. Disables changed charts detection and
|
--charts strings Specific charts to test. Disables changed charts detection and
|
||||||
version increment checking. May be specified multiple times
|
version increment checking. May be specified multiple times
|
||||||
or separate values with commas
|
or separate values with commas
|
||||||
--config string Config file
|
--config string Config file
|
||||||
--debug Print CLI calls of external tools to stdout (caution: setting this may
|
--debug Print CLI calls of external tools to stdout (caution: setting this may
|
||||||
expose sensitive data when helm-repo-extra-args contains passwords)
|
expose sensitive data when helm-repo-extra-args contains passwords)
|
||||||
--exclude-deprecated Skip charts that are marked as deprecated
|
--exclude-deprecated Skip charts that are marked as deprecated
|
||||||
--excluded-charts strings Charts that should be skipped. May be specified multiple times
|
--excluded-charts strings Charts that should be skipped. May be specified multiple times
|
||||||
or separate values with commas
|
or separate values with commas
|
||||||
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
|
--helm-dependency-extra-args strings Additional arguments for 'helm dependency build' (e.g. ["--skip-refresh"]
|
||||||
(e.g. "--timeout 500s"
|
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
|
||||||
--helm-extra-set-args string Additional arguments for Helm. Must be passed as a single quoted string
|
(e.g. "--timeout 500s"
|
||||||
(e.g. "--set=name=value"
|
--helm-extra-set-args string Additional arguments for Helm. Must be passed as a single quoted string
|
||||||
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
|
(e.g. "--set=name=value"
|
||||||
specified on a per-repo basis with an equals sign as delimiter
|
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
|
||||||
(e.g. 'myrepo=--username test --password secret'). May be specified
|
specified on a per-repo basis with an equals sign as delimiter
|
||||||
multiple times or separate values with commas
|
(e.g. 'myrepo=--username test --password secret'). May be specified
|
||||||
-h, --help help for install
|
multiple times or separate values with commas
|
||||||
--namespace string Namespace to install the release(s) into. If not specified, each release will be
|
-h, --help help for install
|
||||||
installed in its own randomly generated namespace
|
--namespace string Namespace to install the release(s) into. If not specified, each release will be
|
||||||
--print-config Prints the configuration to stderr (caution: setting this may
|
installed in its own randomly generated namespace
|
||||||
expose sensitive data when helm-repo-extra-args contains passwords)
|
--print-config Prints the configuration to stderr (caution: setting this may
|
||||||
--release-label string The label to be used as a selector when inspecting resources created by charts.
|
expose sensitive data when helm-repo-extra-args contains passwords)
|
||||||
This is only used if namespace is specified (default "app.kubernetes.io/instance")
|
--release-label string The label to be used as a selector when inspecting resources created by charts.
|
||||||
--remote string The name of the Git remote used to identify changed charts (default "origin")
|
This is only used if namespace is specified (default "app.kubernetes.io/instance")
|
||||||
--since string The Git reference used to identify changed charts (default "HEAD")
|
--remote string The name of the Git remote used to identify changed charts (default "origin")
|
||||||
--skip-missing-values When --upgrade has been passed, this flag will skip testing CI values files from the
|
--since string The Git reference used to identify changed charts (default "HEAD")
|
||||||
previous chart revision if they have been deleted or renamed at the current chart
|
--skip-missing-values When --upgrade has been passed, this flag will skip testing CI values files from the
|
||||||
revision
|
previous chart revision if they have been deleted or renamed at the current chart
|
||||||
--target-branch string The name of the target branch used to identify changed charts (default "master")
|
revision
|
||||||
--upgrade Whether to test an in-place upgrade of each chart from its previous revision if the
|
--target-branch string The name of the target branch used to identify changed charts (default "master")
|
||||||
current version should not introduce a breaking change according to the SemVer spec
|
--upgrade 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
|
||||||
```
|
```
|
||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [ct](ct.md) - The Helm chart testing tool
|
* [ct](ct.md) - The Helm chart testing tool
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 16-Mar-2022
|
###### Auto generated by spf13/cobra on 23-Mar-2022
|
||||||
|
|||||||
@@ -13,67 +13,68 @@ ct lint-and-install [flags]
|
|||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
--additional-commands strings Additional commands to run per chart (default: [])
|
--additional-commands strings Additional commands to run per chart (default: [])
|
||||||
Commands will be executed in the same order as provided in the list and will
|
Commands will be executed in the same order as provided in the list and will
|
||||||
be rendered with go template before being executed.
|
be rendered with go template before being executed.
|
||||||
Example: "helm unittest --helm3 -f tests/*.yaml {{ .Path }}"
|
Example: "helm unittest --helm3 -f tests/*.yaml {{ .Path }}"
|
||||||
--all Process all charts except those explicitly excluded.
|
--all Process all charts except those explicitly excluded.
|
||||||
Disables changed charts detection and version increment checking
|
Disables changed charts detection and version increment checking
|
||||||
--build-id string An optional, arbitrary identifier that is added to the name of the namespace a
|
--build-id string 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
|
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
|
the ID of a pull request. If not specified, the name of the chart is used
|
||||||
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
|
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
|
||||||
or separate values with commas (default [charts])
|
or separate values with commas (default [charts])
|
||||||
--chart-repos strings Additional chart repositories for dependency resolutions.
|
--chart-repos strings Additional chart repositories for dependency resolutions.
|
||||||
Repositories should be formatted as 'name=url' (ex: local=http://127.0.0.1:8879/charts).
|
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
|
May be specified multiple times or separate values with commas
|
||||||
--chart-yaml-schema string The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
|
--chart-yaml-schema string The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
|
||||||
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
||||||
that order.
|
that order.
|
||||||
--charts strings Specific charts to test. Disables changed charts detection and
|
--charts strings Specific charts to test. Disables changed charts detection and
|
||||||
version increment checking. May be specified multiple times
|
version increment checking. May be specified multiple times
|
||||||
or separate values with commas
|
or separate values with commas
|
||||||
--check-version-increment Activates a check for chart version increments (default true)
|
--check-version-increment Activates a check for chart version increments (default true)
|
||||||
--config string Config file
|
--config string Config file
|
||||||
--debug Print CLI calls of external tools to stdout (caution: setting this may
|
--debug Print CLI calls of external tools to stdout (caution: setting this may
|
||||||
expose sensitive data when helm-repo-extra-args contains passwords)
|
expose sensitive data when helm-repo-extra-args contains passwords)
|
||||||
--exclude-deprecated Skip charts that are marked as deprecated
|
--exclude-deprecated Skip charts that are marked as deprecated
|
||||||
--excluded-charts strings Charts that should be skipped. May be specified multiple times
|
--excluded-charts strings Charts that should be skipped. May be specified multiple times
|
||||||
or separate values with commas
|
or separate values with commas
|
||||||
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
|
--helm-dependency-extra-args strings Additional arguments for 'helm dependency build' (e.g. ["--skip-refresh"]
|
||||||
(e.g. "--timeout 500s"
|
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
|
||||||
--helm-extra-set-args string Additional arguments for Helm. Must be passed as a single quoted string
|
(e.g. "--timeout 500s"
|
||||||
(e.g. "--set=name=value"
|
--helm-extra-set-args string Additional arguments for Helm. Must be passed as a single quoted string
|
||||||
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
|
(e.g. "--set=name=value"
|
||||||
specified on a per-repo basis with an equals sign as delimiter
|
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
|
||||||
(e.g. 'myrepo=--username test --password secret'). May be specified
|
specified on a per-repo basis with an equals sign as delimiter
|
||||||
multiple times or separate values with commas
|
(e.g. 'myrepo=--username test --password secret'). May be specified
|
||||||
-h, --help help for lint-and-install
|
multiple times or separate values with commas
|
||||||
--lint-conf string The config file for YAML linting. If not specified, 'lintconf.yaml'
|
-h, --help help for lint-and-install
|
||||||
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
--lint-conf string The config file for YAML linting. If not specified, 'lintconf.yaml'
|
||||||
that order
|
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
||||||
--namespace string Namespace to install the release(s) into. If not specified, each release will be
|
that order
|
||||||
installed in its own randomly generated namespace
|
--namespace string Namespace to install the release(s) into. If not specified, each release will be
|
||||||
--print-config Prints the configuration to stderr (caution: setting this may
|
installed in its own randomly generated namespace
|
||||||
expose sensitive data when helm-repo-extra-args contains passwords)
|
--print-config Prints the configuration to stderr (caution: setting this may
|
||||||
--release-label string The label to be used as a selector when inspecting resources created by charts.
|
expose sensitive data when helm-repo-extra-args contains passwords)
|
||||||
This is only used if namespace is specified (default "app.kubernetes.io/instance")
|
--release-label string The label to be used as a selector when inspecting resources created by charts.
|
||||||
--remote string The name of the Git remote used to identify changed charts (default "origin")
|
This is only used if namespace is specified (default "app.kubernetes.io/instance")
|
||||||
--since string The Git reference used to identify changed charts (default "HEAD")
|
--remote string The name of the Git remote used to identify changed charts (default "origin")
|
||||||
--skip-missing-values When --upgrade has been passed, this flag will skip testing CI values files from the
|
--since string The Git reference used to identify changed charts (default "HEAD")
|
||||||
previous chart revision if they have been deleted or renamed at the current chart
|
--skip-missing-values When --upgrade has been passed, this flag will skip testing CI values files from the
|
||||||
revision
|
previous chart revision if they have been deleted or renamed at the current chart
|
||||||
--target-branch string The name of the target branch used to identify changed charts (default "master")
|
revision
|
||||||
--upgrade Whether to test an in-place upgrade of each chart from its previous revision if the
|
--target-branch string The name of the target branch used to identify changed charts (default "master")
|
||||||
current version should not introduce a breaking change according to the SemVer spec
|
--upgrade Whether to test an in-place upgrade of each chart from its previous revision if the
|
||||||
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default true)
|
current version should not introduce a breaking change according to the SemVer spec
|
||||||
--validate-maintainers Enable validation of maintainer account names in chart.yml.
|
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default true)
|
||||||
Works for GitHub, GitLab, and Bitbucket (default true)
|
--validate-maintainers Enable validation of maintainer account names in chart.yml.
|
||||||
--validate-yaml Enable linting of 'Chart.yaml' and values files (default true)
|
Works for GitHub, GitLab, and Bitbucket (default true)
|
||||||
|
--validate-yaml Enable linting of 'Chart.yaml' and values files (default true)
|
||||||
```
|
```
|
||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [ct](ct.md) - The Helm chart testing tool
|
* [ct](ct.md) - The Helm chart testing tool
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 16-Mar-2022
|
###### Auto generated by spf13/cobra on 23-Mar-2022
|
||||||
|
|||||||
@@ -26,51 +26,52 @@ ct lint [flags]
|
|||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
--additional-commands strings Additional commands to run per chart (default: [])
|
--additional-commands strings Additional commands to run per chart (default: [])
|
||||||
Commands will be executed in the same order as provided in the list and will
|
Commands will be executed in the same order as provided in the list and will
|
||||||
be rendered with go template before being executed.
|
be rendered with go template before being executed.
|
||||||
Example: "helm unittest --helm3 -f tests/*.yaml {{ .Path }}"
|
Example: "helm unittest --helm3 -f tests/*.yaml {{ .Path }}"
|
||||||
--all Process all charts except those explicitly excluded.
|
--all Process all charts except those explicitly excluded.
|
||||||
Disables changed charts detection and version increment checking
|
Disables changed charts detection and version increment checking
|
||||||
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
|
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
|
||||||
or separate values with commas (default [charts])
|
or separate values with commas (default [charts])
|
||||||
--chart-repos strings Additional chart repositories for dependency resolutions.
|
--chart-repos strings Additional chart repositories for dependency resolutions.
|
||||||
Repositories should be formatted as 'name=url' (ex: local=http://127.0.0.1:8879/charts).
|
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
|
May be specified multiple times or separate values with commas
|
||||||
--chart-yaml-schema string The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
|
--chart-yaml-schema string The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
|
||||||
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
||||||
that order.
|
that order.
|
||||||
--charts strings Specific charts to test. Disables changed charts detection and
|
--charts strings Specific charts to test. Disables changed charts detection and
|
||||||
version increment checking. May be specified multiple times
|
version increment checking. May be specified multiple times
|
||||||
or separate values with commas
|
or separate values with commas
|
||||||
--check-version-increment Activates a check for chart version increments (default true)
|
--check-version-increment Activates a check for chart version increments (default true)
|
||||||
--config string Config file
|
--config string Config file
|
||||||
--debug Print CLI calls of external tools to stdout (caution: setting this may
|
--debug Print CLI calls of external tools to stdout (caution: setting this may
|
||||||
expose sensitive data when helm-repo-extra-args contains passwords)
|
expose sensitive data when helm-repo-extra-args contains passwords)
|
||||||
--exclude-deprecated Skip charts that are marked as deprecated
|
--exclude-deprecated Skip charts that are marked as deprecated
|
||||||
--excluded-charts strings Charts that should be skipped. May be specified multiple times
|
--excluded-charts strings Charts that should be skipped. May be specified multiple times
|
||||||
or separate values with commas
|
or separate values with commas
|
||||||
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
|
--helm-dependency-extra-args strings Additional arguments for 'helm dependency build' (e.g. ["--skip-refresh"]
|
||||||
specified on a per-repo basis with an equals sign as delimiter
|
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
|
||||||
(e.g. 'myrepo=--username test --password secret'). May be specified
|
specified on a per-repo basis with an equals sign as delimiter
|
||||||
multiple times or separate values with commas
|
(e.g. 'myrepo=--username test --password secret'). May be specified
|
||||||
-h, --help help for lint
|
multiple times or separate values with commas
|
||||||
--lint-conf string The config file for YAML linting. If not specified, 'lintconf.yaml'
|
-h, --help help for lint
|
||||||
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
--lint-conf string The config file for YAML linting. If not specified, 'lintconf.yaml'
|
||||||
that order
|
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
|
||||||
--print-config Prints the configuration to stderr (caution: setting this may
|
that order
|
||||||
expose sensitive data when helm-repo-extra-args contains passwords)
|
--print-config Prints the configuration to stderr (caution: setting this may
|
||||||
--remote string The name of the Git remote used to identify changed charts (default "origin")
|
expose sensitive data when helm-repo-extra-args contains passwords)
|
||||||
--since string The Git reference used to identify changed charts (default "HEAD")
|
--remote string The name of the Git remote used to identify changed charts (default "origin")
|
||||||
--target-branch string The name of the target branch used to identify changed charts (default "master")
|
--since string The Git reference used to identify changed charts (default "HEAD")
|
||||||
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default true)
|
--target-branch string The name of the target branch used to identify changed charts (default "master")
|
||||||
--validate-maintainers Enable validation of maintainer account names in chart.yml.
|
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default true)
|
||||||
Works for GitHub, GitLab, and Bitbucket (default true)
|
--validate-maintainers Enable validation of maintainer account names in chart.yml.
|
||||||
--validate-yaml Enable linting of 'Chart.yaml' and values files (default true)
|
Works for GitHub, GitLab, and Bitbucket (default true)
|
||||||
|
--validate-yaml Enable linting of 'Chart.yaml' and values files (default true)
|
||||||
```
|
```
|
||||||
|
|
||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
|
|
||||||
* [ct](ct.md) - The Helm chart testing tool
|
* [ct](ct.md) - The Helm chart testing tool
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 16-Mar-2022
|
###### Auto generated by spf13/cobra on 23-Mar-2022
|
||||||
|
|||||||
@@ -32,4 +32,4 @@ ct list-changed [flags]
|
|||||||
|
|
||||||
* [ct](ct.md) - The Helm chart testing tool
|
* [ct](ct.md) - The Helm chart testing tool
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 16-Mar-2022
|
###### Auto generated by spf13/cobra on 23-Mar-2022
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ ct version [flags]
|
|||||||
|
|
||||||
* [ct](ct.md) - The Helm chart testing tool
|
* [ct](ct.md) - The Helm chart testing tool
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 16-Mar-2022
|
###### Auto generated by spf13/cobra on 23-Mar-2022
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ type Git interface {
|
|||||||
//
|
//
|
||||||
// BuildDependencies builds the chart's dependencies
|
// BuildDependencies builds the chart's dependencies
|
||||||
//
|
//
|
||||||
|
// BuildDependenciesWithArgs allows passing additional arguments to BuildDependencies
|
||||||
|
//
|
||||||
// LintWithValues runs `helm lint` for the given chart using the specified values file.
|
// LintWithValues runs `helm lint` for the given chart using the specified values file.
|
||||||
// Pass a zero value for valuesFile in order to run lint without specifying a values file.
|
// Pass a zero value for valuesFile in order to run lint without specifying a values file.
|
||||||
//
|
//
|
||||||
@@ -82,6 +84,7 @@ type Git interface {
|
|||||||
type Helm interface {
|
type Helm interface {
|
||||||
AddRepo(name string, url string, extraArgs []string) error
|
AddRepo(name string, url string, extraArgs []string) error
|
||||||
BuildDependencies(chart string) error
|
BuildDependencies(chart string) error
|
||||||
|
BuildDependenciesWithArgs(chart string, extraArgs []string) error
|
||||||
LintWithValues(chart string, valuesFile string) error
|
LintWithValues(chart string, valuesFile string) error
|
||||||
InstallWithValues(chart string, valuesFile string, namespace string, release string) error
|
InstallWithValues(chart string, valuesFile string, namespace string, release string) error
|
||||||
Upgrade(chart string, namespace string, release string) error
|
Upgrade(chart string, namespace string, release string) error
|
||||||
@@ -367,7 +370,7 @@ func (t *Testing) processCharts(action func(chart *Chart) TestResult) ([]TestRes
|
|||||||
defer t.git.RemoveWorktree(worktreePath)
|
defer t.git.RemoveWorktree(worktreePath)
|
||||||
|
|
||||||
for _, chart := range charts {
|
for _, chart := range charts {
|
||||||
if err := t.helm.BuildDependencies(t.computePreviousRevisionPath(chart.Path())); err != nil {
|
if err := t.helm.BuildDependenciesWithArgs(t.computePreviousRevisionPath(chart.Path()), t.config.HelmDependencyExtraArgs); err != nil {
|
||||||
// Only print error (don't exit) if building dependencies for previous revision fails.
|
// Only print error (don't exit) if building dependencies for previous revision fails.
|
||||||
fmt.Println(errors.Wrapf(err, "Error building dependencies for previous revision of chart '%s'\n", chart))
|
fmt.Println(errors.Wrapf(err, "Error building dependencies for previous revision of chart '%s'\n", chart))
|
||||||
}
|
}
|
||||||
@@ -375,7 +378,7 @@ func (t *Testing) processCharts(action func(chart *Chart) TestResult) ([]TestRes
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, chart := range charts {
|
for _, chart := range charts {
|
||||||
if err := t.helm.BuildDependencies(chart.Path()); err != nil {
|
if err := t.helm.BuildDependenciesWithArgs(chart.Path(), t.config.HelmDependencyExtraArgs); err != nil {
|
||||||
return nil, errors.Wrapf(err, "Error building dependencies for chart '%s'", chart)
|
return nil, errors.Wrapf(err, "Error building dependencies for chart '%s'", chart)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,23 +93,29 @@ func (l *fakeLinter) Yamale(yamlFile, schemaFile string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakeHelm struct{}
|
type fakeHelm struct {
|
||||||
|
mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
func (h fakeHelm) AddRepo(name, url string, extraArgs []string) error { return nil }
|
func (h *fakeHelm) AddRepo(name, url string, extraArgs []string) error { return nil }
|
||||||
func (h fakeHelm) BuildDependencies(chart string) error { return nil }
|
func (h *fakeHelm) BuildDependencies(chart string) error { return nil }
|
||||||
func (h fakeHelm) LintWithValues(chart string, valuesFile string) error { return nil }
|
func (h *fakeHelm) BuildDependenciesWithArgs(chart string, extraArgs []string) error {
|
||||||
func (h fakeHelm) InstallWithValues(chart string, valuesFile string, namespace string, release string) error {
|
h.Called(chart, extraArgs)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (h fakeHelm) Upgrade(chart string, namespace string, release string) error {
|
func (h *fakeHelm) LintWithValues(chart string, valuesFile string) error { return nil }
|
||||||
|
func (h *fakeHelm) InstallWithValues(chart string, valuesFile string, namespace string, release string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (h fakeHelm) Test(namespace string, release string) error {
|
func (h *fakeHelm) Upgrade(chart string, namespace string, release string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (h fakeHelm) DeleteRelease(namespace string, release string) {}
|
func (h *fakeHelm) Test(namespace string, release string) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (h *fakeHelm) DeleteRelease(namespace string, release string) {}
|
||||||
|
|
||||||
func (h fakeHelm) Version() (string, error) {
|
func (h *fakeHelm) Version() (string, error) {
|
||||||
return "v3.0.0", nil
|
return "v3.0.0", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +148,7 @@ func newTestingMock(cfg config.Configuration) Testing {
|
|||||||
chartUtils: util.ChartUtils{},
|
chartUtils: util.ChartUtils{},
|
||||||
accountValidator: fakeAccountValidator{},
|
accountValidator: fakeAccountValidator{},
|
||||||
linter: fakeMockLinter,
|
linter: fakeMockLinter,
|
||||||
helm: fakeHelm{},
|
helm: new(fakeHelm),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +345,29 @@ func TestLintYamlValidation(t *testing.T) {
|
|||||||
runTests(false, 0, 0)
|
runTests(false, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLintDependencyExtraArgs(t *testing.T) {
|
||||||
|
chart := "testdata/test_lints"
|
||||||
|
args := []string{"--skip-refresh"}
|
||||||
|
|
||||||
|
fakeMockHelm := new(fakeHelm)
|
||||||
|
ct.helm = fakeMockHelm
|
||||||
|
ct.config.HelmDependencyExtraArgs = args
|
||||||
|
ct.config.Charts = []string{chart}
|
||||||
|
|
||||||
|
t.Run("lint-helm-dependency-extra-args", func(t *testing.T) {
|
||||||
|
call := fakeMockHelm.On("BuildDependenciesWithArgs", chart, args).Return(nil)
|
||||||
|
call.Repeatability = 1
|
||||||
|
|
||||||
|
results, err := ct.LintCharts()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
for _, result := range results {
|
||||||
|
assert.Nil(t, result.Error)
|
||||||
|
}
|
||||||
|
// -1 is set after Repeatability runs out
|
||||||
|
assert.Equal(t, -1, call.Repeatability)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestGenerateInstallConfig(t *testing.T) {
|
func TestGenerateInstallConfig(t *testing.T) {
|
||||||
type testData struct {
|
type testData struct {
|
||||||
name string
|
name string
|
||||||
|
|||||||
@@ -41,30 +41,31 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
Remote string `mapstructure:"remote"`
|
Remote string `mapstructure:"remote"`
|
||||||
TargetBranch string `mapstructure:"target-branch"`
|
TargetBranch string `mapstructure:"target-branch"`
|
||||||
Since string `mapstructure:"since"`
|
Since string `mapstructure:"since"`
|
||||||
BuildId string `mapstructure:"build-id"`
|
BuildId string `mapstructure:"build-id"`
|
||||||
LintConf string `mapstructure:"lint-conf"`
|
LintConf string `mapstructure:"lint-conf"`
|
||||||
ChartYamlSchema string `mapstructure:"chart-yaml-schema"`
|
ChartYamlSchema string `mapstructure:"chart-yaml-schema"`
|
||||||
ValidateMaintainers bool `mapstructure:"validate-maintainers"`
|
ValidateMaintainers bool `mapstructure:"validate-maintainers"`
|
||||||
ValidateChartSchema bool `mapstructure:"validate-chart-schema"`
|
ValidateChartSchema bool `mapstructure:"validate-chart-schema"`
|
||||||
ValidateYaml bool `mapstructure:"validate-yaml"`
|
ValidateYaml bool `mapstructure:"validate-yaml"`
|
||||||
AdditionalCommands []string `mapstructure:"additional-commands"`
|
AdditionalCommands []string `mapstructure:"additional-commands"`
|
||||||
CheckVersionIncrement bool `mapstructure:"check-version-increment"`
|
CheckVersionIncrement bool `mapstructure:"check-version-increment"`
|
||||||
ProcessAllCharts bool `mapstructure:"all"`
|
ProcessAllCharts bool `mapstructure:"all"`
|
||||||
Charts []string `mapstructure:"charts"`
|
Charts []string `mapstructure:"charts"`
|
||||||
ChartRepos []string `mapstructure:"chart-repos"`
|
ChartRepos []string `mapstructure:"chart-repos"`
|
||||||
ChartDirs []string `mapstructure:"chart-dirs"`
|
ChartDirs []string `mapstructure:"chart-dirs"`
|
||||||
ExcludedCharts []string `mapstructure:"excluded-charts"`
|
ExcludedCharts []string `mapstructure:"excluded-charts"`
|
||||||
HelmExtraArgs string `mapstructure:"helm-extra-args"`
|
HelmExtraArgs string `mapstructure:"helm-extra-args"`
|
||||||
HelmRepoExtraArgs []string `mapstructure:"helm-repo-extra-args"`
|
HelmRepoExtraArgs []string `mapstructure:"helm-repo-extra-args"`
|
||||||
Debug bool `mapstructure:"debug"`
|
HelmDependencyExtraArgs []string `mapstructure:"helm-dependency-extra-args"`
|
||||||
Upgrade bool `mapstructure:"upgrade"`
|
Debug bool `mapstructure:"debug"`
|
||||||
SkipMissingValues bool `mapstructure:"skip-missing-values"`
|
Upgrade bool `mapstructure:"upgrade"`
|
||||||
Namespace string `mapstructure:"namespace"`
|
SkipMissingValues bool `mapstructure:"skip-missing-values"`
|
||||||
ReleaseLabel string `mapstructure:"release-label"`
|
Namespace string `mapstructure:"namespace"`
|
||||||
ExcludeDeprecated bool `mapstructure:"exclude-deprecated"`
|
ReleaseLabel string `mapstructure:"release-label"`
|
||||||
|
ExcludeDeprecated bool `mapstructure:"exclude-deprecated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadConfiguration(cfgFile string, cmd *cobra.Command, printConfig bool) (*Configuration, error) {
|
func LoadConfiguration(cfgFile string, cmd *cobra.Command, printConfig bool) (*Configuration, error) {
|
||||||
|
|||||||
@@ -39,7 +39,11 @@ func (h Helm) AddRepo(name string, url string, extraArgs []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h Helm) BuildDependencies(chart string) error {
|
func (h Helm) BuildDependencies(chart string) error {
|
||||||
return h.exec.RunProcess("helm", "dependency", "build", chart)
|
return h.BuildDependenciesWithArgs(chart, []string{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h Helm) BuildDependenciesWithArgs(chart string, extraArgs []string) error {
|
||||||
|
return h.exec.RunProcess("helm", "dependency", "build", chart, extraArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h Helm) LintWithValues(chart string, valuesFile string) error {
|
func (h Helm) LintWithValues(chart string, valuesFile string) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user