blob: 393bb3a6b689ba2b55cf5344e964f401bf2d690e [file] [log] [blame] [view]
Bogdan Drutuce8ad4b2017-07-07 12:26:21 -07001# How to Create a Release of OpenCensus Java (for Maintainers Only)
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -07002
3## Build Environments
4
Bogdan Drutuce8ad4b2017-07-07 12:26:21 -07005We deploy OpenCensus Java to Maven Central under the following systems:
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -07006
7- Ubuntu 14.04
8
9Other systems may also work, but we haven't verified them.
10
11## Prerequisites
12
13### Setup OSSRH and Signing
14
15If you haven't deployed artifacts to Maven Central before, you need to setup
16your OSSRH (OSS Repository Hosting) account and signing keys.
17
18- Follow the instructions on [this
19 page](http://central.sonatype.org/pages/ossrh-guide.html) to set up an
20 account with OSSRH.
21 - You only need to create the account, not set up a new project
Bogdan Drutuce8ad4b2017-07-07 12:26:21 -070022 - Contact a OpenCensus Java maintainer on JIRA to add your account after you
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -070023 have created it.
Bogdan Drutuce8ad4b2017-07-07 12:26:21 -070024 - Comment under [this JIRA bug](https://issues.sonatype.org/browse/OSSRH-32121)
25 for release permission to io.opencensus.
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -070026- (For release deployment only) [Install
27 GnuPG](http://central.sonatype.org/pages/working-with-pgp-signatures.html#installing-gnupg)
28 and [generate your key
29 pair](http://central.sonatype.org/pages/working-with-pgp-signatures.html#generating-a-key-pair).
30 You'll also need to [publish your public
31 key](http://central.sonatype.org/pages/working-with-pgp-signatures.html#distributing-your-public-key)
32 to make it visible to the Sonatype servers.
33- Put your GnuPG key password and OSSRH account information in
34 `<your-home-directory>/.gradle/gradle.properties`:
35
36 ```
37 # You need the signing properties only if you are making release deployment
38 signing.keyId=<8-character-public-key-id>
39 signing.password=<key-password>
40 signing.secretKeyRingFile=<your-home-directory>/.gnupg/secring.gpg
41
42 ossrhUsername=<ossrh-username>
43 ossrhPassword=<ossrh-password>
44 checkstyle.ignoreFailures=false
45 ```
46
47## Tagging the Release
48
49The first step in the release process is to create a release branch, bump
50versions, and create a tag for the release. Our release branches follow the
51naming convention of `v<major>.<minor>.x`, while the tags include the patch
52version `v<major>.<minor>.<patch>`. For example, the same branch `v0.4.x` would
53be used to create all `v0.4` tags (e.g. `v0.4.0`, `v0.4.1`).
54
Bogdan Drutuce8ad4b2017-07-07 12:26:21 -070055In this section upstream repository refers to the main opencensus-java github
56repository.
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -070057
Bogdan Drutuac9dd022017-04-17 13:03:01 -070058Before any push to the upstream repository you need to create a [personal access
59token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
60
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -0700611. Create the release branch and push it to GitHub:
62
63 ```bash
64 $ MAJOR=0 MINOR=4 PATCH=0 # Set appropriately for new release
65 $ VERSION_FILES=(
66 build.gradle
Bogdan Drutufc714532018-01-18 19:09:03 -080067 examples/build.gradle
Hailong Wen916e10e2018-01-19 16:30:14 -080068 examples/pom.xml
Bogdan Drutubd96a9c2017-10-23 12:35:01 -070069 api/src/main/java/io/opencensus/common/OpenCensusLibraryInformation.java
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -070070 )
71 $ git checkout -b v$MAJOR.$MINOR.x master
72 $ git push upstream v$MAJOR.$MINOR.x
73 ```
74
Kristen Kozakfeda64e2017-09-08 17:59:07 -0700752. Enable branch protection for the new branch, if you have admin access.
76 Otherwise, let someone with admin access know that there is a new release
77 branch.
78
79 - Open the branch protection settings for the new branch, by following
80 [Github's instructions](https://help.github.com/articles/configuring-protected-branches/).
81 - Copy the settings from a previous branch, i.e., check
82 - `Protect this branch`
83 - `Require pull request reviews before merging`
84 - `Require status checks to pass before merging`
85 - `Include administrators`
86
Kristen Kozakfeda64e2017-09-08 17:59:07 -070087 Enable the following required status checks:
88 - `cla/google`
89 - `continuous-integration/appveyor/pr`
90 - `continuous-integration/travis-ci`
Kristen Kozakd1a7aaf2017-09-11 11:13:53 -070091 - Uncheck everything else.
Kristen Kozakfeda64e2017-09-08 17:59:07 -070092 - Click "Save changes".
93
943. For `master` branch:
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -070095
96 - Change root build files to the next minor snapshot (e.g.
97 `0.5.0-SNAPSHOT`).
98
99 ```bash
100 $ git checkout -b bump-version master
101 # Change version to next minor (and keep -SNAPSHOT)
Bogdan Drutu1d2eda62017-06-19 23:54:11 -0700102 $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_OPENCENSUS_VERSION\)/'$MAJOR.$((MINOR+1)).0'\1/' \
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -0700103 "${VERSION_FILES[@]}"
104 $ ./gradlew build
105 $ git commit -a -m "Start $MAJOR.$((MINOR+1)).0 development cycle"
106 ```
107
108 - Go through PR review and push the master branch to GitHub:
109
110 ```bash
111 $ git checkout master
112 $ git merge --ff-only bump-version
113 $ git push upstream master
114 ```
115
Kristen Kozakfeda64e2017-09-08 17:59:07 -07001164. For `vMajor.Minor.x` branch:
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -0700117
118 - Change root build files to remove "-SNAPSHOT" for the next release
119 version (e.g. `0.4.0`). Commit the result and make a tag:
120
121 ```bash
122 $ git checkout -b release v$MAJOR.$MINOR.x
123 # Change version to remove -SNAPSHOT
Bogdan Drutu1d2eda62017-06-19 23:54:11 -0700124 $ sed -i 's/-SNAPSHOT\(.*CURRENT_OPENCENSUS_VERSION\)/\1/' "${VERSION_FILES[@]}"
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -0700125 $ ./gradlew build
126 $ git commit -a -m "Bump version to $MAJOR.$MINOR.$PATCH"
127 $ git tag -a v$MAJOR.$MINOR.$PATCH -m "Version $MAJOR.$MINOR.$PATCH"
128 ```
129
130 - Change root build files to the next snapshot version (e.g.
131 `0.4.1-SNAPSHOT`). Commit the result:
132
133 ```bash
134 # Change version to next patch and add -SNAPSHOT
Bogdan Drutu1d2eda62017-06-19 23:54:11 -0700135 $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_OPENCENSUS_VERSION\)/'$MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT'\1/' \
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -0700136 "${VERSION_FILES[@]}"
137 $ ./gradlew build
138 $ git commit -a -m "Bump version to $MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT"
139 ```
140
141 - Go through PR review and push the release tag and updated release branch
142 to GitHub:
143
144 ```bash
145 $ git checkout v$MAJOR.$MINOR.x
146 $ git merge --ff-only release
147 $ git push upstream v$MAJOR.$MINOR.$PATCH
148 $ git push upstream v$MAJOR.$MINOR.x
149 ```
Bogdan Drutuac9dd022017-04-17 13:03:01 -0700150
151## Deployment
152
153Deployment to Maven Central (or the snapshot repo) is for all of the artifacts
154from the project.
155
156### Branch
157
Kristen Kozak0f28b172018-05-01 14:40:29 -0700158Before building/deploying, be sure to switch to the appropriate tag. The tag
159must reference a commit that has been pushed to the main repository, i.e., has
160gone through code review. For the current release use:
Bogdan Drutuac9dd022017-04-17 13:03:01 -0700161
162```bash
163$ git checkout -b v$MAJOR.$MINOR.$PATCH tags/v$MAJOR.$MINOR.$PATCH
164```
165
166### Initial Deployment
167
168The following command will build the whole project and upload it to Maven
169Central. Parallel building [is not safe during
170uploadArchives](https://issues.gradle.org/browse/GRADLE-3420).
171
172```bash
173$ ./gradlew clean build && ./gradlew -Dorg.gradle.parallel=false uploadArchives
174```
175
176If the version has the `-SNAPSHOT` suffix, the artifacts will automatically go
177to the snapshot repository. Otherwise it's a release deployment and the
178artifacts will go to a staging repository.
179
180When deploying a Release, the deployment will create [a new staging
181repository](https://oss.sonatype.org/#stagingRepositories). You'll need to look
Bogdan Drutuce8ad4b2017-07-07 12:26:21 -0700182up the ID in the OSSRH UI (usually in the form of `opencensus-*`).
Bogdan Drutuac9dd022017-04-17 13:03:01 -0700183
184## Releasing on Maven Central
185
186Once all of the artifacts have been pushed to the staging repository, the
187repository must first be `closed`, which will trigger several sanity checks on
188the repository. If this completes successfully, the repository can then be
189`released`, which will begin the process of pushing the new artifacts to Maven
190Central (the staging repository will be destroyed in the process). You can see
191the complete process for releasing to Maven Central on the [OSSRH
192site](http://central.sonatype.org/pages/releasing-the-deployment.html).
Bogdan Drutuc796e252017-07-07 16:42:36 -0700193
Hailong Wene9b61782018-01-22 14:18:36 -0800194## Announcement
195
196Once deployment is done, go to Github [release
197page](https://github.com/census-instrumentation/opencensus-java/releases), press
198`Draft a new release` to write release notes about the new release.
199
200You can use `git log upstream/v$MAJOR.$((MINOR-1)).x..upstream/v$MAJOR.$MINOR.x --graph --first-parent`
201or the Github [compare tool](https://github.com/census-instrumentation/opencensus-java/compare/)
Yang Songb09b3282018-04-27 16:07:18 -0700202to view a summary of all commits since last release as a reference. In addition, you can refer to
203[CHANGELOG.md](https://github.com/census-instrumentation/opencensus-java/blob/master/CHANGELOG.md)
204for a list of major changes since last release.
205
Hailong Wene9b61782018-01-22 14:18:36 -0800206Please pick major or important user-visible changes only.
207
208## Update release versions in documentations and build files
209
210After releasing is done, you need to update all readmes and examples to point to the
211latest version.
212
2131. Update README.md and gradle/maven build files on `master` branch:
214
215```bash
216$ git checkout -b bump-document-version master
217$ BUILD_FILES=(
218 examples/build.gradle
219 examples/pom.xml
220 )
221$ README_FILES=(
222 README.md
Yang Song432d0a92018-06-05 10:35:35 -0700223 contrib/appengine_standard_util/README.md
Yang Songd3a3fbf2018-07-12 12:02:14 -0700224 contrib/exemplar_util/README.md
Hailong Wene9b61782018-01-22 14:18:36 -0800225 contrib/grpc_util/README.md
226 contrib/http_util/README.md
sebright8a95c212018-09-04 10:26:22 -0700227 contrib/log_correlation/log4j/README.md
Kristen Kozak81f5abb2018-06-19 18:13:48 -0700228 contrib/log_correlation/stackdriver/README.md
Yang Songa3b50ea2018-05-21 15:32:23 -0700229 contrib/monitored_resource_util/README.md
savaki9dad9592018-07-19 19:32:00 -0700230 contrib/spring/README.md
Dino Oliva30c10cc2018-09-05 12:09:44 -0700231 contrib/spring_sleuth/README.md
Hailong Wene9b61782018-01-22 14:18:36 -0800232 contrib/zpages/README.md
Yang Songb0d39672018-02-13 12:47:32 -0800233 exporters/stats/prometheus/README.md
Hailong Wene9b61782018-01-22 14:18:36 -0800234 exporters/stats/signalfx/README.md
235 exporters/stats/stackdriver/README.md
Fabian Lange17a1a1a2018-02-09 14:33:30 -0500236 exporters/trace/instana/README.md
Hailong Wene9b61782018-01-22 14:18:36 -0800237 exporters/trace/logging/README.md
Yang Song9b6eb8c2018-03-16 11:00:43 -0700238 exporters/trace/jaeger/README.md
Hailong Wene9b61782018-01-22 14:18:36 -0800239 exporters/trace/stackdriver/README.md
240 exporters/trace/zipkin/README.md
241 )
242# Substitute versions in build files
243$ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*LATEST_OPENCENSUS_RELEASE_VERSION\)/'$MAJOR.$MINOR.$PATCH'\1/' \
244 "${BUILD_FILES[@]}"
245# Substitute versions in build.gradle examples in README.md
246$ sed -i 's/\(\(compile\|runtime\).\+io\.opencensus:.\+:\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1'$MAJOR.$MINOR.$PATCH'/' \
247 "${README_FILES[@]}"
248# Substitute versions in maven pom examples in README.md
249$ sed -i 's/\(<version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1'$MAJOR.$MINOR.$PATCH'/' \
250 "${README_FILES[@]}"
251```
252
2532. Update bazel dependencies for subproject `examples`:
254
255 - Follow the instructions on [this
256 page](https://docs.bazel.build/versions/master/generate-workspace.html) to
257 install bazel migration tool. You may also need to manually apply
258 this [patch](
259 https://github.com/nevillelyh/migration-tooling/commit/f10e14fd18ad3885c7ec8aa305e4eba266a07ebf)
260 if you encounter `Unable to find a version for ... due to Invalid Range Result` error when
261 using it.
262
263 - Use the following command to generate new dependencies file:
264
265 ```bash
266 $ bazel run //generate_workspace -- \
Yang Song751ea3c2018-03-20 10:44:54 -0700267 --artifact=com.google.guava:guava:23.0 \
268 --artifact=io.grpc:grpc-all:1.9.0 \
Hailong Wene9b61782018-01-22 14:18:36 -0800269 --artifact=io.opencensus:opencensus-api:$MAJOR.$MINOR.$PATCH \
Yang Song751ea3c2018-03-20 10:44:54 -0700270 --artifact=io.opencensus:opencensus-contrib-grpc-metrics:$MAJOR.$MINOR.$PATCH \
Hailong Wene9b61782018-01-22 14:18:36 -0800271 --artifact=io.opencensus:opencensus-contrib-zpages:$MAJOR.$MINOR.$PATCH \
Yang Song751ea3c2018-03-20 10:44:54 -0700272 --artifact=io.opencensus:opencensus-exporter-stats-prometheus:$MAJOR.$MINOR.$PATCH \
273 --artifact=io.opencensus:opencensus-exporter-stats-stackdriver:$MAJOR.$MINOR.$PATCH \
Hailong Wene9b61782018-01-22 14:18:36 -0800274 --artifact=io.opencensus:opencensus-exporter-trace-logging:$MAJOR.$MINOR.$PATCH \
Yang Song751ea3c2018-03-20 10:44:54 -0700275 --artifact=io.opencensus:opencensus-exporter-trace-stackdriver:$MAJOR.$MINOR.$PATCH \
Hailong Wene9b61782018-01-22 14:18:36 -0800276 --artifact=io.opencensus:opencensus-impl:$MAJOR.$MINOR.$PATCH \
Yang Song751ea3c2018-03-20 10:44:54 -0700277 --artifact=io.prometheus:simpleclient_httpserver:0.3.0 \
Hailong Wene9b61782018-01-22 14:18:36 -0800278 --repositories=http://repo.maven.apache.org/maven2
279 Wrote
280 /usr/local/.../generate_workspace.runfiles/__main__/generate_workspace.bzl
281 ```
282
283 - Copy this file to overwrite `examples/opencensus_workspace.bzl`.
284
285 - Use the following command to rename the generated rules and commit the
286 changes above:
287
288 ```bash
289 $ sed -i 's/def generated_/def opencensus_/' examples/opencensus_workspace.bzl
290 $ git commit -a -m "Update release versions for all readme and build files."
291 ```
292
2933. Go through PR review and merge it to GitHub master branch.
294
Yang Songe812bcf2018-05-03 16:26:52 -07002954. In addition, create a PR to mark the new release in
296[CHANGELOG.md](https://github.com/census-instrumentation/opencensus-java/blob/master/CHANGELOG.md)
297on master branch. Once that PR is merged, cherry-pick the commit and create another PR to the
298release branch (branch v$MAJOR.$MINOR.x).
299
300
Bogdan Drutuc796e252017-07-07 16:42:36 -0700301## Known Issues
302
Bogdan Drutu6684c2b2017-07-10 13:59:40 -0700303### Deployment for tag v0.5.0
304To rebuild the releases on the tag v0.5.0 use:
Bogdan Drutuc796e252017-07-07 16:42:36 -0700305```bash
306$ ./gradlew clean build && ./gradlew uploadArchives
307```
308
309If option `-Dorg.gradle.parallel=false` is used, you will hit [this bug](https://issues.sonatype.org/browse/OSSRH-19485)
310caused by [this bug](https://github.com/gradle/gradle/issues/1827) in gradle 3.5.