Skip to content

Commit 9084cf1

Browse files
Flydivernyunguiculus
authored andcommitted
Add support for providing credentials when adding chart-repositories (#67)
Signed-off-by: Markus Maga <[email protected]>
1 parent 7b167f8 commit 9084cf1

14 files changed

+154
-102
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,23 @@ build-id: pr-42
9595
Notice that if no config file is specified, then `ct.yaml` (or any of the supported formats) is loaded from the current directory, `$HOME/.ct`, or `/etc/ct`, in that order, if found.
9696

9797

98+
#### Using private chart repositories
99+
100+
When adding chart-repos you can specify additional arguments for the `helm repo add` command using `helm-repo-extra-args` on a per-repo basis. This could for example be used to authenticate a private chart repository.
101+
102+
`config.yaml`:
103+
104+
```yaml
105+
chart-repos:
106+
- incubator=https://incubator.io
107+
- basic-auth=https://private.com
108+
- ssl-repo=https://self-signed.ca
109+
helm-repo-extra-args:
110+
- ssl-repo=--ca-file ./my-ca.crt
111+
```
112+
113+
ct install --config config.yaml --helm-repo-extra-args "basic-auth=--username user --password secret"
114+
98115
## Building from Source
99116

100117
`ct` is built using Go 1.11. Older versions may work but have not been tested.

app/cmd/root.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ func addCommonLintAndInstallFlags(flags *pflag.FlagSet) {
7777
flags.StringSlice("chart-repos", []string{}, heredoc.Doc(`
7878
Additional chart repos to add so dependencies can be resolved. May be
7979
specified multiple times or separate values with commas`))
80+
flags.StringSlice("helm-repo-extra-args", []string{}, heredoc.Doc(`
81+
Additional arguments for the 'helm repo add' command to be
82+
specified on a per-repo basis with an equals sign as delimiter
83+
(e.g. 'myrepo=--username test --password secret'). May be specified
84+
multiple times or separate values with commas`))
8085
flags.StringSlice("excluded-charts", []string{}, heredoc.Doc(`
8186
Charts that should be skipped. May be specified multiple times
8287
or separate values with commas`))
@@ -95,6 +100,6 @@ func bindFlags(options []string, flagSet *flag.FlagSet, v *viper.Viper) error {
95100
}
96101

97102
func bindRootFlags(flagSet *flag.FlagSet, v *viper.Viper) error {
98-
options := []string{"remote", "target-branch", "all", "charts", "chart-dirs", "chart-repos", "excluded-charts", "debug"}
103+
options := []string{"remote", "target-branch", "all", "charts", "chart-dirs", "chart-repos", "helm-repo-extra-args", "excluded-charts", "debug"}
99104
return bindFlags(options, flagSet, v)
100105
}

doc/ct.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ in given chart directories.
2525
* [ct lint-and-install](ct_lint-and-install.md) - Lint, install, and test a chart
2626
* [ct version](ct_version.md) - Print version information
2727

28-
###### Auto generated by spf13/cobra on 19-Dec-2018
28+
###### Auto generated by spf13/cobra on 22-Dec-2018

doc/ct_install.md

+31-27
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,40 @@ ct install [flags]
2525
### Options
2626

2727
```
28-
--all Process all charts except those explicitly excluded.
29-
Disables changed charts detection and version increment checking
30-
--build-id string An optional, arbitrary identifier that is added to the name of the namespace a
31-
chart is installed into. In a CI environment, this could be the build number or
32-
the ID of a pull request. If not specified, the name of the chart is used
33-
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
34-
or separate values with commas (default [charts])
35-
--chart-repos strings Additional chart repos to add so dependencies can be resolved. May be
36-
specified multiple times or separate values with commas
37-
--charts strings Specific charts to test. Disables changed charts detection and
38-
version increment checking. May be specified multiple times
39-
or separate values with commas
40-
--config string Config file
41-
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
42-
passed, this may reveal sensitive data)
43-
--excluded-charts strings Charts that should be skipped. May be specified multiple times
44-
or separate values with commas
45-
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
46-
(e.g. "--timeout 500 --tiller-namespace tiller"
47-
-h, --help help for install
48-
--namespace string Namespace to install the release(s) into. If not specified, each release will be
49-
installed in its own randomly generated namespace.
50-
--release-label string The label to be used as a selector when inspecting resources created by charts.
51-
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
52-
--remote string The name of the Git remote used to identify changed charts (default "origin")
53-
--target-branch string The name of the target branch used to identify changed charts (default "master")
28+
--all Process all charts except those explicitly excluded.
29+
Disables changed charts detection and version increment checking
30+
--build-id string An optional, arbitrary identifier that is added to the name of the namespace a
31+
chart is installed into. In a CI environment, this could be the build number or
32+
the ID of a pull request. If not specified, the name of the chart is used
33+
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
34+
or separate values with commas (default [charts])
35+
--chart-repos strings Additional chart repos to add so dependencies can be resolved. May be
36+
specified multiple times or separate values with commas
37+
--charts strings Specific charts to test. Disables changed charts detection and
38+
version increment checking. May be specified multiple times
39+
or separate values with commas
40+
--config string Config file
41+
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
42+
passed, this may reveal sensitive data)
43+
--excluded-charts strings Charts that should be skipped. May be specified multiple times
44+
or separate values with commas
45+
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
46+
(e.g. "--timeout 500 --tiller-namespace tiller"
47+
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
48+
specified on a per-repo basis with an equals sign as delimiter
49+
(e.g. 'myrepo=--username test --password secret'). May be specified
50+
multiple times or separate values with commas
51+
-h, --help help for install
52+
--namespace string Namespace to install the release(s) into. If not specified, each release will be
53+
installed in its own randomly generated namespace.
54+
--release-label string The label to be used as a selector when inspecting resources created by charts.
55+
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
56+
--remote string The name of the Git remote used to identify changed charts (default "origin")
57+
--target-branch string The name of the target branch used to identify changed charts (default "master")
5458
```
5559

5660
### SEE ALSO
5761

5862
* [ct](ct.md) - The Helm chart testing tool
5963

60-
###### Auto generated by spf13/cobra on 19-Dec-2018
64+
###### Auto generated by spf13/cobra on 22-Dec-2018

doc/ct_lint-and-install.md

+42-38
Original file line numberDiff line numberDiff line change
@@ -13,47 +13,51 @@ ct lint-and-install [flags]
1313
### Options
1414

1515
```
16-
--all Process all charts except those explicitly excluded.
17-
Disables changed charts detection and version increment checking
18-
--build-id string An optional, arbitrary identifier that is added to the name of the namespace a
19-
chart is installed into. In a CI environment, this could be the build number or
20-
the ID of a pull request. If not specified, the name of the chart is used
21-
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
22-
or separate values with commas (default [charts])
23-
--chart-repos strings Additional chart repos to add so dependencies can be resolved. May be
24-
specified multiple times or separate values with commas
25-
--chart-yaml-schema string The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
26-
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
27-
that order.
28-
--charts strings Specific charts to test. Disables changed charts detection and
29-
version increment checking. May be specified multiple times
30-
or separate values with commas
31-
--check-version-increment Activates a check for chart version increments (default: true) (default true)
32-
--config string Config file
33-
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
34-
passed, this may reveal sensitive data)
35-
--excluded-charts strings Charts that should be skipped. May be specified multiple times
36-
or separate values with commas
37-
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
38-
(e.g. "--timeout 500 --tiller-namespace tiller"
39-
-h, --help help for lint-and-install
40-
--lint-conf string The config file for YAML linting. If not specified, 'lintconf.yaml'
41-
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
42-
that order
43-
--namespace string Namespace to install the release(s) into. If not specified, each release will be
44-
installed in its own randomly generated namespace.
45-
--release-label string The label to be used as a selector when inspecting resources created by charts.
46-
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
47-
--remote string The name of the Git remote used to identify changed charts (default "origin")
48-
--target-branch string The name of the target branch used to identify changed charts (default "master")
49-
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default: true) (default true)
50-
--validate-maintainers Enable validation of maintainer account names in chart.yml (default: true).
51-
Works for GitHub, GitLab, and Bitbucket (default true)
52-
--validate-yaml Enable linting of 'Chart.yaml' and values files (default: true) (default true)
16+
--all Process all charts except those explicitly excluded.
17+
Disables changed charts detection and version increment checking
18+
--build-id string An optional, arbitrary identifier that is added to the name of the namespace a
19+
chart is installed into. In a CI environment, this could be the build number or
20+
the ID of a pull request. If not specified, the name of the chart is used
21+
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
22+
or separate values with commas (default [charts])
23+
--chart-repos strings Additional chart repos to add so dependencies can be resolved. May be
24+
specified multiple times or separate values with commas
25+
--chart-yaml-schema string The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
26+
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
27+
that order.
28+
--charts strings Specific charts to test. Disables changed charts detection and
29+
version increment checking. May be specified multiple times
30+
or separate values with commas
31+
--check-version-increment Activates a check for chart version increments (default: true) (default true)
32+
--config string Config file
33+
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
34+
passed, this may reveal sensitive data)
35+
--excluded-charts strings Charts that should be skipped. May be specified multiple times
36+
or separate values with commas
37+
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
38+
(e.g. "--timeout 500 --tiller-namespace tiller"
39+
--helm-repo-extra-args strings Additional arguments for the 'helm repo add' command to be
40+
specified on a per-repo basis with an equals sign as delimiter
41+
(e.g. 'myrepo=--username test --password secret'). May be specified
42+
multiple times or separate values with commas
43+
-h, --help help for lint-and-install
44+
--lint-conf string The config file for YAML linting. If not specified, 'lintconf.yaml'
45+
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
46+
that order
47+
--namespace string Namespace to install the release(s) into. If not specified, each release will be
48+
installed in its own randomly generated namespace.
49+
--release-label string The label to be used as a selector when inspecting resources created by charts.
50+
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
51+
--remote string The name of the Git remote used to identify changed charts (default "origin")
52+
--target-branch string The name of the target branch used to identify changed charts (default "master")
53+
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default: true) (default true)
54+
--validate-maintainers Enable validation of maintainer account names in chart.yml (default: true).
55+
Works for GitHub, GitLab, and Bitbucket (default true)
56+
--validate-yaml Enable linting of 'Chart.yaml' and values files (default: true) (default true)
5357
```
5458

5559
### SEE ALSO
5660

5761
* [ct](ct.md) - The Helm chart testing tool
5862

59-
###### Auto generated by spf13/cobra on 19-Dec-2018
63+
###### Auto generated by spf13/cobra on 22-Dec-2018

0 commit comments

Comments
 (0)