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

Review App creation fails due to embedded Jinja #408

Open
artsyjian opened this issue May 13, 2024 · 0 comments
Open

Review App creation fails due to embedded Jinja #408

artsyjian opened this issue May 13, 2024 · 0 comments
Assignees
Labels
high high importance

Comments

@artsyjian
Copy link
Contributor

artsyjian commented May 13, 2024

While embedded Jinja can be escaped using {% raw %}, it still causes problem for Review App creation.

The problem happens in 2 steps:

  • Review app setup

    artsy:hokusai-sandbox jxu$ /Users/jxu/.pyenv/versions/hokusai/bin/hokusai review_app setup foo
    Created hokusai/foo.yml
    

    In this step, Hokusai loads staging.yml spec and renders any Jinja templates in the spec. This removes the raw delimiters, so that ES resource’s embedded Jinja template is no longer escaped. The produced Review App spec foo.yml contains:

        template:
          engineVersion: v2
          templateFrom:
          - literal: '{{ range $key, $value := . }}
    
              {{$key}}: {{$value | fromJson | values | first}}
    
              {{ end }}
    
              '
            target: Data
    
  • Review app create

    artsy:hokusai-sandbox jxu$ /Users/jxu/.pyenv/versions/hokusai/bin/hokusai review_app create foo
    ERROR: Rendering template raised error <class 'jinja2.exceptions.TemplateSyntaxError'> <message 'unexpected char '$' at 682'>
    

    The error occurs because Hokusai attempts to Jinja render foo.yml ES resource.

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

No branches or pull requests

1 participant