Find a better consistent way to override the core version
Problem/Motivation (short version)
The _TARGET_CORE variable can only be used to overide the core value in the 'current' and 'max php' variants. To override the core version in the other four variants you have to set the variable DRUPAL_CORE directly. This is inconsistent and can lead to confusion and wasted developer effort.
Background
The _TARGET_CORE variable is the documented (and recommended) way to override the core version that is used for a set of jobs. _TARGET_CORE appears in the public list of variables and it's default value is $CORE_SUPPORTED.
_TARGET_CORE is used to set the value of DRUPAL_CORE in global variables, Composer and Composer Max PHP and is only used in these three places. The other four variants have DRUPAL_CORE set to a specific version variable ($CORE_SECURITY_PREVIOUS_MINOR, $CORE_PREVIOUS_STABLE, $CORE_NEXT_MINOR and $CORE_MAJOR_DEVELOPMENT).
The DRUPAL_CORE variable is defined in seven places in the tempates (global variables and the six variant composer jobs, as explained above). This can be thought of as the "internal" variable that is actually used in the jobs. The value is written to build.env in the Composer job, so it is available in any later job.
Steps to reproduce
The following works as expected
composer (max php):
variables:
_TARGET_CORE: "11.x-dev"
But move the same line to another variant, and it has no effect at all:
composer (next minor):
variables:
_TARGET_CORE: "11.x-dev"
Proposed resolution
For consistency across variants, and to keep the documentation instuctions clear and simple, _TARGET_CORE should be deprecated, and instead use DRUPAL_CORE for all six variants.
If a project is using _TARGET_CORE then this should still be respected, for backwards compatibility.
Related issue: Issue #3441816