Skip to content

Commit 60d5034

Browse files
committed
examples for opm alpha render-graph to generate channel graph images (#1012)
* examples for to generate channel graph images * added details for how to avoid mermaid's maxTextSize limits * fixing comment * revised for the new render-graph command Signed-off-by: Jordan Keister <[email protected]> Upstream-commit: 7470c35da86316cbd44f663a45048c3d73edd3b6 Upstream-repository: operator-registry
1 parent 130a8d2 commit 60d5034

File tree

2 files changed

+52
-0
lines changed
  • staging/operator-registry/cmd/opm/alpha/render-graph
  • vendor/github.com/operator-framework/operator-registry/cmd/opm/alpha/render-graph

2 files changed

+52
-0
lines changed

staging/operator-registry/cmd/opm/alpha/render-graph/cmd.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ func NewCmd() *cobra.Command {
2222
Short: "Generate mermaid-formatted view of upgrade graph of operators in an index",
2323
Long: `Generate mermaid-formatted view of upgrade graphs of operators in an index`,
2424
Args: cobra.MinimumNArgs(1),
25+
Example: `
26+
#
27+
# Output channel graph of a catalog in mermaid format
28+
#
29+
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest
30+
31+
#
32+
# Output channel graph of a catalog and generate a scaled vector graphic (SVG) representation
33+
# Note: this pipeline filters out the comments about lacking skipRange support
34+
#
35+
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest | \
36+
grep -Ev '^<!--.*$' | \
37+
docker run --rm -i -v "$PWD":/data ghcr.io/mermaid-js/mermaid-cli/mermaid-cli -o /data/operatorhubio-catalog.svg
38+
39+
# Note: mermaid has a default maxTextSize of 30 000 characters. To override this, generate a JSON-formatted initialization file for
40+
# mermaid like this (using 300 000 for the limit):
41+
$ cat << EOF > ./mermaid.json
42+
{ "maxTextSize": 300000 }
43+
EOF
44+
# and then pass the file for initialization configuration, via the '-c' option, like:
45+
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest | \
46+
grep -Ev '^<!--.*$' | \
47+
docker run --rm -i -v "$PWD":/data ghcr.io/mermaid-js/mermaid-cli/mermaid-cli -c /data/mermaid.json -o /data/operatorhubio-catalog.svg
48+
49+
50+
`,
2551
Run: func(cmd *cobra.Command, args []string) {
2652
// The bundle loading impl is somewhat verbose, even on the happy path,
2753
// so discard all logrus default logger logs. Any important failures will be

vendor/github.com/operator-framework/operator-registry/cmd/opm/alpha/render-graph/cmd.go

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)