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

[fix] rework tera manifest evaluation #286

Closed
wants to merge 1 commit into from
Closed

[fix] rework tera manifest evaluation #286

wants to merge 1 commit into from

Conversation

icepuma
Copy link
Member

@icepuma icepuma commented Dec 10, 2022

  • only pipe manifest through tera, when it will be executed -> after checking labels -> after checking where

I'm submitting a

  • bug fix
  • feature
  • documentation addition

What is the current behaviour?

Closes #283.

- only pipe manifest through tera, when it will be executed
  -> after checking labels
  -> after checking where
@icepuma icepuma requested review from a team, rawkode and martintc and removed request for a team December 10, 2022 23:25
@codecov-commenter
Copy link

Codecov Report

Base: 46.64% // Head: 46.64% // No change to project coverage 👍

Coverage data is based on head (d76f6cb) compared to base (7e6eace).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #286   +/-   ##
=======================================
  Coverage   46.64%   46.64%           
=======================================
  Files          79       79           
  Lines        2742     2742           
=======================================
  Hits         1279     1279           
  Misses       1463     1463           
Impacted Files Coverage Δ
app/src/commands/apply.rs 0.00% <0.00%> (ø)
lib/src/manifests/load.rs 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@icepuma icepuma marked this pull request as draft December 10, 2022 23:43
@icepuma icepuma closed this Dec 10, 2022
@icepuma
Copy link
Member Author

icepuma commented Dec 10, 2022

The solution works, but we have to reconsider piping everything through tera.

@rawkode
Copy link
Member

rawkode commented Dec 11, 2022

Labels and where conditions can use templating. So this likely would cause some problems?

@icepuma
Copy link
Member Author

icepuma commented Dec 11, 2022

Nah, the main problem is the way I solved the problem:

  • First I deserialize the YAML files into the Manifest struct
  • then serialize it back to YAML to do the tera templating
  • and then deserialize it back to the Manifest struct

Serde adds the defaults to the resulting YAML before piping it through tera, which resulted in some bad side effects, because we don't have a proper serialize_with - method e.g. here.

But let's talk on thursday about it :)

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.

Bug: Tera should only evaluate templates after all where clauses have been analysed
3 participants