Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitlab-ci: Is there a way to visualize or simulate pipelines for different branch/tag names?

Tags:

gitlab-ci

We have a fairly complex .gitlab-ci.yml configuration. I know about the new gitlab pipeline editor, but I can't find a way to 'simulate' what jobs get picked by my rules depending on the branch name, tag, etc.

On our jobs, we have a $PIPELINE custom variable to allow us to have different pipeline 'types' by using schedules to define this var to different values, like this:

rules:
  - if: '$PIPELINE == "regular" && ($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_TAG != null)'

or like this:

rules:
  - if: '$CI_COMMIT_TAG != null'

Is there a way to 'simulate' a pipeline with different branch names, tags and variables so I can see what jobs get picked on each case, without actually running the pipelines (e.g. with a test tag, etc.). Or is there a better way to do this?

Thanks in advance.

like image 737
João Pinheiro Avatar asked Oct 23 '25 09:10

João Pinheiro


1 Answers

Not quite, but this is close, with GitLab 15.3 (August 2022):

Simulate default branch pipeline in the Pipeline Editor

The pipeline editor helps prevent syntax errors in your pipeline before you commit. But pipeline logic issues are harder to spot. For example, incorrect rules and needs job dependencies might not be noticed until after you commit and try running a pipeline.

In this release, we’ve brought the ability to simulate a pipeline to the pipeline editor.

This was previously available in limited form in the CI Lint tool, but now you can use it directly in the pipeline editor. Use it to simulate a new pipeline creation on the default branch with your changes, and detect logic problems before you actually commit!

https://youtu.be/yYjmd-lgzMk

See Documentation and Issue.

like image 66
VonC Avatar answered Oct 27 '25 00:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!