-
Notifications
You must be signed in to change notification settings - Fork 3
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
Jinja2 template variables #47
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Owner
lhh
commented
Jul 29, 2024
•
edited
Loading
edited
- Use two common jinja2 "default" variable templates
- Allow interactive input when desired
- Require all variables detected in a template to be provided
- Variables can be provided on the command line (just like jirate create name value name2 value2)
- For variables provided on the command line, do not prompt user
- Variables that are not in the template raise errors
- I may have been hungry when writing the last test.
lhh
force-pushed
the
simple_template_vars
branch
from
July 30, 2024 17:27
a9f796d
to
78905ff
Compare
Gonna merge the first 4 then resubmit this separately and more focused - they were mostly cleanups. |
lhh
force-pushed
the
simple_template_vars
branch
3 times, most recently
from
August 1, 2024 17:55
07534af
to
6f122b7
Compare
Whoops, deleted it accidentally. |
compi-migui
reviewed
Aug 6, 2024
I'm happy to re-push without the commit/revert, but I think that code (or something like it) may prove useful to someone else maybe, and this doesn't affect our ability to move forward. |
lhh
force-pushed
the
simple_template_vars
branch
3 times, most recently
from
August 15, 2024 00:23
3be0c4b
to
6b1c782
Compare
lhh
force-pushed
the
simple_template_vars
branch
from
August 15, 2024 00:35
6b1c782
to
aaabb08
Compare
lhh
commented
Aug 15, 2024
lhh
force-pushed
the
simple_template_vars
branch
5 times, most recently
from
August 19, 2024 20:43
daa9739
to
503015c
Compare
Jinja2 unfortunately uses glyphs that collide with the glyphs in the JIRA markdown. Rather than escape one or the other, for simple variable substitution, we can just roll our own. CPaaS uses @@variable@@, so we can as well.
Rather than maintaining our own parser, jinja2 can be used. Miguel G. pointed out that we can simply change the glyphs used to denote a variable declaration to avoid conflicts with Jira syntax. This has numerous advantages. Contrast to 2 commits ago: - variable declartions -> @@var@@ to {@var@} - No way to specify an optional value (that's OK I think) - Use Jinja2 templating by passing raw text from reading the template instead of the dict loaded by yaml.safe_load()
This is somewhat complicated code, so be more clear with documentation.
lhh
force-pushed
the
simple_template_vars
branch
from
August 19, 2024 23:15
503015c
to
17bdfd8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.