CI Steps: Support expression language for the conditional execution `if:` and robust interpolation (MVC)
## Epic **Depends on: https://gitlab.com/groups/gitlab-org/-/epics/11736+** **Depends on: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138092+** This Epic improves Step Runner workflow, by providing a simple way to control flow of execution and use complex interpolation: - The `if:` can allow to conditionally skip steps from being executed. - The expression language allows to write complex expressions, using functions and transformations allowing to `join` and `reduce` inputs. ## Goals - Make `steps:` usable, by making them configurable. - Unify expressions, interpolation, and build robust context object with data that can be used in Steps. ## Design ### Use `if:` to select which steps should be run ```yaml spec: --- type: steps steps: - step: ./.gitlab/ci/steps/ruby/install.yml inputs: version: 3.1 env: HTTP_TIMEOUT: 10s if: runtime.OS == "linux" - step: gitlab.com/gitlab-org/components/bash/script@v1.0 inputs: script: echo Hello World from ${{ runtime.os_release.VERSION_CODENAME }} if: runtime.os_release.VERSION_CODENAME == "debian" || runtime.os_release.VERSION_CODENAME == "ubuntu" ``` ### Use `${{ ... }}` to perform complex transformations ```yaml spec: inputs: timeout: default: 10s bash_support_version: --- type: steps env: HTTP_TIMEOUT: ${{inputs.timeout}} PROJECT_ID: ${{job.project.id}} steps: - step: ./my/local/step/to/echo.yml inputs: message: "I'm currently building a project: ${{job.project.full_path}}" - step: ./my/local/step/to/echo.yml inputs: message: "I'm currently building a project: ${{ concat(job.project.full_path, " ", job.project.url) }}" - step: gitlab.com/gitlab-org/components/bash/script@v${{inputs.bash_support_version}} ``` ## Approach - Finish the https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138092. - Define `context` objects that will be available during steps execution. - Implement expression language using `ragel` and `yacc` that will create AST to be executed.
epic