-
Notifications
You must be signed in to change notification settings - Fork 24k
ansible-galaxy - Don't copy a file from a skeleton if file.j2 also exists #82624
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
base: devel
Are you sure you want to change the base?
Conversation
* fixed a bug in the if condition that made it essentially a noop * added PR reference to changelog fragment
* If file and file.j2 exists in skeletons template dir, copy both * Add tests
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.
After discussing internally, I've changed about allowing mixing files where the skeleton lives with actual skeleton files. It's probably safest to just give an error if there are conflicting files (this will fix the bug with getting an unpredictable result), and the caller can either fix the skeleton, or use GALAXY_COLLECTION_SKELETON_IGNORE/GALAXY_ROLE_SKELETON_IGNORE if the intention is actually to ignore one of the files.
SUMMARY
If a file.j2 exists in the skeleton and also file (without .j2 extension), e.g.:
ensure that only README.md.j2 is copied
This is a minor performance tweak, but there is more to it. See below...
ISSUE TYPE
ADDITIONAL INFORMATION
Until now it was unspecified which file it makes into the initialized collection or role, because the directory tree is walked with
os.walk()
and the order is unspecified.With the PR we have predictable results which makes some use cases possible if the skeleton is located in it's own git repository
README.md
describes the usage of the skeleton and will be rendered by github UIREADME.md.j2
is copied over into the collection/roleanother example would be a github workflow
.github/workflows/CI.yml
-> used by github actions to test my skeleton.github/workflows/CI.yml.j2
-> template for my initialized collection/rolecommands affected: