Skip to content

Refactor `GitlabCiYamlProcessor`

Currently GitlabCiYamlProcessor have much more than a single responsibility. It:

  • validates entire .gitlab-ci.yml
  • validates jobs
  • validates stages
  • provides some default values
  • does initial parsing
  • builds jobs from configuration
  • selects jobs for stage and ref
  • normalizes script

I think it may be a good idea to extract some classes.

We can create classes like Ci::Config, Ci::Config::Validator(::Job, ::Global, ::Stage), Ci::Config::Builder, Ci::Config::Parser(::Yaml) etc. With this approach it will be a lot easier to extend it, refactor, provide additional configuration formats, and so on.

What do you think @ayufan?