diff options
| -rw-r--r-- | docs/release-process.md | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/docs/release-process.md b/docs/release-process.md new file mode 100644 index 00000000..22c2fd19 --- /dev/null +++ b/docs/release-process.md | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | # repo release process | ||
| 2 | |||
| 3 | This is the process for creating a new release of repo, as well as all the | ||
| 4 | related topics and flows. | ||
| 5 | |||
| 6 | [TOC] | ||
| 7 | |||
| 8 | ## Launcher script | ||
| 9 | |||
| 10 | The main repo script serves as a standalone program and is often referred to as | ||
| 11 | the "launcher script". | ||
| 12 | This makes it easy to copy around and install as you don't have to install any | ||
| 13 | other files from the git repo. | ||
| 14 | |||
| 15 | Whenever major changes are made to the launcher script, you should increment the | ||
| 16 | `VERSION` variable in the launcher itself. | ||
| 17 | At runtime, repo will check this to see if it needs to be updated (and notify | ||
| 18 | the user automatically). | ||
| 19 | |||
| 20 | ## Key management | ||
| 21 | |||
| 22 | Every release has a git tag that is signed with a key that repo recognizes. | ||
| 23 | Those keys are hardcoded inside of the repo launcher itself -- look for the | ||
| 24 | `KEYRING_VERSION` and `MAINTAINER_KEYS` settings. | ||
| 25 | |||
| 26 | Adding new keys to the repo launcher will allow tags to be recognized by new | ||
| 27 | keys, but only people using that updated version will be able to. | ||
| 28 | Since the majority of users will be using an official launcher version, their | ||
| 29 | version will simply ignore any new signed tags. | ||
| 30 | |||
| 31 | If you want to add new keys, it's best to register them long ahead of time, | ||
| 32 | and then wait for that updated launcher to make its way out to everyone. | ||
| 33 | Even then, there will be a long tail of users with outdated launchers, so be | ||
| 34 | prepared for people asking questions. | ||
| 35 | |||
| 36 | ### Registering a new key | ||
| 37 | |||
| 38 | The process of actually adding a new key is quite simple. | ||
| 39 | |||
| 40 | 1. Add the public half of the key to `MAINTAINER_KEYS`. | ||
| 41 | 2. Increment `KEYRING_VERSION` so repo knows it needs to update. | ||
| 42 | 3. Wait a long time after that version is in a release (~months) before trying | ||
| 43 | to create a new release using those new keys. | ||
| 44 | |||
| 45 | ## Self update algorithm | ||
| 46 | |||
| 47 | When creating a new repo checkout with `repo init`, there are a few options that | ||
| 48 | control how repo finds updates: | ||
| 49 | |||
| 50 | * `--repo-url`: This tells repo where to clone the full repo project itself. | ||
| 51 | It defaults to the official project (`REPO_URL` in the launcher script). | ||
| 52 | * `--repo-branch`: This tells repo which branch to use for the full project. | ||
| 53 | It defaults to the `stable` branch (`REPO_REV` in the launcher script). | ||
| 54 | |||
| 55 | Whenever `repo sync` is run, repo will check to see if an update is available. | ||
| 56 | It fetches the latest repo-branch from the repo-url. | ||
| 57 | Then it verifies that the latest commit in the branch has a valid signed tag | ||
| 58 | using `git tag -v` (which uses gpg). | ||
| 59 | If the tag is valid, then repo will update its internal checkout to it. | ||
| 60 | |||
| 61 | If the latest commit doesn't have a signed tag, repo will fall back to the | ||
| 62 | most recent tag it can find (via `git describe`). | ||
| 63 | If that tag is valid, then repo will warn and use that commit instead. | ||
| 64 | |||
| 65 | If that tag cannot be verified, it gives up and forces the user to resolve. | ||
| 66 | |||
| 67 | ## Branch management | ||
| 68 | |||
| 69 | All development happens on the `master` branch and should generally be stable. | ||
| 70 | |||
| 71 | Since the repo launcher defaults to tracking the `stable` branch, it is not | ||
| 72 | normally updated until a new release is available. | ||
| 73 | If something goes wrong with a new release, an older release can be force pushed | ||
| 74 | and clients will automatically downgrade. | ||
| 75 | |||
| 76 | The `maint` branch is used to track the previous major release of repo. | ||
| 77 | It is not normally meant to be used by people as `stable` should be good enough. | ||
| 78 | Once a new major release is pushed to the `stable` branch, then the previous | ||
| 79 | major release can be pushed to `maint`. | ||
| 80 | For example, when `stable` moves from `v1.10.x` to `v1.11.x`, then the `maint` | ||
| 81 | branch will be updated from `v1.9.x` to `v1.10.x`. | ||
| 82 | |||
| 83 | We don't have parallel release branches/series. | ||
| 84 | Typically all tags are made against the `master` branch and then pushed to the | ||
| 85 | `stable` branch to make it available to the rest of the world. | ||
| 86 | Since repo doesn't typically see a lot of changes, this tends to be OK. | ||
| 87 | |||
| 88 | ## Creating a new release | ||
| 89 | |||
| 90 | When you want to create a new release, you'll need to select a good version and | ||
| 91 | create a signed tag using a key registered in repo itself. | ||
| 92 | Typically we just tag the latest version of the `master` branch. | ||
| 93 | The tag could be pushed now, but it won't be used by clients normally (since the | ||
| 94 | default `repo-branch` setting is `stable`). | ||
| 95 | This would allow some early testing on systems who explicitly select `master`. | ||
| 96 | |||
| 97 | ### Creating a signed tag | ||
| 98 | |||
| 99 | Lets assume your keys live in a dedicated directory, e.g. `~/.gnupg/repo/`. | ||
| 100 | |||
| 101 | *** note | ||
| 102 | If you need access to the official keys, check out the internal documentation | ||
| 103 | at [go/repo-release]. | ||
| 104 | Note that only official maintainers of repo will have access as it describes | ||
| 105 | internal processes for accessing the restricted keys. | ||
| 106 | *** | ||
| 107 | |||
| 108 | ```sh | ||
| 109 | # Set the gpg key directory. | ||
| 110 | $ export GNUPGHOME=~/.gnupg/repo/ | ||
| 111 | |||
| 112 | # Verify the listed key is “Repo Maintainer”. | ||
| 113 | $ gpg -K | ||
| 114 | |||
| 115 | # Pick whatever branch or commit you want to tag. | ||
| 116 | $ r=master | ||
| 117 | |||
| 118 | # Pick the new version. | ||
| 119 | $ t=1.12.10 | ||
| 120 | |||
| 121 | # Create the signed tag. | ||
| 122 | $ git tag -s v$t -u "Repo Maintainer <repo@android.kernel.org>" -m "repo $t" $r | ||
| 123 | |||
| 124 | # Verify the signed tag. | ||
| 125 | $ git show v$t | ||
| 126 | ``` | ||
| 127 | |||
| 128 | ### Push the new release | ||
| 129 | |||
| 130 | Once you're ready to make the release available to everyone, push it to the | ||
| 131 | `stable` branch. | ||
| 132 | |||
| 133 | Make sure you never push the tag itself to the stable branch! | ||
| 134 | Only push the commit -- notice the use of `$t` and `$r` below. | ||
| 135 | |||
| 136 | ```sh | ||
| 137 | $ git push https://gerrit-review.googlesource.com/git-repo v$t | ||
| 138 | $ git push https://gerrit-review.googlesource.com/git-repo $r:stable | ||
| 139 | ``` | ||
| 140 | |||
| 141 | If something goes horribly wrong, you can force push the previous version to the | ||
| 142 | `stable` branch and people should automatically recover. | ||
| 143 | Again, make sure you never push the tag itself! | ||
| 144 | |||
| 145 | ```sh | ||
| 146 | $ oldrev="whatever-old-commit" | ||
| 147 | $ git push https://gerrit-review.googlesource.com/git-repo $oldrev:stable --force | ||
| 148 | ``` | ||
| 149 | |||
| 150 | ### Announce the release | ||
| 151 | |||
| 152 | Once you do push a new release to `stable`, make sure to announce it on the | ||
| 153 | [repo-discuss@googlegroups.com] group. | ||
| 154 | Here is an [example announcement]. | ||
| 155 | |||
| 156 | You can create a short changelog using the command: | ||
| 157 | |||
| 158 | ```sh | ||
| 159 | # If you haven't pushed to the stable branch yet, you can use origin/stable. | ||
| 160 | # If you have pushed, change origin/stable to the previous release tag. | ||
| 161 | $ git log --format="%h (%aN) %s" --no-merges origin/stable..$r | ||
| 162 | ``` | ||
| 163 | |||
| 164 | |||
| 165 | [example announcement]: https://groups.google.com/d/topic/repo-discuss/UGBNismWo1M/discussion | ||
| 166 | [repo-discuss@googlegroups.com]: https://groups.google.com/forum/#!forum/repo-discuss | ||
| 167 | [go/repo-release]: https://goto.google.com/repo-release | ||
