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
Scaffolder: Renders path templates when copyWithoutRender is used #12491
Scaffolder: Renders path templates when copyWithoutRender is used #12491
Conversation
Changed Packages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
I agree it's a bit strange that file names aren't templated. I think we want this to be the default in the long run but we do consider this to be a breaking change. There's probably some user using backstage to template templates.
What I think we should do is to make sure that the cookiecutterCompat
template file names and we consider that a bugfix.
copyWithoutRender
should probably be deprecated and replaced by a new mode which does template the names but not the content. Do you have any name suggestions for this?
copyWithoutTemplating
or copyNoRender
is just some names that popped up in my head.
Hi @jhaals, thanks for the review! First of all, I agree with you that the baseline should be the
I think the name also comes from the Cookiecutter context. To make sure I understand it correctly, what you are suggesting is:
If above is the correct understanding, I think there might also be some confusion:
In terms of the backward compatibility, maybe we can view it by listing out who might be affected, ✅ means all good, ❌ means breaking change.
I would argue that the users that get affected might be minimal, and I can't think of a use case that you actually want to have untemplated paths in your end result even if you are using the Backstage templating. Cookiecutter's fix is also considered a "breaking change" since they just changed the way how |
Hey! 👋 @jhaals is out on vacation, so I'm gonna try and help get this through 👍
So imagine the use case that you want a template that can create you other software templates for development. You don't want the paths templating as they're only meant to be templated when the created template is run. It's a little bit of a meta usage, but I know that theres adopters using this, so unfortunately it would break that functionality so we need to be respective of that. I'm not to concerned of keeping with the I think the way forward should be as so:
A little bit of background about the Does this make sense? |
Hi @benjdlambert, thanks for the help! I have a bit more context now thanks to you 😄 . Yes, "templating another template" could be a valid use case. Initially I thought the I will go with your suggestions and create a ticket to deprecate the |
3c3c307
to
6fdbccb
Compare
6fdbccb
to
43c972d
Compare
Hi @benjdlambert, I've updated the PR to reflect what you suggested, pls help review, thanks! PS. sorry for the forks who got mis-tagged in the PR, I messed up my branch and the bot added you, but I don't think I can revert it 😂 |
Add `copyWithoutTemplating` to the the fetch template action input. `copyWithoutTemplating` also accepts an array of glob patterns. Contents of matched files or directories are copied without being processed, but paths are subject to rendering. Deprecate `copyWithoutRender` in favor of `copyWithoutTemplating`. Signed-off-by: Mengnan Gong <namco1992@gmail.com>
43c972d
to
ff316b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! and the patience 🙏
When putting templated paths in
copyWithoutRender
filter, like{{project}}/something
, the path template won't get rendered and thefiles are copied to the exact
{{project}}/something
instead ofsomeproject/something
.Cookiecutter has fixed this issue in cookiecutter/cookiecutter#456. For users who come from the Cookiecutter world, this inconsistency between Cookiecutter and Backstage is unexpected and could lead to some confusion.
I believe the behaviour in Backstage should be consistent with Cookiecutter. Note that this change affects templating even not in
cookiecutterCompat
mode, I'm not sure if this would be considered as a breaking change. However, I think having different behaviours (render paths incookiecutterCompat
mode, otherwise ignore it) might be even more confusing, and I can't really think of a use case that you actually want to have untemplated paths in your end result.Signed-off-by: Mengnan Gong namco1992@gmail.com
Hey, I just made a Pull Request!
✔️ Checklist
Signed-off-by
line in the message. (more info)