CI Steps: Iteration 4: Support `run:` syntax in `.gitlab-ci.yml` (MVP)
## Epic **Depends on: https://gitlab.com/groups/gitlab-org/-/epics/11736+** This Epic describes all work required to achieve CI Steps the MVP. - The proposed MVP is complete, and provides the nice to use interface with Step Runner. - The presented YAML syntax is subject to change during problem refinement and development. - To understand proposed MVC design choices get familiar with [CI/CD Components design](https://docs.gitlab.com/ee/ci/components/#components-repository). - This delivers aspects of the [Step Runner to execute GitLab Steps](https://docs.gitlab.com/ee/architecture/blueprints/gitlab_steps/). - This incorporates discussion from [Step Runner Implementation Details MR](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/131688). - This incorporated discussion from [Step Definition](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134759). ## Goals 2. User can use `run: - script:` syntax to execute simple scripts without using extensive `run: - step:`. 1. User can use CI Steps in their `.gitlab-ci.yml` with a first-class syntax `run:`. 3. We would not yet inject Step Runner binary into target environment. We would expect the Step Runner binary be available at `/step-runner` and be executed by CI. ## Design #### .gitlab-ci.yml User would create the following `.gitlab-ci.yml` that would allow to use steps in existing CI workflows: ```yaml hello-world: image: registry.gitlab.com/gitlab-org/step-runner:latest run: - step: ./path/to/local/step-name.yml - step: gitlab.com/josephburnett/component-hello-steppy@master inputs: hello: world ``` The usage of `run:` would forbid the usage of `script:`. #### Use syntactic sugar to run scripts To simplify common workflows we would support the `script:` syntax in Step Runner as described in: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134759. ```yaml hello-world: image: registry.gitlab.com/gitlab-org/step-runner:latest run: - step: ./path/to/local/step-name.yml - script: echo Hello World ``` ## Approach - The `Step Runner` would start publishing full JSON schema validation for the `Step Definition. - The `GitLab Rails` would bundle the JSON schema validation in a source code. - The `GitLab Rails` would not parse the `run:`, only validate, and persist in database as a `jsonb` column in `ci_builds_metadata`. - The `GitLab Rails` would passthrough the `run:` into `/jobs/request` to be consumed by Runner. - The `Runner` would passthrough and execute `/step-runner ci` in the CI environment passing the `run:` in a structured form: `$STEPS` environment variable? ## Competencies required - Step Runner: Golang engineer to add `script:` - GitLab Runner: Golang engineer to passthrough parsed `run:` from Rails to `Step Runner` and call `/step-runner ci` implicitly - Rails: Ruby engineer to extend `.gitlab-ci.yml`, add JSON validation, persist data in database, and emit into `/jobs/request`.
epic