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 support for providing credentials when adding chart-repositories #67

Merged
merged 7 commits into from
Jan 7, 2019
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ build-id: pr-42
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.


#### Using private chart repositories

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.

`config.yaml`:

```yaml
chart-repos:
- incubator=https://incubator.io
- basic-auth=https://private.com
- ssl-repo=https://self-signed.ca
helm-repo-extra-args:
- ssl-repo=--ca-file ./my-ca.crt
```

ct install --config config.yaml --helm-repo-extra-args "basic-auth=--username user --password secret"

## Building from Source

`ct` is built using Go 1.11. Older versions may work but have not been tested.
Expand Down
7 changes: 6 additions & 1 deletion app/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func addCommonLintAndInstallFlags(flags *pflag.FlagSet) {
flags.StringSlice("chart-repos", []string{}, heredoc.Doc(`
Additional chart repos to add so dependencies can be resolved. May be
specified multiple times or separate values with commas`))
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
(e.g. 'myrepo=--username test --password secret'). May be specified
multiple times or separate values with commas`))
flags.StringSlice("excluded-charts", []string{}, heredoc.Doc(`
Charts that should be skipped. May be specified multiple times
or separate values with commas`))
Expand All @@ -95,6 +100,6 @@ func bindFlags(options []string, flagSet *flag.FlagSet, v *viper.Viper) error {
}

func bindRootFlags(flagSet *flag.FlagSet, v *viper.Viper) error {
options := []string{"remote", "target-branch", "all", "charts", "chart-dirs", "chart-repos", "excluded-charts", "debug"}
options := []string{"remote", "target-branch", "all", "charts", "chart-dirs", "chart-repos", "helm-repo-extra-args", "excluded-charts", "debug"}
return bindFlags(options, flagSet, v)
}
2 changes: 1 addition & 1 deletion doc/ct.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ in given chart directories.
* [ct lint-and-install](ct_lint-and-install.md) - Lint, install, and test a chart
* [ct version](ct_version.md) - Print version information

###### Auto generated by spf13/cobra on 19-Dec-2018
###### Auto generated by spf13/cobra on 22-Dec-2018
58 changes: 31 additions & 27 deletions doc/ct_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,40 @@ ct install [flags]
### Options

```
--all Process all charts except those explicitly excluded.
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
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
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
or separate values with commas (default [charts])
--chart-repos strings Additional chart repos to add so dependencies can be resolved. May be
specified multiple times or separate values with commas
--charts strings Specific charts to test. Disables changed charts detection and
version increment checking. May be specified multiple times
or separate values with commas
--config string Config file
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
passed, this may reveal sensitive data)
--excluded-charts strings Charts that should be skipped. May be specified multiple times
or separate values with commas
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500 --tiller-namespace tiller"
-h, --help help for install
--namespace string Namespace to install the release(s) into. If not specified, each release will be
installed in its own randomly generated namespace.
--release-label string The label to be used as a selector when inspecting resources created by charts.
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
--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")
--all Process all charts except those explicitly excluded.
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
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
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
or separate values with commas (default [charts])
--chart-repos strings Additional chart repos to add so dependencies can be resolved. May be
specified multiple times or separate values with commas
--charts strings Specific charts to test. Disables changed charts detection and
version increment checking. May be specified multiple times
or separate values with commas
--config string Config file
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
passed, this may reveal sensitive data)
--excluded-charts strings Charts that should be skipped. May be specified multiple times
or separate values with commas
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500 --tiller-namespace tiller"
--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
multiple times or separate values with commas
-h, --help help for install
--namespace string Namespace to install the release(s) into. If not specified, each release will be
installed in its own randomly generated namespace.
--release-label string The label to be used as a selector when inspecting resources created by charts.
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
--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")
```

### SEE ALSO

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

###### Auto generated by spf13/cobra on 19-Dec-2018
###### Auto generated by spf13/cobra on 22-Dec-2018
80 changes: 42 additions & 38 deletions doc/ct_lint-and-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,51 @@ ct lint-and-install [flags]
### Options

```
--all Process all charts except those explicitly excluded.
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
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
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
or separate values with commas (default [charts])
--chart-repos strings Additional chart repos to add so dependencies can be resolved. 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'
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
that order.
--charts strings Specific charts to test. Disables changed charts detection and
version increment checking. May be specified multiple times
or separate values with commas
--check-version-increment Activates a check for chart version increments (default: true) (default true)
--config string Config file
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
passed, this may reveal sensitive data)
--excluded-charts strings Charts that should be skipped. May be specified multiple times
or separate values with commas
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500 --tiller-namespace tiller"
-h, --help help for lint-and-install
--lint-conf string 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
--namespace string Namespace to install the release(s) into. If not specified, each release will be
installed in its own randomly generated namespace.
--release-label string The label to be used as a selector when inspecting resources created by charts.
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
--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")
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default: true) (default true)
--validate-maintainers Enable validation of maintainer account names in chart.yml (default: true).
Works for GitHub, GitLab, and Bitbucket (default true)
--validate-yaml Enable linting of 'Chart.yaml' and values files (default: true) (default true)
--all Process all charts except those explicitly excluded.
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
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
--chart-dirs strings Directories containing Helm charts. May be specified multiple times
or separate values with commas (default [charts])
--chart-repos strings Additional chart repos to add so dependencies can be resolved. 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'
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
that order.
--charts strings Specific charts to test. Disables changed charts detection and
version increment checking. May be specified multiple times
or separate values with commas
--check-version-increment Activates a check for chart version increments (default: true) (default true)
--config string Config file
--debug Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
passed, this may reveal sensitive data)
--excluded-charts strings Charts that should be skipped. May be specified multiple times
or separate values with commas
--helm-extra-args string Additional arguments for Helm. Must be passed as a single quoted string
(e.g. "--timeout 500 --tiller-namespace tiller"
--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
multiple times or separate values with commas
-h, --help help for lint-and-install
--lint-conf string 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
--namespace string Namespace to install the release(s) into. If not specified, each release will be
installed in its own randomly generated namespace.
--release-label string The label to be used as a selector when inspecting resources created by charts.
This is only used if namespace is specified. (default "app.kubernetes.io/instance")
--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")
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default: true) (default true)
--validate-maintainers Enable validation of maintainer account names in chart.yml (default: true).
Works for GitHub, GitLab, and Bitbucket (default true)
--validate-yaml Enable linting of 'Chart.yaml' and values files (default: true) (default true)
```

### SEE ALSO

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

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