Use string, array, or array of arrays for many `.gitlab-ci.yml` values
Description
We should be more flexible in .gitlab-ci.yml
anywhere we accept an array today. We should accept a single value (string) without array syntax if there's only one value. We already support strings or arrays for script
, but not other keys like only
.
Also, within an array, we should also accept sub-arrays, and just flatten these out as if they were one large array. This is important for making YAML templating easier to use.
Bonus points: We should accept singular and plural forms of keywords. e.g. variable
and variables
. I know that's not common, but it's very Rails-y, and awesome to not have to worry about plurality, or mismatching plurality. Variables might be fine, but thinking about include
vs includes
, it's annoying to use a plural when including a single file just because you can include multiple files. I don't think there is any chance of conflict here, so this is pure DX win.
Proposal
string-job:
script: echo Only one branch
only: master
.job-partial: &job-partial
- echo one
- echo two
complex-job:
script:
- *job-partial
- echo three
Links / references
Documentation blurb
(Write the start of the documentation of this feature here, include:
- Why should someone use it; what's the underlying problem.
- What is the solution.
- How does someone use this
During implementation, this can then be copied and used as a starter for the documentation.)