Since Symfony version 2, the project's code has been managed as a Git mono-repository. Having all the code in one place is very convenient: from changes across the board to centralized issues, it makes everyone's life much easier.
Since Symfony 4, the mono-repository is only used for development and not used
anymore as a Composer project dependency (symfony/symfony
). Instead,
projects now depend on individual packages (symfony/console
,
symfony/http-kernel
, ...). It is a great optimization as it saves some
significant bandwith by not downloading code you will never use. It also allows
Symfony 4 to automatically enable or disable features based on your
dependencies.
The mono-repository is still the single source of truth though as the individual packages are automatically updated thanks to a technique known as Git subtree splits.
Whenever we create a new release, we are tagging the mono-repository and then,
tags are automatically created for each individual package. But as the number
of Symfony components grows, it also means that we are creating more "empty"
tags. Even if a package has had no changes since the last patch release, we are
still creating a new tag. It has one big advantage: you can easily spot in the
composer show
output if all Symfony packages are up-to-date.
Creating tags when no changes occur is also wasting resources: CIs updating dependencies, developers downloading new versions even if they don't need to, time spent waiting for the downloads, ... We are wasting human resources, but also infrastructure resources.
Talking about optimizing infrastructure resources, we have worked hard to optimize our CI pipelines to avoid redundant activities as much as possible. Today, we are going one step further.
Starting with the next releases, we won't create tags anymore for packages when they had no changes since the last patch release as we consider the benefits far more important than the inconvenience of not having all Symfony packages using the same patch version. It also has one side-effect: sometimes, we tag a release with a major regression in one component. Even if we fix it right away, we are always reluctant to tag a new release right away to avoid creating many new empty tags. No more. When such regressions happen, we will now be able to quickly create a new release.
Besides the main Symfony repository, we will do the same for Symfony Contracts, Symfony Polyfills, and Twig.
That's maybe a baby step, but a good one nonetheless to protect our planet.
Hi, this looks great! Do you care to share how you achieved this? Do I understand correctly, you're still tagging monorepo and splitting after?
@Martin: This is part of my subtree splitter stack which I have been developing since Symfony 2.0.
This seems a very userful optimization, thanks Fabien!
How would you behave across minor (or major) versions? Would a minor/major release be tagged anyway, regardless of changes?
And what about continuity? Would this mean that you would skip a patch number to keep the patches aligned, or from now on every component will follow its patching numbering independently?
It's a good save about resource waste.
What happens if we use composer "extra.symfony.require" property to ensure symfony components are always loaded with the given version, even those which are loaded threw dependency?
@Fabian could you disclose more details about how did you achieved that? My current understanding is that https://github.com/splitsh/lite or an enhanced Symfony-internal version of it is being used to split the Symfony monorepo. We also use splitsh/lite to split our monorepo and we have the same problem with unnecessary tags.
We only skip tags for patch releases, but we always create tags for minor/major versions (.0), so v5.3.0/v6.0.0 will be created for all packages even if nothing changed.
The core code is almost the same as splitsh/lite, but I've a layer on top to manage tags/packagist/...