|
| 1 | +# Keystone Patches |
| 2 | + |
| 3 | +Patches are derived from cherry-picking patches to the stable series we follow. |
| 4 | + |
| 5 | +[https://github.com/rackerlabs/keystone] |
| 6 | + |
| 7 | +The branch for these are `understack/$OPENSTACK_VERSION` |
| 8 | + |
| 9 | +## To clone everything down do the following |
| 10 | + |
| 11 | +```bash |
| 12 | +git clone https://github.com/openstack/keystone |
| 13 | +git checkout --track origin/stable/2026.1 |
| 14 | +git remote add rackerlabs https://github.com/rackerlabs/keystone |
| 15 | +git fetch rackerlabs |
| 16 | +git checkout --track rackerlabs/understack/2026.1 |
| 17 | +``` |
| 18 | + |
| 19 | +## Adding patches is done via `git cherry-pick` |
| 20 | + |
| 21 | +```bash |
| 22 | +git checkout understack/2026.1 |
| 23 | +git cherry-pick GITISH_TO_PORT |
| 24 | +git push rackerlabs understack/2026.1 |
| 25 | +``` |
| 26 | + |
| 27 | +## Creating the next stable series |
| 28 | + |
| 29 | +```bash |
| 30 | +git checkout --track origin/stable/2026.2 |
| 31 | +git checkout -b understack/2026.2 |
| 32 | +``` |
| 33 | + |
| 34 | +## Rebasing to keep things clean |
| 35 | + |
| 36 | +The `scripts/git-understack-rebase` script in the understack repo automates this: it checks your |
| 37 | +remotes and branches, shows you the commits involved, performs the rebase, and force-pushes both |
| 38 | +branches to `rackerlabs` after you confirm each step. It expects a remote named `upstream` |
| 39 | +(pointing at `openstack/keystone`, not `origin`) and a remote named `rackerlabs`. |
| 40 | + |
| 41 | +```bash |
| 42 | +scripts/git-understack-rebase ~/work/keystone 2026.1 |
| 43 | +``` |
| 44 | + |
| 45 | +### Patches that landed upstream (possibly tweaked) |
| 46 | + |
| 47 | +Before rebasing, the script checks whether any patch we carry has since landed |
| 48 | +in `upstream/stable/$VERSION`. It matches on the Gerrit `Change-Id:` trailer, |
| 49 | +which survives cherry-picking, so it recognizes our copy of a change even if the |
| 50 | +content drifted. It then splits the matches into two groups: |
| 51 | + |
| 52 | +- **identical** — same content as upstream. `git rebase` drops these on its own; |
| 53 | + the script just tells you it happened. |
| 54 | +- **MODIFIED** — same `Change-Id` but the content differs. A patch that was |
| 55 | + cherry-picked and then tweaked (e.g. a reworded release note) before it merged |
| 56 | + upstream cannot be dropped by git via patch-id, so it conflicts on rebase. |
| 57 | + |
| 58 | +For the MODIFIED group the script prompts you. The default is to **drop them and |
| 59 | +keep upstream's version** (done by scripting an interactive rebase to mark those |
| 60 | +commits `drop`). If you decline, they are replayed as-is and you resolve the |
| 61 | +conflicts by hand, preferring upstream. Either way you are told exactly which |
| 62 | +commits are involved before anything is rewritten. |
| 63 | + |
| 64 | +To do it manually instead: |
| 65 | + |
| 66 | +```bash |
| 67 | +git checkout stable/2026.1 |
| 68 | +git pull -p |
| 69 | +git checkout understack/2026.1 |
| 70 | +git rebase stable/2026.1 |
| 71 | +git push rackerlabs understack/2026.1 |
| 72 | +``` |
| 73 | + |
| 74 | +## Updating the container |
| 75 | + |
| 76 | +```bash |
| 77 | +git checkout understack/2026.1 |
| 78 | +git show |
| 79 | +# ensure KEYSTONE_GIT_REF in the Dockerfile matches |
| 80 | +``` |
| 81 | + |
| 82 | +## Backporting patches from upstream master |
| 83 | + |
| 84 | +To backport a patch from upstream master (or another branch) to understack/2026.1: |
| 85 | + |
| 86 | +```bash |
| 87 | +# Fetch all branches from upstream (openstack/keystone) |
| 88 | +# This fetches master, stable branches, and all other refs |
| 89 | +git fetch origin |
| 90 | + |
| 91 | +# Fetch all branches from rackerlabs fork |
| 92 | +git fetch rackerlabs |
| 93 | + |
| 94 | +# Checkout the understack branch |
| 95 | +git checkout understack/2026.1 |
| 96 | + |
| 97 | +# Cherry-pick the commit from master |
| 98 | +# You can get the commit hash from the PR or upstream repository |
| 99 | +git cherry-pick <UPSTREAM_COMMIT_HASH> |
| 100 | + |
| 101 | +# If there are conflicts, resolve them: |
| 102 | +git add <conflicted-files> |
| 103 | +git cherry-pick --continue |
| 104 | + |
| 105 | +# Push to rackerlabs fork |
| 106 | +git push rackerlabs understack/2026.1 |
| 107 | +``` |
| 108 | + |
| 109 | +### Example workflow for a specific PR |
| 110 | + |
| 111 | +Following the backporting workflow above results in a PR like https://github.com/rackerlabs/keystone/pull/XXX: |
| 112 | + |
| 113 | +1. Find the commit hash from upstream master |
| 114 | +2. Cherry-pick it to the branch: `git cherry-pick <COMMIT_HASH>` |
| 115 | +3. Resolve any conflicts if needed |
| 116 | +4. Test the changes locally |
| 117 | +5. Push to the rackerlabs understack branch |
| 118 | + |
| 119 | +### Note on patch sources |
| 120 | + |
| 121 | +Patches can come from: |
| 122 | +- OpenStack upstream master branch (`openstack/keystone` - origin/master) |
| 123 | +- Other branches or forks that have fixes needed |
0 commit comments