Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.