Skip to content

Commit 0cb17e5

Browse files
authored
feat(helm): Add support for OCI chart repositories (#445)
Signed-off-by: João Fernandes <[email protected]>
1 parent 10aaf46 commit 0cb17e5

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Notice that if no config file is specified, then `ct.yaml` (or any of the suppor
131131
#### Using private chart repositories
132132

133133
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.
134+
You can also specify OCI registries which will be added using the `helm registry login` command, they also support the `helm-repo-extra-args` for authentication.
134135
This could for example be used to authenticate a private chart repository.
135136

136137
`config.yaml`:
@@ -140,6 +141,7 @@ chart-repos:
140141
- incubator=https://incubator.io
141142
- basic-auth=https://private.com
142143
- ssl-repo=https://self-signed.ca
144+
- oci-registry=oci://nice-oci-registry.pt
143145
helm-repo-extra-args:
144146
- ssl-repo=--ca-file ./my-ca.crt
145147
```

pkg/tool/helm.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package tool
1616

1717
import (
1818
"fmt"
19+
"strings"
1920

2021
"github.com/helm/chart-testing/v3/pkg/exec"
2122
)
@@ -35,6 +36,13 @@ func NewHelm(exec exec.ProcessExecutor, extraArgs []string, extraSetArgs []strin
3536
}
3637

3738
func (h Helm) AddRepo(name string, url string, extraArgs []string) error {
39+
const ociPrefix string = "oci://"
40+
41+
if strings.HasPrefix(url, ociPrefix) {
42+
registryDomain := url[len(ociPrefix):]
43+
return h.exec.RunProcess("helm", "registry", "login", registryDomain, extraArgs)
44+
}
45+
3846
return h.exec.RunProcess("helm", "repo", "add", name, url, extraArgs)
3947
}
4048

0 commit comments

Comments
 (0)