-
-
Notifications
You must be signed in to change notification settings - Fork 605
Refactor PHP role to support future versions by default #1511
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
Conversation
🤔 interesting! I have a few initial concerns:
But on the other hand, requiring no code changes for people running Trellis projects is a benefit too and that's probably your main reason for proposing this change. |
Correct. As it stands though, we have to add a 8.4.yml file even if there are no package changes.
A suitable PR (and changelog entry) can still change the 'out of the box' php version to highlight official support, like #1484. We could also add a line to the readme and/or the docs stating something along the lines of "Trellis officially supports PHP 7.4 - 8.2, more recent versions may also work but have not yet been tested by the community." Edit to add - thanks for reviewing! |
5425faa
to
597769e
Compare
8.4 added in #1560 |
@dalepgrant want to rebase this? I think it's still an improvement over all |
83748e1
to
40b5a4c
Compare
@swalkinshaw done, and thank you 🙏 I was looking for somewhere in the docs to put a note about this and how to change it, but there's nowhere obvious. Best place I could come up with was here but you'd only find that by accident. Would you be happy with a new PHP page (I can PR)? Or is there somewhere better to put this/don't think documentation is needed? |
A new page for configuring PHP sounds good actually. We can expand it with the other options after too 👍 |
Thanks @dalepgrant |
Refactors php version vars to be dynamic by default whilst allowing overrides.
Motivation
The current approach requires a file to be duplicated and renamed for every php version release. At time of writing, the contents of said files covering 7.4 - 8.2 (4 files total) are identical, except for the php version number itself.
To add support for php 8.3, a fifth file would need to be added.Edit to add: since #1514, this fifth file has now been added.Proposal
By making the default file dynamic, we can avoid duplicating files each time a new php version is released. If something changes from one release to the next, an override file can be created using the php version as the filename (i.e. we can fallback to the existing method).
Considerations
I initially started to put these vars in the
php/defaults/main.yml
file, as these are essentially defaults. However, ultimately I settled onphp/vars/version-specific-defaults.yml
which a) is closer to what developers are currently familiar with, b) separates php version specific defaults from other defaults and c) allows for easy duplicate & rename to override.I've only tested this on local so far and everything provisions as expected using php 8.3.
Comments have been written with
8.18.2 as that is the current default version for Trellis.