|
1 | 1 | ---
|
2 | 2 | title: The architecture of GitGitGadget
|
3 | 3 | ---
|
| 4 | + |
| 5 | +The essence of GitGitGadget can be illustrated by this diagram |
| 6 | + |
| 7 | +```graphviz |
| 8 | +digraph GitGitGadgetFlow { |
| 9 | + rankdir="TB"; |
| 10 | + splines=true; |
| 11 | + overlap=false; |
| 12 | + fontsize=10; |
| 13 | + sep="+4.5"; |
| 14 | +
|
| 15 | + node [fontname="Arial", shape=box, style=filled]; |
| 16 | + edge [fontname="Arial", fontsize=7]; |
| 17 | +
|
| 18 | + // Node styles |
| 19 | + user [label="user (Git contributor)", fillcolor="#7777ff"]; |
| 20 | + pr_repo [label="pr-repo", fillcolor="#eaa666", penwidth=2]; |
| 21 | +
|
| 22 | + GitGitGadget [label="GitGitGadget", fillcolor="#ffffff"]; |
| 23 | +
|
| 24 | + user -> pr_repo [taillabel=" opens PR"]; |
| 25 | +
|
| 26 | + pr_repo -> GitGitGadget [label="slash commands"]; |
| 27 | +
|
| 28 | + GitGitGadget -> mailing_list [label="sends patch series"]; |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +Of course, when adding a couple of details, it gets quite a bit more complicated. For example, GitGitGadget needs write permissions on the `pr-repo`, to push the tagged patch series, and to store its state in Git notes. Most upstream projects do not like that, and therefore GitGitGadget works on a `pr-repo` which is a fork of an `upstream-repo`. However, a _read-only_ variant of GitGitGadget's GitHub App can be installed on the `upstream-repo`, in which case GitGitGadget _does_ handle PRs in the `upstream-repo` but the state and the tagged patch series still live in `pr-repo`. |
| 33 | + |
| 34 | +For testing purposes, there can also be `test-repo`, another fork of `upstream-repo` (but only the owner of the `test-repo` is allowed to use GitGitGadget there). |
| 35 | + |
| 36 | +GitGitGadget also needs access to the mailing list in the form of a [public-inbox](https://public-inbox.org/README.html) repository, to be able to mirror replies back to the PRs. |
| 37 | + |
| 38 | + |
| 39 | +```graphviz |
| 40 | +digraph GitGitGadgetFlow { |
| 41 | + layout="neato"; |
| 42 | + rankdir=TB; |
| 43 | + splines=true; |
| 44 | + overlap=false; |
| 45 | + fontname="Arial"; |
| 46 | + fontsize=10; |
| 47 | + sep="+4.5"; |
| 48 | +
|
| 49 | + node [shape=box, style=filled]; |
| 50 | + edge [fontsize=7]; |
| 51 | +
|
| 52 | + // Node styles |
| 53 | + user [label="user (Git contributor)", fillcolor="#7777ff"]; |
| 54 | + upstream_repo [label="upstream-repo", fillcolor="#eaa666", penwidth=2]; |
| 55 | + pr_repo [label="pr-repo", fillcolor="#eaa666", penwidth=2]; |
| 56 | + test_repo [label="test-repo", fillcolor="#eaa666", penwidth=2]; |
| 57 | +
|
| 58 | + GitGitGadget [label="GitGitGadget", fillcolor="#ffffff"]; |
| 59 | + gitgitgadget_github_app_repo [label="gitgitgadget-github-app-repo", fillcolor="#fb7", penwidth=2]; |
| 60 | + azure_function [label="azure-function", fillcolor="#ffffff"]; |
| 61 | + gitgitgadget_workflows_repo [label="gitgitgadget-workflows-repo", fillcolor="#fb7", penwidth=2]; |
| 62 | + gitgitgadget_repo [label="gitgitgadget-repo", fillcolor="#fb7", penwidth=2]; |
| 63 | + mailing_list [label="mailing-list", fillcolor="#ffffff"]; |
| 64 | + mailing_list_repo [label="mailing-list-repo", fillcolor="#fb7", penwidth=2]; |
| 65 | + mailing_list_repo_mirror [label="mailing-list-repo-mirror", fillcolor="#fb7", penwidth=2]; |
| 66 | +
|
| 67 | + user -> pr_repo; |
| 68 | + user -> upstream_repo; |
| 69 | + user -> test_repo [taillabel=" opens PR"]; |
| 70 | +
|
| 71 | + upstream_repo -> pr_repo [label="syncs branches"]; |
| 72 | + pr_repo -> GitGitGadget [label="slash commands"]; |
| 73 | + upstream_repo -> GitGitGadget [label="slash commands\n(App)"]; |
| 74 | + test_repo -> GitGitGadget [label="slash commands\n(owner only)"]; |
| 75 | +
|
| 76 | + GitGitGadget -> mailing_list [label="sends patch series"]; |
| 77 | + GitGitGadget -> gitgitgadget_workflows_repo [label="runs in"]; |
| 78 | + gitgitgadget_workflows_repo -> gitgitgadget_repo [label="uses Actions"]; |
| 79 | +
|
| 80 | + pr_repo -> azure_function; |
| 81 | + upstream_repo -> azure_function [label="webhook"]; |
| 82 | + test_repo -> azure_function [headlabel="webhook"]; |
| 83 | + mailing_list_repo_mirror -> azure_function [headlabel="\nwebhook"]; |
| 84 | +
|
| 85 | + gitgitgadget_github_app_repo -> azure_function [label="deploys to"]; |
| 86 | + azure_function -> GitGitGadget [label="triggers"]; |
| 87 | +
|
| 88 | + mailing_list -> mailing_list_repo [label="public-inbox"]; |
| 89 | + mailing_list_repo -> mailing_list_repo_mirror [label="syncs to"]; |
| 90 | +
|
| 91 | + mailing_list_repo_mirror -> pr_repo [label="mirrors\nreplies"]; |
| 92 | + mailing_list_repo_mirror -> upstream_repo; |
| 93 | + mailing_list_repo_mirror -> test_repo; |
| 94 | +} |
| 95 | +``` |
| 96 | + |
4 | 97 | # How does GitGitGadget process user comments on PRs?
|
5 | 98 |
|
6 | 99 | GitGitGadget is implemented as a GitHub App (with the very imaginative name ["GitGitGadget"](https://github.com/apps/gitgitgadget)), which means that a webhook is called on certain events, such as new PR comments on PRs (e.g. `issue_comment`).
|
|
0 commit comments