CircleCI Ideas

Allow nested lists in config.yml. `steps` List

Often I repetition inside the jobs-steps-List. By leveraging YAML alias and references one could have a macro like functionality in config.yml: 

stepslist: &stepslist
- checkout:
path: ~/repo
- run: doit -f submodules
- restore_cache: …
- run: doit -f BUILD
- save_cache: …

- *stepslist
- run: doit -f CICHECK CITEST

Using YAML  `<<:` merge as suggested in does not work with steps because steps is a list. Do the config shown above dos not work currently.
But if Circle CI would accept a list of lists (basically run `steps.flatten()`) it would enable using this functionality reducing config duplication without much added complexity. is the same problem.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • May 22 2018
  • Shipped
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    May 22, 2018 12:36
  • Admin
    Nathan Dintenfass commented
    May 22, 2018 17:59

    We will be providing something akin to this in a coming set of configuration improvements -- we will let you define a command that is a set of parametrizable steps you can invoke in a job.

  • Admin
    Nathan Dintenfass commented
    December 07, 2018 22:09

    You can now do this with the `commands` stanza.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    June 13, 2019 16:52

    Works only with config 2.1 which isn't supported by circleci CLI.

    Any solutions which works on 2.0?

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    October 15, 2019 23:41

    Just to mention (for anyone else looking as I was) that this functionality is achievable using CircleCI v2.1:


    Don't forget to specify version: 2.1 in your config.yml