{"id":15666491,"url":"https://github.com/sergk/tkn-graph","last_synced_at":"2025-04-12T21:35:41.868Z","repository":{"id":198008407,"uuid":"699821448","full_name":"SergK/tkn-graph","owner":"SergK","description":"Output Tekton Tasks dependencies based on the Tekton kind: Pipeline and kind: PipelineRun","archived":false,"fork":false,"pushed_at":"2025-03-13T01:43:11.000Z","size":351,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T15:48:06.412Z","etag":null,"topics":["ci","ci-pipeline","cicd","devops","graph","kubernetes","pipeline","tekton","tekton-dashboard","tekton-pipelines","tekton-tasks","tektoncd"],"latest_commit_sha":null,"homepage":"https://docs.kuberocketci.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SergK.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-03T12:11:14.000Z","updated_at":"2025-02-13T22:54:21.000Z","dependencies_parsed_at":"2024-03-14T09:31:35.303Z","dependency_job_id":"5ad2b665-6393-42cc-97b9-8c77c7dbdee4","html_url":"https://github.com/SergK/tkn-graph","commit_stats":{"total_commits":67,"total_committers":2,"mean_commits":33.5,"dds":0.05970149253731338,"last_synced_commit":"a338c0e9e06eae4f058e08225d0776dfb201b1a0"},"previous_names":["sergk/tkn-graph"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergK%2Ftkn-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergK%2Ftkn-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergK%2Ftkn-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergK%2Ftkn-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SergK","download_url":"https://codeload.github.com/SergK/tkn-graph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637187,"owners_count":21137530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","ci-pipeline","cicd","devops","graph","kubernetes","pipeline","tekton","tekton-dashboard","tekton-pipelines","tekton-tasks","tektoncd"],"created_at":"2024-10-03T14:00:44.089Z","updated_at":"2025-04-12T21:35:41.846Z","avatar_url":"https://github.com/SergK.png","language":"Go","readme":"[![Release Version](https://img.shields.io/github/v/release/sergk/tkn-graph?label=tkn-graph)](https://github.com/sergk/tkn-graph/releases/latest)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=sergk_tkn-graph\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=sergk_tkn-graph)\n[![Go Report Card](https://goreportcard.com/badge/github.com/sergk/tkn-graph)](https://goreportcard.com/report/github.com/sergk/tkn-graph)\n\n\u003c!-- TOC --\u003e\n\n- [Tekton Graph](#tekton-graph)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n    - [Downloading the Binary](#downloading-the-binary)\n    - [Building from Source](#building-from-source)\n  - [Usage](#usage)\n    - [Run the Command](#run-the-command)\n    - [Examples](#examples)\n    - [Output](#output)\n  - [Contributing](#contributing)\n  - [License](#license)\n\n\u003c!-- /TOC --\u003e\n\n# Tekton Graph\n\nThe provided Go program is a command-line tool named `tkn-graph` for generating graphs from Tekton Customer Resources: `Pipeline` and `PipelineRun`. This tool is used to visualize the structure and relationships between tasks of Tekton `Pipelines` and `PipelineRuns` by creating output in [PlantUML](https://plantuml.com/), [Mermaid](https://mermaid.js.org/) and [Dot (GraphViz)](https://graphviz.org/doc/info/lang.html).\n\n## Prerequisites\n\nBefore using the `tkn-graph` tool, you should ensure you have the following prerequisites:\n\n1. **Kubernetes Cluster**: You need access to a running Kubernetes cluster.\n\n2. **Tekton Client**: The tool uses the Tekton client to interact with Tekton resources, so you must have Tekton installed on your cluster.\n\n3. **Kubeconfig**: You should have a valid kubeconfig file configured for the cluster you want to target.\n\n## Installation\n\n### Downloading the Binary\n\nDownload the latest binary from the [releases page](https://github.com/sergk/tkn-graph/releases/latest)\n\n### Installing with Homebrew\n\nYou can install the `tkn-graph` tool using [Homebrew](https://brew.sh/):\n\n```bash\nbrew tap sergk/homebrew-tap\nbrew install sergk/tap/tkn-graph\n```\n\n### Building from Source\n\nor building locally:\n\nYou need to have Go installed on your system. Once you have Go installed, you can build the project using the following command:\n\n```bash\nmake build\n```\n\n## Usage\n\nThe `tkn-graph` tool has several command-line options and can generate different types of output graphs, such as `DOT`, `PlantUML`, or `Mermaid`. Below are the detailed steps for using the tool:\n\n### Run the Command\n\nExecute the `tkn-graph` tool from the command line with the following syntax:\n\n```bash\ntkn-graph is a command-line tool for generating graphs from Tekton Pipelines and PipelineRuns.\n\nUsage:\n  tkn-graph [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  help        Help about any command\n  pipeline    Graph pipelines\n  pipelinerun Graph PipelineRuns\n\nFlags:\n  -h, --help   help for tkn-graph\n\nUse \"tkn-graph [command] --help\" for more information about a command.\n```\n\nThe `[flags]` correspond to various options and arguments that you can provide to customize the tool's behavior. Here are the available flags:\n\n- `--output-format` (string, optional): Choose the output format for the graph. You can use \"dot\" for DOT, \"puml\" for PlantUML, or \"mmd\" for Mermaid. The default format is \"dot\"\n\n- `--output-dir` (string, optional): Specify the directory where the output files will be saved. If not provided, the output will be printed to the console.\n\n- `--with-task-ref` (boolean, optional): Include TaskRefName information in the output. This flag is useful for getting taskRef which points to original `Task`.\n\n### Examples\n\nThe `tkn-graph` tool is flexible and can be customized to meet your specific needs. Here are some example commands:\n\n- Generate a DOT format graph for Pipelines in the \"my-namespace\" namespace and print it to the screen:\n\n  ```bash\n  $ tkn-graph pipelinerun graph --namespace my-namespace --output-format dot\n\n  digraph {\n    labelloc=\"t\"\n    label=\"python-3-8-release-create-build-release-1.2-review-srrcc\"\n    end [shape=\"point\" width=0.2]\n    start [shape=\"point\" width=0.2]\n    \"compile\" -\u003e \"test\"\n    \"test\" -\u003e \"fetch-target-branch\"\n    \"dockerfile-lint\" -\u003e \"dockerbuild-verify\"\n    \"helm-lint\" -\u003e \"end\"\n    \"init-values\" -\u003e \"compile\"\n    \"start\" -\u003e \"gerrit-notify\"\n    \"gerrit-notify\" -\u003e \"end\"\n    \"helm-docs\" -\u003e \"end\"\n    \"fetch-target-branch\" -\u003e \"sonar-prepare-files\"\n    \"sonar-prepare-files\" -\u003e \"sonar\"\n    \"sonar\" -\u003e \"dockerbuild-verify\"\n    \"dockerbuild-verify\" -\u003e \"end\"\n    \"start\" -\u003e \"fetch-repository\"\n    \"fetch-repository\" -\u003e \"init-values\"\n    \"fetch-repository\" -\u003e \"helm-docs\"\n    \"fetch-repository\" -\u003e \"dockerfile-lint\"\n    \"fetch-repository\" -\u003e \"helm-lint\"\n  }\n  ```\n\n- Generate a PlantUML format graph for PipelineRuns in the \"my-namespace\" namespace and save it to a file:\n\n  ```bash\n  $ tkn-graph pipelinerun graph --namespace my-namespace --output-format puml --output-dir output\n\n  $ ls -1 output\n\n  dotnet-6-0-lib-release-create-build-release-1.2-build-fhm9j.puml\n  dotnet-6-0-lib-release-create-build-release-1.2-review-ld6d8.puml\n  java11-mvn-create-def-build-master-build-jckk4.puml\n  java11-mvn-create-def-build-master-review-rs7s5.puml\n  java17-grd-crt-edp-dep-release-1.2-build-5z5s2.puml\n  java17-grd-crt-edp-dep-release-1.2-review-qnws2.puml\n  js-create-br-edp-build-new-build-dhjg5.puml\n  js-create-br-edp-build-new-review-28rmr.puml\n  python-3-8-release-create-build-release-1.2-build-fmt6f.puml\n  python-3-8-release-create-build-release-1.2-review-rnwpq.puml\n\n  $ cat output/python-3-8-release-create-build-release-1.2-review-rnwpq.puml\n\n  @startuml\n  hide empty description\n  title python-3-8-release-create-build-release-1.2-review-rnwpq\n\n  [*] --\u003e gerrit_notify\n  init_values \u003c-down- fetch_repository\n  helm_docs \u003c-down- fetch_repository\n  [*] --\u003e fetch_repository\n  test \u003c-down- compile\n  fetch_target_branch \u003c-down- test\n  sonar_prepare_files \u003c-down- fetch_target_branch\n  sonar \u003c-down- sonar_prepare_files\n  dockerfile_lint \u003c-down- fetch_repository\n  dockerbuild_verify \u003c-down- sonar\n  dockerbuild_verify \u003c-down- dockerfile_lint\n  helm_lint \u003c-down- fetch_repository\n  compile \u003c-down- init_values\n\n  @enduml\n  ```\n\n- Generate a Mermaid format graph with TaskRef for Pipelines in the \"my-namespace\" namespace and save it to a file:\n\n  ```bash\n  $ tkn-graph pipeline graph --namespace edp-delivery-tekton-dev --output-format mmd --with-task-ref\n\n  ---\n  title: gerrit-python-python-3.8-app-build-edp\n  ---\n  flowchart TD\n    get-nexus-repository-url(\"get-nexus-repository-url\n    (get-nexus-repository-url)\") --\u003e push(\"push\n    (python)\")\n    git-tag(\"git-tag\n    (git-cli)\") --\u003e update-cbis(\"update-cbis\n    (update-cbis)\")\n    start([fa:fa-circle]) --\u003e fetch-repository(\"fetch-repository\n    (git-clone)\")\n    fetch-repository(\"fetch-repository\n    (git-clone)\") --\u003e gerrit-notify(\"gerrit-notify\n    (gerrit-ssh-cmd)\")\n    fetch-repository(\"fetch-repository\n    (git-clone)\") --\u003e init-values(\"init-values\n    (init-values)\")\n    gerrit-notify(\"gerrit-notify\n    (gerrit-ssh-cmd)\") --\u003e stop([fa:fa-circle])\n    compile(\"compile\n    (python)\") --\u003e test(\"test\n    (python)\")\n    test(\"test\n    (python)\") --\u003e sonar(\"sonar\n    (sonarqube-scanner)\")\n    get-version(\"get-version\n    (get-version-edp)\") --\u003e update-build-number(\"update-build-number\n    (update-build-number-python)\")\n    sonar-cleanup(\"sonar-cleanup\n    (sonar-cleanup)\") --\u003e stop([fa:fa-circle])\n    push(\"push\n    (python)\") --\u003e kaniko-build(\"kaniko-build\n    (kaniko)\")\n    kaniko-build(\"kaniko-build\n    (kaniko)\") --\u003e git-tag(\"git-tag\n    (git-cli)\")\n    update-cbis(\"update-cbis\n    (update-cbis)\") --\u003e stop([fa:fa-circle])\n    init-values(\"init-values\n    (init-values)\") --\u003e get-version(\"get-version\n    (get-version-edp)\")\n    init-values(\"init-values\n    (init-values)\") --\u003e sonar-cleanup(\"sonar-cleanup\n    (sonar-cleanup)\")\n    update-build-number(\"update-build-number\n    (update-build-number-python)\") --\u003e sast(\"sast\n    (sast)\")\n    sast(\"sast\n    (sast)\") --\u003e compile(\"compile\n    (python)\")\n    sonar(\"sonar\n    (sonarqube-scanner)\") --\u003e get-nexus-repository-url(\"get-nexus-repository-url\n    (get-nexus-repository-url)\")\n  ```\n\n### Output\n\nDepending on the options you provided, the tool will generate the specified graph(s) and either print them to the console or save them in the specified directory.\n\n- If you chose to print the graph, it will be displayed on the screen.\n- If you specified an output directory, the tool will save the graph(s) in that directory with filenames based on the Tekton object's name and the chosen output format.\n\nBy following these steps and customizing the flags, you can use the `tkn-graph` tool to generate representations of Tekton Pipelines and PipelineRuns within your Kubernetes cluster. The next step you can use mermaid, plantuml or dot to generate a graph.\n\n```mermaid\n---\ntitle: gerrit-python-python-3.8-app-build-edp\n---\nflowchart TD\n  get-nexus-repository-url(\"get-nexus-repository-url\n  (get-nexus-repository-url)\") --\u003e push(\"push\n  (python)\")\n  git-tag(\"git-tag\n  (git-cli)\") --\u003e update-cbis(\"update-cbis\n  (update-cbis)\")\n  start([fa:fa-circle]) --\u003e fetch-repository(\"fetch-repository\n  (git-clone)\")\n  fetch-repository(\"fetch-repository\n  (git-clone)\") --\u003e gerrit-notify(\"gerrit-notify\n  (gerrit-ssh-cmd)\")\n  fetch-repository(\"fetch-repository\n  (git-clone)\") --\u003e init-values(\"init-values\n  (init-values)\")\n  gerrit-notify(\"gerrit-notify\n  (gerrit-ssh-cmd)\") --\u003e stop([fa:fa-circle])\n  compile(\"compile\n  (python)\") --\u003e test(\"test\n  (python)\")\n  test(\"test\n  (python)\") --\u003e sonar(\"sonar\n  (sonarqube-scanner)\")\n  get-version(\"get-version\n  (get-version-edp)\") --\u003e update-build-number(\"update-build-number\n  (update-build-number-python)\")\n  sonar-cleanup(\"sonar-cleanup\n  (sonar-cleanup)\") --\u003e stop([fa:fa-circle])\n  push(\"push\n  (python)\") --\u003e kaniko-build(\"kaniko-build\n  (kaniko)\")\n  kaniko-build(\"kaniko-build\n  (kaniko)\") --\u003e git-tag(\"git-tag\n  (git-cli)\")\n  update-cbis(\"update-cbis\n  (update-cbis)\") --\u003e stop([fa:fa-circle])\n  init-values(\"init-values\n  (init-values)\") --\u003e get-version(\"get-version\n  (get-version-edp)\")\n  init-values(\"init-values\n  (init-values)\") --\u003e sonar-cleanup(\"sonar-cleanup\n  (sonar-cleanup)\")\n  update-build-number(\"update-build-number\n  (update-build-number-python)\") --\u003e sast(\"sast\n  (sast)\")\n  sast(\"sast\n  (sast)\") --\u003e compile(\"compile\n  (python)\")\n  sonar(\"sonar\n  (sonarqube-scanner)\") --\u003e get-nexus-repository-url(\"get-nexus-repository-url\n  (get-nexus-repository-url)\")\n```\n\n## Contributing\n\nIf you want to contribute to the project, you can fork the repository and create a pull request with your changes. Make sure to follow the coding style and conventions used in the project.\n\n## License\n\nThe project is licensed under the APACHE License. See the [LICENSE](./LICENSE) file for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergk%2Ftkn-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergk%2Ftkn-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergk%2Ftkn-graph/lists"}