Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions cmd/opm/alpha/render-graph/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,32 @@ func NewCmd() *cobra.Command {
Short: "Generate mermaid-formatted view of upgrade graph of operators in an index",
Long: `Generate mermaid-formatted view of upgrade graphs of operators in an index`,
Args: cobra.MinimumNArgs(1),
Example: `
#
# Output channel graph of a catalog in mermaid format
#
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest

#
# Output channel graph of a catalog and generate a scaled vector graphic (SVG) representation
# Note: this pipeline filters out the comments about lacking skipRange support
#
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest | \
grep -Ev '^<!--.*$' | \
docker run --rm -i -v "$PWD":/data ghcr.io/mermaid-js/mermaid-cli/mermaid-cli -o /data/operatorhubio-catalog.svg

# Note: mermaid has a default maxTextSize of 30 000 characters. To override this, generate a JSON-formatted initialization file for
# mermaid like this (using 300 000 for the limit):
$ cat << EOF > ./mermaid.json
{ "maxTextSize": 300000 }
EOF
# and then pass the file for initialization configuration, via the '-c' option, like:
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest | \
grep -Ev '^<!--.*$' | \
docker run --rm -i -v "$PWD":/data ghcr.io/mermaid-js/mermaid-cli/mermaid-cli -c /data/mermaid.json -o /data/operatorhubio-catalog.svg


`,
Run: func(cmd *cobra.Command, args []string) {
// The bundle loading impl is somewhat verbose, even on the happy path,
// so discard all logrus default logger logs. Any important failures will be
Expand Down