Diagramming or flowcharting a pipeline

Problem to solve

My goal is to self-document my pipeline visually.

When the pipeline runs, a job examines .gitlab-ci.yml, charts the yaml, and stashes the resulting [pdf, jpg] as an artifact.

This would give the team responsible for maintaining the pipeline a visual representation of what it’s doing, and something I can wave at management when they want to know ‘what is all that yaml for’.

Essentially, I want to take the Visualize view found in CI/CD - Editor and store it as an artifact.

What I’ve Done So Far

I started off looking at libraries in python (graphviz : Digraph) and yaml2dot.

While they do great on non pipeline yaml, and are okay with the most basic pipeline structures, they quickly ran into issues with custom tags - we make liberal use of ‘!reference’ for example.

Which made me stop and think - maybe that’s available in the API in some way. Or, maybe, whatever magic gitlab uses to generate that Visualize view is available as a python library. Gitlab has solved the problem pretty neatly, it seems.

Versions

Please select whether options apply, and add the version information.

Versions

  • GitLab 15.05.ee