feat(graph): pipeline graph improvements — on_failure, tooltips, bus-bar connectors, skipped colouring, HTML and Mermaid output
- when: on_failure visual distinction: red circle (#d9534f), X-mark icon, dashed chip border, and Mermaid classDef; legend entry added - Job tooltip / detail panel: each chip wrapped in <g data-job="…"><title>…</title> <desc>…</desc> so SVG viewers and the HTML sidebar show stage, when, image, needs - Multi-job connector accuracy: classic mode now uses a bus-bar pattern (vertical rail at midpoint + per-job stubs) instead of one center-to-center line per stage pair - Blocked/skipped state colouring: RenderPipeline and pipelineSVG accept *cicontext.Context; skipped jobs rendered in grey (#868686) with dimmed text - Interactive HTML output (--format html): self-contained .html with inline SVG, mouse-wheel zoom, drag-to-pan, double-click reset, and a click-to-open sidebar - Mermaid pipeline output (--format mermaid): prints existing Pipeline() flowchart to stdout; suitable for mermaid.live or Markdown embedding - imageString() helper to extract image name from string or map form - 100% statement coverage maintained; 809 tests pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+33
-8
@@ -445,7 +445,8 @@ func cmdGraph(args []string) {
|
||||
gitlabURL := fs.String("gitlab-url", "", "GitLab instance URL (overrides CI_SERVER_URL / GITLAB_URL)")
|
||||
cacheDir := fs.String("cache-dir", "", "directory to cache fetched remote includes (created if needed)")
|
||||
offline := fs.Bool("offline", false, "skip all network calls; serve only from --cache-dir")
|
||||
out := fs.String("out", "glint-out", "output directory for Mermaid graph files (pipeline mode)")
|
||||
out := fs.String("out", "glint-out", "output directory for rendered graph files (pipeline mode)")
|
||||
format := fs.String("format", "svg", "pipeline output format: svg, mermaid, or html")
|
||||
fs.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "glint %s\n\n", version)
|
||||
fmt.Fprint(os.Stderr, `Visualise the pipeline as a job tree and/or Mermaid graph.
|
||||
@@ -462,6 +463,15 @@ Options:
|
||||
Output directory for rendered graph files.
|
||||
Used by the pipeline and all modes only. [default: glint-out]
|
||||
|
||||
--format <FORMAT>
|
||||
Output format for pipeline mode: svg (default), mermaid, or html.
|
||||
svg: write a GitLab CI-style SVG/PNG to --out (converted to PNG
|
||||
when rsvg-convert, inkscape, or magick is available).
|
||||
mermaid: print a Mermaid flowchart to stdout (paste into mermaid.live).
|
||||
html: write a self-contained HTML file with pan/zoom and a
|
||||
job-detail sidebar to --out.
|
||||
[default: svg] [possible values: svg, mermaid, html]
|
||||
|
||||
--token <TOKEN>
|
||||
GitLab personal access token. Used to fetch remote project: includes
|
||||
when building the include dependency graph.
|
||||
@@ -518,6 +528,8 @@ Examples:
|
||||
glint graph includes .gitlab-ci.yml > includes.mmd
|
||||
glint graph pipeline .gitlab-ci.yml
|
||||
glint graph pipeline --out /tmp/graphs .gitlab-ci.yml
|
||||
glint graph pipeline --format mermaid .gitlab-ci.yml
|
||||
glint graph pipeline --format html .gitlab-ci.yml
|
||||
glint graph all .gitlab-ci.yml > includes.mmd
|
||||
`)
|
||||
}
|
||||
@@ -602,16 +614,29 @@ Examples:
|
||||
case "includes":
|
||||
fmt.Print(graph.Includes(path, p.Include, cfg))
|
||||
case "pipeline":
|
||||
outPath, err := graph.RenderPipeline(p, *out)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: rendering pipeline graph: %v\n", err)
|
||||
exit(2)
|
||||
return
|
||||
switch *format {
|
||||
case "mermaid":
|
||||
fmt.Print(graph.Pipeline(p))
|
||||
case "html":
|
||||
outPath, err := graph.RenderHTML(p, *out, ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: rendering pipeline graph: %v\n", err)
|
||||
exit(2)
|
||||
return
|
||||
}
|
||||
fmt.Println(outPath)
|
||||
default: // "svg"
|
||||
outPath, err := graph.RenderPipeline(p, *out, ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: rendering pipeline graph: %v\n", err)
|
||||
exit(2)
|
||||
return
|
||||
}
|
||||
fmt.Println(outPath)
|
||||
}
|
||||
fmt.Println(outPath)
|
||||
case "all":
|
||||
fmt.Print(graph.Includes(path, p.Include, cfg))
|
||||
outPath, err := graph.RenderPipeline(p, *out)
|
||||
outPath, err := graph.RenderPipeline(p, *out, ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: rendering pipeline graph: %v\n", err)
|
||||
exit(2)
|
||||
|
||||
Reference in New Issue
Block a user