helm / helm/chart-testing-action
`release-name` flag doesn't work
- Dominant language
- Shell
- Stars
- 295
- Forks
- 91
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 4
Description
I'm using the latest version of this GitHub action (`v2.8.0`), and it seems like `--release-name` flag isn't respected by `ct install` command.
In my GitHub actions workflow, I use `ct install` together with the recently added `--release-name` flag, and I'm getting an error that is caused because the Helm release that `ct install` tries to install has a randomly generated name instead of the one that I've specified in `--release-name` flag.
This is a snippet of my workflow:
```yml
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.8.0
- name: Set up Kind cluster
uses: helm/kind-action@v1.13.0
- name: Create namespace
run: |
kubectl create ns go-backend --dry-run=client -o yaml | kubectl apply -f -
# Here some other steps that are irrelevant for this issue...
- name: Install and test `go-backend` chart
run: |
kubectl label namespace go-backend app.kubernetes.io/managed-by=Helm
kubectl annotate namespace go-backend meta.helm.sh/release-name=go-backend meta.helm.sh/release-namespace=go-backend
ct install --charts charts/apps/go-backend --namespace go-backend --release-name go-backend --debug || (kubectl logs -n go-backend helm-chart-go-backend-test && exit 1)
```
Those are the logs from GitHub Actions:
```sh
namespace/go-backend annotated
Installing charts...
Version increment checking disabled.
>>> helm version --template {{ .Version }}
------------------------------------------------------------------------------------------------------------------------
Charts to be processed:
------------------------------------------------------------------------------------------------------------------------
go-backend => (version: "1.0.0", path: "charts/apps/go-backend")
------------------------------------------------------------------------------------------------------------------------
>>> helm dependency build charts/apps/go-backend
Installing chart "go-backend => (version: \"1.0.0\", path: \"charts/apps/go-backend\")"...
Installing chart with values file "charts/apps/go-backend/ci/dev-values.yaml"...
>>> helm install go-backend-qaq0tvenm0 charts/apps/go-backend --namespace go-backend --wait --values charts/apps/go-backend/ci/dev-values.yaml
Error: INSTALLATION FAILED: Unable to continue with install: Namespace "go-backend" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "go-backend-qaq0tvenm0": current value is "go-backend"
...
```
I have a use case where I absolutely have to contain namespace definition in my Helm chart (in origin) for an actual deployment, and at the same time, I need to create it in this GitHub workflow before running `ct install`.
When the `ct install` (or actually `helm install`, which runs under the hood) tries to install my chart, it throws an error because this namespace doesn't have the required `meta.helm.sh/release-name` annotation set to `go-backend-qaq0tvenm0`. This would be expected if I don't specify the `--release-name` flag. Hoverever when I specify it, I expect `helm install` to use this name, but as we can see in the logs, it doesn't do that and instead tries to install a new Helm release with a randomly generated name.
I have a temporary workaround for that. Nevertheless, this issue should be addressed.
The workaround is to simply remove the namespace manifest file right before running `ct install` - this allows `helm install` to install the release and add an annotation with a randomly generated release name to take ownership of this namespace. Btw. I tried to remove the `meta.helm.sh/release-name` annotation from my namespace manifest, but it resulted in a different error:
```sh
"meta.helm.sh/release-name" must equal "go-backend-qaq0tvenm0": current value is ""
```
So in summary, it seems like adding `--release-name` flag to `ct install` is broken, and `helm install` still uses a randomly generated release name regardless of `--release-name`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.