sartography / cr-connect

0 stars 0 forks source link

Jinja Templates - Includes within Includes #670

Closed danfunk closed 2 years ago

danfunk commented 2 years ago

I was debugging the Jinja templates for another issue, and while tracking down the problem, I modified the Jinja Service to parse out the include statements. These include statements reference variables in the task data that also contain Jinja markup. Everything works, but I realized that if the included templates themselves have includes, we are going to error out. We have a couple of options:

  1. Stop trying to parse the includes (it turned out that just making all the data available to Jinja as potential templates is not an issue)
  2. Recursively parse the includes (each time a template is found, recheck the data to see if that has an include, and make sure that is available. This has the added benefit of validating that all of the includes are available. Which could potentially be heart-wrenchingly difficult to debug otherwise.
calexh-sar commented 2 years ago

Closing per Slack chat with Dan below:

Alex  5:41 PM
@Dan do you remember which workflow had an include inside an include?

Dan  5:42 PM
I thought I had hit it today, but I was wrong, I have not, during validation, hit on a included include in Jinja.
It might not be something you can verify, but I can confirm we have a test.