@@ -59,24 +59,52 @@ When triggered manually it will _not_ push the images to the registry.
5959
6060Many products apply Stackable-specific patches, managed by [ Patchable] ( rust/patchable ) .
6161
62+ Patchable doesn't _ edit_ anything by itself. Instead, it's a uniform way to apply a set of patches
63+ to an upstream Git repository, and then export your local changes back into patch files.
64+ You can then edit the branch created by patchable using any Git frontend, such as the git CLI or
65+ [ jj] ( https://jj-vcs.github.io/jj/latest/ ) .
66+
67+ This way, the patch files are the global source of truth and track the history of our patch series,
68+ while you can still use the same familiar Git tools to manipulate them.
69+
6270### Check out patched sources locally
6371
64- This is not required for building the images, but is useful when debugging or hacking on our patch sets.
72+ > [ !NOTE]
73+ > This is not required for building images, but is used for when hacking on or debugging patch series.
6574
6675``` sh
67- cd $( cargo patchable checkout druid 26.0.0)
68- ```
76+ # Fetches the upstream repository (if required), and creates a git worktree to work with it
77+ # It also creates two branches:
78+ # - patchable/{version} (HEAD, has all patches applied)
79+ # - patchable/base/{version} (the upstream)
80+ pushd $( cargo patchable checkout druid 26.0.0)
6981
70- ### Save patched sources
82+ # Commit to add new patches
83+ git commit
7184
72- ``` sh
85+ # Rebase against the base commit to edit or remove patches
86+ git rebase --interactive patchable/base/26.0.0
87+ # jj edit also works, but make sure to go back to the tip before exporting
88+
89+ # When done, export your patches and commit them (to docker-images)
90+ popd
7391cargo patchable export druid 26.0.0
92+ git status
7493```
7594
95+ > ![ IMPORTANT]
96+ > ` cargo patchable export ` exports whatever is currently checked out (` HEAD ` ) in the worktree.
97+ > If you use ` jj edit ` (or ` git switch ` ) then you _ must_ go back to the tip before exporting, or
98+ > any patches after that point will be omitted from the export.
99+
76100### Initialize a new patch series
77101
102+ Patchable stores metadata about each patch series in its ` patchable.toml ` , and will not be able to check out
103+ a patch series that lacks one. It can be generated using ` cargo patchable init ` :
104+
78105``` sh
79106cargo patchable init druid 28.0.0 --upstream https://github.com/apache/druid.git --base druid-28.0.0
107+ cargo patchable checkout druid 28.0.0
80108```
81109
82110### Importing patch series into Patchable
@@ -116,17 +144,31 @@ cargo patchable init druid 28.0.0 --upstream https://github.com/apache/druid.git
116144# Create and go to the worktree for the new version
117145pushd $( cargo patchable checkout druid 28.0.0)
118146
119- # Rebase the patch series
147+ # Cherry pick the old patch series
120148git cherry-pick patchable/base/26.0.0..patchable/26.0.0
121149# Solve conflicts and `git cherry-pick --continue` until done
122- # You can also use `git cherry-pick --skip` to skip patches that are no longer required
150+ # You can also use `git cherry-pick --skip` to skip resolving conflicts for patches that are no longer required
151+
152+ # If some patches are no longer required, use an interactive rebase to remove them (or do other cleanup)
153+ git rebase --interactive patchable/base/28.0.0
123154
124155# Leave and export the new patch series!
125156popd
126157cargo patchable export druid 28.0.0
127158git status
128159```
129160
161+ ### Porting patches between versions
162+
163+ Individual patches can also be cherry-picked across versions.
164+
165+ For example, assuming we are in the Druid 28.0.0 workspace and want to port the last patch of the Druid 26.0.0 series:
166+
167+ ``` sh
168+ # git cherry-pick <hash> is also fine for grabbing arbitrary patches
169+ git cherry-pick patchable/26.0.0
170+ ```
171+
130172## Verify Product Images
131173
132174To verify if Apache Zookeeper validate against OpenShift preflight, run:
0 commit comments