Skip to content

Commit 182b027

Browse files
pdxjohnnybrent-wat
authored andcommitted
doc: Document branching strategy
Co-authored-by: Brent Watkins <[email protected]> Signed-off-by: John Andersen <[email protected]>
1 parent 027926b commit 182b027

File tree

1 file changed

+305
-0
lines changed

1 file changed

+305
-0
lines changed

doc/branching_strategy.md

Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
# Branching Strategy
2+
3+
This document is purely for educational purposes to better understand the
4+
rational behind when new release branches are created and how and when patches
5+
are applied to them.
6+
7+
Several senarios are covered to help the reader understand when new release get
8+
created from existing branches versus when new releases get created from new
9+
branches.
10+
11+
## NB
12+
13+
The version numbers used in this document are for example
14+
purposes only, please see offical guidance for that the current
15+
supported branches are.
16+
17+
## References
18+
19+
- https://trunkbaseddevelopment.com/branch-for-release/
20+
21+
## Basic release flow
22+
23+
No users, no bugs, just incrementing off main branch
24+
25+
```mermaid
26+
graph TD
27+
subgraph users[Users]
28+
user_a[User A]
29+
user_b[User B]
30+
end
31+
32+
subgraph source_branches[Branches in Git repo]
33+
subgraph main_history
34+
a27dbae3[a27dbae3 - feat]
35+
e13eb557[e13eb557 - fix]
36+
d18973ae[d18973ae - feat]
37+
main[Current HEAD of main]
38+
39+
a27dbae3 --> e13eb557
40+
e13eb557 --> d18973ae
41+
d18973ae --> main
42+
end
43+
end
44+
45+
subgraph release_tags[Release tags]
46+
subgraph release_tag_branch_1_x[Release tags from 1.x branch]
47+
subgraph release_tag_branch_1_0_x[Release tags from 1.0.x branch]
48+
1_0_0[v1.0.0]
49+
1_0_1[v1.0.1]
50+
end
51+
subgraph release_tag_branch_1_1_x[Release tags from 1.1.x branch]
52+
1_1_0[v1.1.0]
53+
end
54+
end
55+
end
56+
57+
subgraph release_branches[Release branches]
58+
subgraph release_branch_1_x[Release branch 1.x]
59+
subgraph release_branch_1_0_x[Release branch 1.0.x]
60+
release_branch_1_0_x_a27dbae3[a27dbae3]
61+
release_branch_1_0_x_e13eb557[e13eb557]
62+
63+
release_branch_1_0_x_a27dbae3 --> release_branch_1_0_x_e13eb557
64+
65+
release_branch_1_0_x_a27dbae3 --> 1_0_0
66+
release_branch_1_0_x_e13eb557 --> 1_0_1
67+
end
68+
69+
subgraph release_branch_1_1_x[Release branch 1.1.x]
70+
release_branch_1_1_x_d18973ae[d18973ae]
71+
72+
release_branch_1_0_x_e13eb557 --> release_branch_1_1_x_d18973ae
73+
74+
release_branch_1_1_x_d18973ae --> 1_1_0
75+
end
76+
end
77+
end
78+
79+
1_0_1 --> user_a
80+
1_1_0 --> user_b
81+
82+
a27dbae3 --> release_branch_1_0_x_a27dbae3
83+
e13eb557 --> release_branch_1_0_x_e13eb557
84+
d18973ae --> release_branch_1_1_x_d18973ae
85+
```
86+
87+
## Bugfix in older supported branch
88+
89+
Two supported branches. 1.0.x and 1.1.x. User A is using
90+
1.0.1 and finds a bug, the bug is no longer present in main
91+
due to a refactor from introducing a feature (`d18973ae`) causing it
92+
to not have been present in 1.1.0.
93+
94+
The user reports the bug, we root cause and implement a fix,
95+
we apply the fix to the 1.0.x branch creating tag v1.0.2.
96+
97+
```mermaid
98+
graph TD
99+
subgraph users[Users]
100+
user_a[User A]
101+
user_b[User B]
102+
end
103+
104+
subgraph bugs[Bugs]
105+
subgraph null_pointer_dereference[Null Pointer Dereference]
106+
null_pointer_dereference_found_in[Found]
107+
null_pointer_dereference_fix_in[Fixed]
108+
109+
null_pointer_dereference_found_in --> null_pointer_dereference_fix_in
110+
end
111+
end
112+
113+
subgraph source_branches[Branches in Git repo]
114+
subgraph main_history
115+
a27dbae3[a27dbae3 - feat]
116+
e13eb557[e13eb557 - fix]
117+
d18973ae[d18973ae - feat]
118+
main[Current HEAD of main]
119+
120+
a27dbae3 --> e13eb557
121+
e13eb557 --> d18973ae
122+
d18973ae --> main
123+
end
124+
end
125+
126+
subgraph release_tags[Release tags]
127+
subgraph release_tag_branch_1_0_x[Release tags from 1.0.x branch]
128+
1_0_0[v1.0.0]
129+
1_0_1[v1.0.1]
130+
1_0_2[v1.0.2]
131+
end
132+
subgraph release_tag_branch_1_1_x[Release tags from 1.1.x branch]
133+
1_1_0[v1.1.0]
134+
end
135+
end
136+
137+
subgraph release_branches[Release branches]
138+
subgraph release_branch_1_0_x[Release branch 1.0.x]
139+
release_branch_1_0_x_a27dbae3[a27dbae3]
140+
release_branch_1_0_x_e13eb557[e13eb557]
141+
release_branch_1_0_x_g47ae21d[g47ae21d]
142+
143+
release_branch_1_0_x_a27dbae3 --> release_branch_1_0_x_e13eb557
144+
release_branch_1_0_x_e13eb557 --> release_branch_1_0_x_g47ae21d
145+
146+
release_branch_1_0_x_a27dbae3 --> 1_0_0
147+
release_branch_1_0_x_e13eb557 --> 1_0_1
148+
release_branch_1_0_x_g47ae21d --> 1_0_2
149+
end
150+
151+
subgraph release_branch_1_1_x[Release branch 1.1.x]
152+
release_branch_1_1_x_d18973ae[d18973ae]
153+
154+
release_branch_1_0_x_e13eb557 --> release_branch_1_1_x_d18973ae
155+
156+
release_branch_1_1_x_d18973ae --> 1_1_0
157+
end
158+
end
159+
160+
a27dbae3 --> release_branch_1_0_x_a27dbae3
161+
e13eb557 --> release_branch_1_0_x_e13eb557
162+
d18973ae --> release_branch_1_1_x_d18973ae
163+
164+
1_0_1 -->|Containing null pointer dereference| user_a
165+
1_1_0 --> user_b
166+
167+
user_a -->|Using v1.0.1| null_pointer_dereference_found_in
168+
null_pointer_dereference_fix_in --> release_branch_1_0_x_g47ae21d
169+
170+
1_0_2 -->|Fix Null Pointer Dereference| user_a
171+
```
172+
173+
174+
## New minor release
175+
176+
We have two branches we are supporting
177+
178+
- `1.1.x` is the latest and greatest. We recently saw the `v1.1.0` commit cut
179+
from `main~1` (`d18973ae`). A recent user, User B, has been using this
180+
`v1.1.0` release.
181+
182+
- `1.0.x` this is our stable release branch. Our initial user, User A, has been
183+
using this `1.0` minor version due to their usage of an unexposed API which
184+
was removed in main during a refactor while introducing a feature
185+
(`d18973ae`). We care about keeping them on as a user and therefore we
186+
continue to support the `1.0` branch.
187+
188+
User B finds a bug in `v1.1.0` which was determinted to be fixed within the
189+
refactor that happened when we introduced a new feature in the most recent
190+
commit to main (`e7612ba4`). We cannot create a `v1.1.1` because something we
191+
did in the refactor while introducing the latest new feature in main made it so
192+
that we are unable to reproduce the bug. Therefore, we cannot create a fix and
193+
cherry-pick it to the `1.1.x` branch.
194+
195+
We are faced with a choice about if we want to support yet another one-off
196+
branch for User B, similarly to what we are doing with User A, where we made
197+
them a patch (`g47ae21d`) to fix an issue that was only in the branch their
198+
releases come from (`1.0.x`) and had been resolved in main. Or if we want to cut
199+
a new minor release branch off of main.
200+
201+
We talk to User B and they inform us they are not using any internal APIs. This
202+
means that both our project and User B understand that when we follow Semantic
203+
Versioning, so long as users stick to exposed API calls, we won't make changes
204+
between minor versions which will break their calling of our exposed APIs.
205+
206+
We proceed to declare the `1.1.x` branch unsupported, and cut the `1.2.x`
207+
branch off of `main` at `e7612ba4`. User B then updates their usage to pull in
208+
the `v1.2.0` version of our software.
209+
210+
```mermaid
211+
graph TD
212+
subgraph users[Users]
213+
user_a[User A]
214+
user_b[User B]
215+
end
216+
217+
subgraph bugs[Bugs]
218+
subgraph null_pointer_dereference[Null Pointer Dereference]
219+
null_pointer_dereference_found_in[Found]
220+
null_pointer_dereference_fix_in[Fixed]
221+
222+
null_pointer_dereference_found_in --> null_pointer_dereference_fix_in
223+
end
224+
subgraph input_validation[Input Validation]
225+
input_validation_found_in[Found]
226+
end
227+
end
228+
229+
subgraph source_branches[Branches in Git repo]
230+
subgraph main_history
231+
a27dbae3[a27dbae3 - feat]
232+
e13eb557[e13eb557 - fix]
233+
d18973ae[d18973ae - feat]
234+
e7612ba4[e7612ba4 - feat]
235+
main[Current HEAD of main]
236+
237+
a27dbae3 --> e13eb557
238+
e13eb557 --> d18973ae
239+
d18973ae --> e7612ba4
240+
e7612ba4 --> main
241+
end
242+
end
243+
244+
subgraph release_tags[Release tags]
245+
subgraph release_tag_branch_1_0_x[Release tags from 1.0.x branch]
246+
1_0_0[v1.0.0]
247+
1_0_1[v1.0.1]
248+
1_0_2[v1.0.2]
249+
end
250+
subgraph release_tag_branch_1_1_x[Release tags from 1.1.x branch]
251+
1_1_0[v1.1.0]
252+
end
253+
subgraph release_tag_branch_1_2_x[Release tags from 1.2.x branch]
254+
1_2_0[v1.2.0]
255+
end
256+
end
257+
258+
subgraph release_branches[Release branches]
259+
subgraph release_branch_1_0_x[Release branch 1.0.x]
260+
release_branch_1_0_x_a27dbae3[a27dbae3]
261+
release_branch_1_0_x_e13eb557[e13eb557]
262+
release_branch_1_0_x_g47ae21d[g47ae21d]
263+
264+
release_branch_1_0_x_a27dbae3 --> release_branch_1_0_x_e13eb557
265+
release_branch_1_0_x_e13eb557 --> release_branch_1_0_x_g47ae21d
266+
267+
release_branch_1_0_x_a27dbae3 --> 1_0_0
268+
release_branch_1_0_x_e13eb557 --> 1_0_1
269+
release_branch_1_0_x_g47ae21d --> 1_0_2
270+
end
271+
272+
subgraph release_branch_1_1_x[Release branch 1.1.x]
273+
release_branch_1_1_x_d18973ae[d18973ae]
274+
275+
release_branch_1_0_x_e13eb557 --> release_branch_1_1_x_d18973ae
276+
277+
release_branch_1_1_x_d18973ae --> 1_1_0
278+
end
279+
280+
subgraph release_branch_1_2_x[Release branch 1.2.x]
281+
release_branch_1_2_x_e7612ba4[e7612ba4]
282+
283+
release_branch_1_1_x_d18973ae --> release_branch_1_2_x_e7612ba4
284+
e7612ba4 --> release_branch_1_2_x_e7612ba4
285+
286+
release_branch_1_2_x_e7612ba4 --> 1_2_0
287+
end
288+
end
289+
290+
a27dbae3 --> release_branch_1_0_x_a27dbae3
291+
e13eb557 --> release_branch_1_0_x_e13eb557
292+
d18973ae --> release_branch_1_1_x_d18973ae
293+
294+
1_0_1 -->|Containing null pointer dereference| user_a
295+
1_1_0 -->|Containing input validation issue| user_b
296+
297+
user_a -->|Using v1.0.1| null_pointer_dereference_found_in
298+
null_pointer_dereference_fix_in --> release_branch_1_0_x_g47ae21d
299+
300+
user_b -->|Using v1.1.0| input_validation_found_in
301+
input_validation_found_in -->|Fixed during refactor from| e7612ba4
302+
303+
1_0_2 -->|Fix Null Pointer Dereference| user_a
304+
1_2_0 -->|Fix Input Validation issue| user_b
305+
```

0 commit comments

Comments
 (0)