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

Kapitan fails to render Jinja template with input_params #906

Closed
ademariag opened this issue Dec 7, 2022 · 0 comments · Fixed by #907
Closed

Kapitan fails to render Jinja template with input_params #906

ademariag opened this issue Dec 7, 2022 · 0 comments · Fixed by #907
Assignees

Comments

@ademariag
Copy link
Contributor

ademariag commented Dec 7, 2022

Describe the bug/feature
Kapitan fails to render Jinja with input_params

while defining a simple input_params for ajinja template I realised that it was not working

Will add more soon
To Reproduce
Steps to reproduce the behavior:

gcloud --project {{input_params.gcp_project_id}}
parameters:
  scripts:
  - templates/scripts/gcloud
  scripts_params:
    gcp_project_id: ${gcp_project_id}
  kapitan:
    compile:
    ...
      - output_path: scripts
        input_type: jinja2
        input_paths: ${scripts}
        input_params: ${scripts_params}
Jinja2 error: failed to render /src/templates/scripts/gcloud: Jinja2 TemplateError: 'dict object' has no attribute 'gcp_project_id', at /src/templates/scripts/gcloud:5
Compile error: failed to compile target: dev

Expected behavior

gcloud --project isolabs-platform

This is possibly caused by this loop which would allow for input_params to only work for the first file being compiled

https://github.com/kapicorp/kapitan/blob/master/kapitan/inputs/base.py#L55

ademariag pushed a commit that referenced this issue Dec 7, 2022
ademariag pushed a commit that referenced this issue Dec 7, 2022
@ademariag ademariag self-assigned this Dec 7, 2022
@ademariag ademariag linked a pull request Dec 7, 2022 that will close this issue
ademariag pushed a commit that referenced this issue Dec 7, 2022
ademariag pushed a commit that referenced this issue Dec 8, 2022
ademariag pushed a commit that referenced this issue Dec 8, 2022
ramaro pushed a commit that referenced this issue Jan 14, 2023
* fix #906: Jinja input_params gets reset

* fix #906: adds test

* fix python linting
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 a pull request may close this issue.

1 participant