m-khvoinitsky / workflow-templater

Template engine for (currently) Jira and Email. Uses yaml and jinja2. It helps you create multiple (possibly cross-liked) jira issues and emails from a template.
MIT License
6 stars 3 forks source link

Using the natsort module to list files in an expected order #6

Closed benzo-elastic closed 1 year ago

benzo-elastic commented 1 year ago

When we added more than 9 template files & had 10_whatever.jira.yaml then that file will be the first template attempted, which would break as issuekey_1 didn't exist at that time.

Using the natsort module fixed it for us

Error output

./__init__.py --config ../../region_build/0_common.yaml ../../test_build/
INFO creating issue for 10_whatever
ERROR during POST to https://REMOVED.atlassian.net/rest/api/2/issue/: 400 Bad Request
errorMessages: []
errors:
  parent: Could not find issue by id or key.

ERROR Unhandled exception HTTPError: HTTP Error 400: Bad Request

Where 10_whatever had a parent

parent:
  key: '{{ issuekey_1_main }}'
m-khvoinitsky commented 1 year ago

I usually named templates like 01_blabla.yaml, 02_blabla.yaml which solved the issue from day one. But I like your more intuitive solution.

Thank you for the contribution!