Skip to content

Commit bbad667

Browse files
committed
architecture: preface it with some diagrams
A picture says more than a thousand words, they say. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ae21a4f commit bbad667

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

content/architecture.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,83 @@
11
---
22
title: The architecture of GitGitGadget
33
---
4+
5+
The essence of GitGitGadget can be illustrated by this diagram
6+
7+
```mermaid
8+
graph LR
9+
user["user (contributor)"]
10+
pr-repo["pr-repo (GitGitGadget-enabled GitHub repo)"]
11+
GitGitGadget["GitGitGadget"]
12+
mailing-list["mailing-list"]
13+
14+
user -->|"opens PR"| pr-repo
15+
16+
pr-repo -->|"slash commands"| GitGitGadget
17+
18+
GitGitGadget -->|"sends patch series"| mailing-list
19+
```
20+
21+
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`.
22+
23+
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).
24+
25+
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.
26+
27+
28+
```mermaid
29+
graph TD
30+
user["user (contributor)"]
31+
upstream-repo("upstream-repo (authoritative project repo)")
32+
pr-repo("pr-repo (GitGitGadget-enabled GitHub repo)")
33+
test-repo("test-repo (fork that is strictly for testing, optional)")
34+
GitGitGadget{"GitGitGadget"}
35+
gitgitgadget-github-app-repo("gitgitgadget-github-app-repo")
36+
azure-function
37+
gitgitgadget-workflows-repo("gitgitgadget-workflows-repo")
38+
gitgitgadget-repo("gitgitgadget-repo")
39+
mailing-list["mailing-list"]
40+
mailing-list-repo("mailing-list-repo")
41+
mailing-list-repo-mirror("mailing-list-repo-mirror")
42+
43+
user -->|"opens PR"| pr-repo
44+
user -->|"opens PR"| upstream-repo
45+
user -->|"opens PR"| test-repo
46+
47+
upstream-repo -->|"GitGitGadget syncs branches to"| pr-repo
48+
49+
pr-repo -->|"slash commands"| GitGitGadget
50+
upstream-repo -->|"slash commands (if App installed)"| GitGitGadget
51+
test-repo -->|"slash commands (only test-repo owner allowed)"| GitGitGadget
52+
53+
GitGitGadget -->|"sends patch series"| mailing-list
54+
GitGitGadget -->|"runs in"| gitgitgadget-workflows-repo
55+
gitgitgadget-workflows-repo -->|"uses GitHub Actions from"| gitgitgadget-repo
56+
57+
pr-repo -->|"webhook events"| azure-function
58+
upstream-repo -->|"webhook events (if App installed)"| azure-function
59+
test-repo -->|"webhook events"| azure-function
60+
mailing-list-repo-mirror -->|"webhook events"| azure-function
61+
62+
gitgitgadget-github-app-repo -->|"deploys to"| azure-function
63+
64+
azure-function -->|"triggers"| GitGitGadget
65+
66+
mailing-list -->|public-inbox| mailing-list-repo
67+
mailing-list-repo -->|"GitGitGadget syncs to"| mailing-list-repo-mirror
68+
mailing-list-repo-mirror -->|"GitGitGadget mirrors replies to"| pr-repo
69+
mailing-list-repo-mirror -->|"GitGitGadget mirrors replies to (if App installed)"| upstream-repo
70+
mailing-list-repo-mirror -->|"GitGitGadget mirrors replies to"| test-repo
71+
72+
%% Some styling
73+
classDef user fill:#77f;
74+
class user user
75+
classDef repo fill:#fb7,stroke:#333,stroke-width:2px;
76+
class gitgitgadget-github-app-repo,gitgitgadget-workflows-repo,gitgitgadget-repo,mailing-list-repo,mailing-list-repo-mirror repo
77+
classDef pr fill:#ea6,stroke:#333,stroke-width:4px;
78+
class upstream-repo,pr-repo,test-repo pr
79+
```
80+
481
# How does GitGitGadget process user comments on PRs?
582

683
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`).

layouts/_default/baseof.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,10 @@
1212
{{ .Content }}
1313
{{ end }}
1414
</body>
15+
{{ if .Store.Get "hasMermaid" }}
16+
<script type="module">
17+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
18+
mermaid.initialize({ startOnLoad: true });
19+
</script>
20+
{{ end }}
1521
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<pre class="mermaid">
2+
{{ .Inner | htmlEscape | safeHTML }}
3+
</pre>
4+
{{ .Page.Store.Set "hasMermaid" true }}

0 commit comments

Comments
 (0)