Skip to content

Make CreatePipelineService to use a dry_run mode

What does this MR do?

Related to #229794 (closed)

The CI Lint currently uses YamlProcessor to validate the content passed in. The YamlProcessor represents a small part of the whole pipeline creation process and it only covers syntax errors.

Using YamlProcessor today it gives a false sense of validation to users because it can return that a configuration is valid but when trying to create a pipeline it fails for some other reasons not considered before. Typical examples are logical validations that occur beyond the YamlProcessor.

Example: The following syntax is considered valid by CI Lint but it would return an error test: needs 'build' when trying to actually create the pipeline.

build:
  script: echo
  stage: build
  rules:
    - if: '$CI_MERGE_REQUEST_ID'
test:
  script: echo
  stage: test
  needs: [build]

This MR introduces a new mode in Ci::CreatePipelineService called dry_run: true (which is false by default). This mode would skip persisting the pipeline while letting everything else happening. In the end, a non-persisted pipeline is returned including any errors and (recently added) warnings.

In a follow-up MR !37828 (merged) we will use Ci::CreatePipelineService with dry_run: true in the CI Lint so that we can simulate an actual pipeline creation.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Fabio Pitino

Merge request reports

Loading