gitlab-ci: add support for job:when and rules:
### Release notes
Previously it was impossible to configure a [when:](https://docs.gitlab.com/ee/ci/yaml/#when) keyword for a CI job that had [rules:](https://docs.gitlab.com/ee/ci/yaml/#rules) this limits our users when defining their jobs in their CI/CD pipelines, in this release we've dropped that limitation by supporting [job:when](https://docs.gitlab.com/ee/ci/yaml/#when) and [rules:](https://docs.gitlab.com/ee/ci/yaml/#rules) keyword allowing you to define jobs in your pipeline in a flexible way.
### Summary
Documentation for [Rules:If](https://docs.gitlab.com/ee/ci/yaml/#rulesif) states:
> If rules:when is not included in the configuration at all, the behavior defaults to job:when, which continues to default to on_success
To me, this suggests I can leave the when statement out of the if rules and specify the when statement at a job level. However, when I try this I get a YAML lint error.
My use case is that I am using the extends keyword to apply some custom rules to multiple jobs. However, only the deployment job should be manual (see sample .gitlab-ci.yml file below). I can get around this by making `.custom-rule-manual` and explicitly setting `when: manual` but then the if statement is duplicated, which I'd like to avoid.
### Steps to reproduce
The following .gitlab-ci.yml file fails linting with the error ```jobs:deployjob config key may not be used with `rules`: when```. I am using the GitLab.com CI Lint.
```yml
testJob:
stage: test
script:
- echo Testing
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $STAGE_BRANCH'
deployJob:
stage: deploy
when: manual
script:
- echo Deploying
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $STAGE_BRANCH'
```
### Proposal
- The expected behavior is that we should add support for jobs:when and rules to support the above configuration
- There was a discussion regarding the implicit and the explicit `when` (should one override the other?), however, eventually we agreed that implicit `when` should not override explicit `when` [here](https://gitlab.com/gitlab-org/gitlab/-/issues/219437#note_705633787) and [here](https://gitlab.com/gitlab-org/gitlab/-/issues/219437#note_684583668).
- Here is a short [POC proposal](https://gitlab.com/gitlab-org/gitlab/-/issues/219437#note_706016913)
- The change will not contain [Breaking changes](https://gitlab.com/gitlab-org/gitlab/-/issues/219437#note_706303751)
issue