Skip to content

Commit 3a064ae

Browse files
committed
architecture: preface it with some diagrams
A picture says more than a thousand words, they say. Note: I originally intended to add two Mermaid diagrams. It turned out, though, that there is too little control over the layout using that method, and I turned to a much more complex yet equally more satisfying solution: Graphviz. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5ceac84 commit 3a064ae

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

content/architecture.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,98 @@
11
---
22
title: The architecture of GitGitGadget
33
---
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,rounded"];
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 [label=" 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+
fontsize=10;
46+
sep="+4.5";
47+
48+
node [fontname="Arial", shape=box, style="filled,rounded"];
49+
edge [fontname="Arial", fontsize=7];
50+
51+
// Node styles
52+
user [label="user (Git contributor)", fillcolor="#7777ff"];
53+
upstream_repo [label="upstream-repo", fillcolor="#eaa666", penwidth=2];
54+
pr_repo [label="pr-repo", fillcolor="#eaa666", penwidth=2];
55+
test_repo [label="test-repo", fillcolor="#eaa666", penwidth=2];
56+
57+
GitGitGadget [label="GitGitGadget", fillcolor="#ffffff"];
58+
gitgitgadget_github_app_repo [label="gitgitgadget-github-app-repo", fillcolor="#fb7", penwidth=2];
59+
azure_function [label="azure-function", fillcolor="#ffffff"];
60+
gitgitgadget_workflows_repo [label="gitgitgadget-workflows-repo", fillcolor="#fb7", penwidth=2];
61+
gitgitgadget_repo [label="gitgitgadget-repo", fillcolor="#fb7", penwidth=2];
62+
mailing_list [label="mailing-list", fillcolor="#ffffff"];
63+
mailing_list_repo [label="mailing-list-repo", fillcolor="#fb7", penwidth=2];
64+
mailing_list_repo_mirror [label="mailing-list-repo-mirror", fillcolor="#fb7", penwidth=2];
65+
66+
user -> pr_repo;
67+
user -> upstream_repo;
68+
user -> test_repo [taillabel=" opens PR"];
69+
70+
upstream_repo -> pr_repo [label="syncs branches"];
71+
pr_repo -> GitGitGadget [label="slash commands"];
72+
upstream_repo -> GitGitGadget [label="slash commands\n(App)"];
73+
test_repo -> GitGitGadget [label="slash commands\n(owner only)"];
74+
75+
GitGitGadget -> mailing_list [label="sends patch series"];
76+
GitGitGadget -> gitgitgadget_workflows_repo [label="runs in"];
77+
gitgitgadget_workflows_repo -> gitgitgadget_repo [label="uses Actions"];
78+
79+
pr_repo -> azure_function;
80+
upstream_repo -> azure_function [label="webhook"];
81+
test_repo -> azure_function [headlabel="webhook"];
82+
mailing_list_repo_mirror -> azure_function [headlabel="\nwebhook"];
83+
84+
gitgitgadget_github_app_repo -> azure_function [label="deploys to"];
85+
azure_function -> GitGitGadget [label="triggers"];
86+
87+
mailing_list -> mailing_list_repo [label="public-inbox"];
88+
mailing_list_repo -> mailing_list_repo_mirror [label="syncs to"];
89+
90+
mailing_list_repo_mirror -> pr_repo [label="mirrors\nreplies"];
91+
mailing_list_repo_mirror -> upstream_repo;
92+
mailing_list_repo_mirror -> test_repo;
93+
}
94+
```
95+
496
# How does GitGitGadget process user comments on PRs?
597

698
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

Comments
 (0)