Skip to content

Do not save PipelineMetadata if name is blank

Reuben Pereira requested to merge rp/fix-empty-name into master

What does this MR do and why?

Describe in detail what your merge request does and why.

When the pipeline name is blank after substituting variables, if we try saving the name to database, it fails because of a model (Ci::PipelineMetadata) validation. And the failure to save PipelineMetadata prevents the pipeline from being created.

The most common way of using the pipeline name is expected to be the following:

workflow:
  name: '$PIPELINE_NAME'
  rules:
    - if: $VAR1
      variables:
        PIPELINE_NAME: 'Pipeline 1'

    - if: $VAR2
      variables:
        PIPELINE_NAME: 'Pipeline 2'

    - when: always

The above usage will result in the pipeline failing to be created:

  • If we have not named every possible pipeline.
    We want customers to be able to incrementally increase their usage of this feature, rather than forcing all pipelines to be named, or none.

  • If we have not set a default value for the PIPELINE_NAME variable.
    Setting a default value for PIPELINE_NAME is not desirable since it will result in pipelines having a generic name.

To make it possible to name only some pipelines, this MR does not save the pipeline name to database if the name is blank after substituting variables.

#372538 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Furkan Ayhan

Merge request reports

Loading