Closed nadworny closed 2 years ago
Hi there!
You're right that the the templates is not fully compatible with cookiecutter, that's because the default template engine now uses nunjucks for templating which has the benefit of not requiring installation of cookiecutter. You can still use cookiecutter if you are unable to work around the differences in the two templating engines by using scaffolder-backend-module-cookiecutter, there's also some additional help and context in the migration guide. I hope that helps!
Hi @jhaals
Thanks for your input. I didn't find anything specific to the cookiecutter scaffolder except of setting cookiecutterCompat: true
. Did I miss something? Would you be so kind and tell me how can I enable the scaffolder-backend-module-cookiecutter?
@nadworny The scaffolder-backend-module-cookiecutter
is a separate module that you install if you want full cookiecutter support. You'll need to either have cookiecutter
installed inside the scaffolder instance, or it needs to have access to a docker daemon. The setup instructions are documented in the README.
Will close this as it's working as intended. Let us know if we missed anything.
Expected Behavior
After migrating to the new
scaffolder.backstage.io/v1beta3
, the templating behaves the same as before migration.Actual Behavior
Templating fails.
I have the following catalog-info.yaml:
First problem
title()
seems to break the template generation with the following error:Second problem
Replace doesn't behave the same as with cookiecutter. It just replaces the first occurrence instead of all. It's strange because if I look at the replace function in nunjucks, it also replaces all occurrences by default. Assuming we do
{{ cookiecutter.project_slug.replace('-','') }}
withproject_slug: this-is-a-test
Before beta3 producesthisisatest
Current beta3 producesthisis-a-test
Steps to Reproduce
Use the following
template.yaml
definition: