Closed tomassatka closed 2 years ago
@tomassatka Hey. Are you're on Windows? We don't have CI for Windows so not sure how it behaves there.
At glance, the problem seems like coming from the fact that you're using /
as the path separator whereas in Windows you should use \
Hi @mumoshu I found the rootcause of the issue. It is not related to OS. Providing git repo to showcase the issue: https://github.com/tomassatka/helmfile-2135
In repo is non-working and working dir where i applied ugly fix.
Would like to describe the nature of the problem.
In the project i defined root helmfile that uses bases pointing to environments.yaml and pointing to nested helmfile:
bases:
- "helmfile/bases/helmDefaults.yaml"
- "helmfile/bases/environments.yaml"
helmfiles:
- "helmfile/releases/services/helmfile.yaml"
missingFileHandler: Error
now the nested helmfile.yaml also uses bases:
---
bases:
- "../../bases/helmDefaults.yaml"
- "../../bases/environments.yaml"
Thats intentional that the environment is defined only in 1 file and all files refer to it. The problem is then when helmfile goes over rendering different helmfiles.. the path is relative to helmfile not to environments therefore the path for release.yaml is relative to 2 different helmfile in 2 different directories hence for one of them it wont be able to find the release and prints the error.
Now the ugly solution is to write environemnts section into each helmfile but that causes a duplication and potential issues. Do you have any other suggestion? :)
thx
@tomassatka Hey. Ah, that makes sense. Each helmfile and sub-helmfile evaluates relative paths based on the paths of helmfile.yaml files, whereas paths in a base file is evaluated based on the path of the helmfile loading it. I thought I made that design choice to make base.yaml useful for sharing the structure of the helmfile.yaml.
In your case, why do you need to define the whole environments
in the top-level helmfile.yaml? To me, the only thing you need in the top-level helmfile.yaml is a list of environments names without their values, and the helmfiles
section to call individual sub-helmfiles with their own environments sections.
Can't you make the root helmfile.yaml look like the below? So that the only thing you need to repeat is the names of environments. Every service helmfile.yaml can share the same base file that is specifically tailored for service helmfiles.
environments:
default:
dev:
int:
helmfiles:
- "helmfile/releases/services/helmfile.yaml"
hi @mumoshu Thanks for proposal. Yes that is an acceptable solution. I was not aware that the path is always relative to helmfile that is being executed. This gives me a thought if in future will be useful to have variable like maven has ${basedir}.
hi @mumoshu Thanks for proposal. Yes that is an acceptable solution. I was not aware that the path is always relative to helmfile that is being executed. This gives me a thought if in future will be useful to have variable like maven has ${basedir}.
helmfile version v0.144.0
When i refer values file
release.yaml
fromenvironments.yaml
file i get error that file could not be found:err: failed to read helmfile\bases\environments.yaml: environment values file matching "../../environments/ocp3/dev/release.yaml" does not exist in "."
No matter where i place the file, even if that is next to environments.yaml i get the same error.
My goal is to read the versions of all charts from external file that can be modified later by PRs.
i have following structure:
root helmfile.yaml:
helmfile in services dir:
environments.yaml:
content of release.yaml: