Define extra rule to jobs that have "needs: composer"

Migrated issue

Reported by: jurgenhaas

Related to !112 !108 (merged)

Problem/Motivation

We have lots of jobs with this property:

  needs:
    - composer

However, if a pipeline runs with the variable SKIP_COMPOSER: '1', then that job won't run and the jobs in need of that are invalid. An error message will be printed:

 Unable to create pipeline

    'composer-lint' job needs 'composer' job, but 'composer' is not in any previous stage
    'phpcs' job needs 'composer' job, but 'composer' is not in any previous stage
    'phpstan' job needs 'composer' job, but 'composer' is not in any previous stage
    'eslint' job needs 'composer' job, but 'composer' is not in any previous stage
    'phpunit' job needs 'composer' job, but 'composer' is not in any previous stage

Steps to reproduce

Add the variable SKIP_COMPOSER: '1' to your gitlab-ci config and commit that. It will immediately show this error.

Goals to achieve

  1. Allow PHPUNIT and PHSTAN to be run on any set of core version variants and the current version. This includes the scenario of not running at the current version
  2. Independent of the version variants that PHPUNIT and/or PHPSTAN are being run at, allow ESLINT, COMPOSER_LINT, STYLELINT, PHPCS and NIGHTWATCH jobs to be run. These all need the current core version, there are no variants>
  3. Allow any job (or sets of job variants) to be skipped. Skipped jobs should not be forced internally to run. "Skip means Skip"

Proposed resolution

  1. Introduce a new variable OPT_IN_TEST_CURRENT with default value 1 (unlike the other OPT_IN variables which default to 0. This will be used to run the correct Composer version, and also the PHPSTAN and PHPUNIT jobs for current core.
  2. Remove/deprecate the SKIP_COMPOSER variable and simply determine which Composer job(s) should be run, depending on the settings of SKIP_ and OPT_IN_