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

Sending basePath to yamls renderer #981

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Sending basePath to yamls renderer #981

wants to merge 5 commits into from

Conversation

anih
Copy link

@anih anih commented Nov 18, 2019

Hi,

I would like to propose this change because we faced a problem when we have app X that depends on app Y and we wanted to put Y in X dependencies:

helmfiles:
  - path: git::https://github/anih/Y.git@helmfile/helmfile.yaml?ref=master

But in Y we have

helmfiles:
  - path: git::https://github/anih/generic-app.git@helmfile/helmfile.yaml?ref=master
    values:
      - extraValuesTemplates:
        - {{ requiredEnv "PWD" }}/values/values-file.yaml.gotmpl

unfortunately after removing {{ requiredEnv "PWD" }} i was getting error like

values file matching "/project/.helmfile/cache/https_gihub_generic-app_git.ref=master/generic-api/values/values-file.yaml.gotmpl" does not exist in "/project/.helmfile/cache/https_gihub_generic-app_git.ref=master/generic-api"

With this patch all is working correctly.

it will have path to current yaml so we are able to do:
```
- {{ basePath }}/values/env-api.yaml.gotmpl
```
This will allow us to send that absolute path to "basePath" variable when rendering yamls
@mumoshu
Copy link
Collaborator

mumoshu commented Dec 27, 2019

@anih Hey! I Thanks a lot for the PR.

I finally took some time to read this.

Just to confirm, is this change basically adds two things to helmfile?

  • A template function called basePath to obtain the absolute path to the directory of the helmfile.yaml being processed
  • Change the helmfile internal to use absolute pathes to locate files, so that the basePath becomes absolute one, where it was formerly relative

@anih
Copy link
Author

anih commented Dec 30, 2019

Hi,
Thank you for looking into it. Yes it's adding what you wrote. Probably rendering values from file it's done too late and path for values/values-file.yaml.gotmpl is taken from helmfile fro app X instead of Y app where this values file was added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants