Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Add Shipkit for release management
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
  • Loading branch information
jpkrohling committed Sep 14, 2018
1 parent 41a9d10 commit acb4295
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 232 deletions.
22 changes: 9 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
sudo: required
language: java
dist: trusty

services:
- docker

env:
global:
- DOCKER_VERSION=1.11.1-0~trusty
- DOCKER_COMPOSE_VERSION=1.7.0
- COMMIT=${TRAVIS_COMMIT::8}
# travis encrypt -r <repo> SONATYPE_USERNAME=<username>
- secure: "szUKwXCryzn9J59+K8E3/mvxmH1pVgpXkoXKN4tWNU5Tu9yht43agyYQ6JK388Ik2oYAo0P0qD4Tablrpv6aMFrw2YWh7hZ1YfCmTkgTyZ7TL7jdQIwOLSgy96ttRZxxJwk+bwKHBYSRSQMBcveDmxaRz7q1tKPV7HJIIjbbpHPZOf0mGkPWgSmCuFG35w7m22ZudgyjwlaiBvddMywobIQDkyrThro7VoVLh/IvTRwpHWa1JfQeCO3r81Z6VHmz06LO/82fczra2AldVjpyldFq+Ow5S+fYoFe065nbyWl19OFy1mSgYoS3VUNueY76WfmvSMkp3NfpJMFrtSYY2jHesdqMi8daKCHPuT223CTU83fBs+rHwdA8iE23TSxCgOkm3RS85Zz+s/WbuyJojh5GrqB1+lWCE+LHIPlZqmnd4vR95MP07324EaJ0lZyFT1WzrdhfLMl07+sYQCb7EEp5lt2PjIdRyAOuIf5fdV5sf3E0gm4cfdNNIKuThNTqIXKcaOP7UjZSysfeskt1oDJA5qtsftaeaiAsNTrDjY3ay6jT5W1eV2hBgcOfUeu/eVQ8TlXu8JkxUolntEh0L9FSmiJc7+nppkqKjGFEHzqCfFwm2rHLprnwCrUQl/FLmYJVeBczIRYwkb3u/SXLFqjxmrgjyE0jooPnj9PF30I="
# travis encr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tTFjmihxp1H6MHdiWgrklkJXaLSX82T8/j3RYQUA0SCGFHiV5uCIRtVZf5LkUaO86uySymsfCmSA9BdIRET9stra5YNYxuQ8zzY8KGNI+jcjpe0STWUG/ZNGBOHJ7Viw1S4TpXLRz4jbmjC4jJXjjR2Sa0C2NLNOKchO+aOP1a+6+ODuyrjBwDhIohSh39rIYjmt5v14RKj7k/C5Bz5QfXejw8JVp49zLaLF1lksCaP8BVhOu5xOuttgOoXA7LV+tKmyovg1Ka9DXLaQNd5vAfPnqVXaZXKYP8AIJXrCUT/Z280brNZOfLxg=

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
before_install:
- ./travis/prepare-signing.sh $encrypted_677f232983c0_key $encrypted_677f232983c0_iv

stages:
- name: test
Expand All @@ -39,15 +33,17 @@ jobs:
include:
- stage: test
env: [ NAME=unit-test ]
script: make test-travis && ./gradlew codeCoverageReport && bash <(curl -s https://codecov.io/bash)
script: make test-travis
after_success: make coverage

- stage: test
env: [ NAME=crossdock ]
script: make crossdock-fresh

- stage: deploy
env: [ NAME=deploy-to-maven ]
script: ./gradlew upload
env: [ NAME=release ]
script: make release
if: tag =~ /^release\/v.[\d\.]+(\-.*)?$/ # matches "release/v0.31.0" or "release/v0.31.0-RC1"

- stage: deploy
env: [ NAME=deploy-crossdock-to-dockerhub ]
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ test-travis:

.PHONY: release
release: clean
$(GRADLE) -i uploadArchives
$(GRADLE) -i ciPerformRelease

.PHONY: coverage
coverage: SHELL:=/bin/bash
coverage:
$(GRADLE) codeCoverageReport
bash <(curl -s https://codecov.io/bash)
74 changes: 26 additions & 48 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,31 @@
# Release Process

## Automatic release (preferred)

The release process consists of these steps:
1. Create a pull request with:
* Change the version in [`build.gradle`](build.gradle) to match the release version e.g. `0.20.0`
* Add an entry to [`CHANGELOG`](CHANGELOG.md) with changes since the last release
1. Commit your `CHANGELOG` changes
1. Create and push tag with the new version `git tag v0.20.0 && git push origin v0.20.0`
1. Once the *tag* build finishes in Travis, the artifacts should have been uploaded to Sonatype staging,
the staging repository closed, and the artifacts on the way to Maven Central (it takes 20min+ to get there).
In case of failures it is safe to retry by restarting the maven-deploy job. If it keeps
failing, sometimes it may be necessary to close the staging repository manually.
1. Create a release on GitHub for the new tag. Use the changes from the `CHANGELOG` as the description.
1. Once the artifacts are available on Maven
* bump the version in `build.gradle` to `major.minor.(patch+1)-SNAPSHOT`
* add a new section to the CHANGELOG with that version as `(unreleased)` and a bullet point `- Nothing yet`
* commit with the comment "Back to development" (for example, https://github.com/jaegertracing/jaeger-client-java/commit/da9726d3ba7309947882e3c621516c70b4bc83dc)

## Local setup and release

The Travis build execute the `uploadArchives` task, and this task performs the signing of the artifacts.
While the Travis build is ready for that, releasing locally requires the following steps:

* install GPG: `brew install gpg`
* generate keys: `gpg --gen-key`
* see installed keys with `gpg --list-keys` or `gpg --list-secret-keys`
* create an account with Sonatype, get repo permissions (e.g. https://issues.sonatype.org/browse/OSSRH-23572)
* create `$HOME/.gradle/gradle.properties` file or add parameters directly as it is shown at the last step.
```
signing.keyId={key ID from gpg --list-secret-keys}
signing.password={password you used to encrypt keys via gpg --gen-key}
signing.secretKeyRingFile={e.g. [home path]/.gnupg/secring.gpg}
This project uses [Shipkit](http://shipkit.org) for most of the release management. A release can be performed either manually or via Travis.

## Automated

1. Update the `CHANGELOG.md` with the changes for the last release. Most of the changes should have been added there already, but at least the release date has to be set.
1. Check the `version.properties` file: the `version` property is the version that is going to be released next. If you intend to have a different version, update this file.
1. Get the changes above merged
1. Tag the release, like, `git tag release/v0.31.1` and push the tag to the main repository (`git push upstream v0.31.0`, if your `jaegertracing/jaeger-client-java` remote is called `upstream`)

Once these steps are done, Travis will trigger a `make release`. Shipkit then builds and uploads the release to Bintray. The artifacts then end up in Maven Central in a few minutes.

## Manual

To do a manual release, you'll first need a few environment variables:

* `GH_READ_TOKEN`
* `GH_WRITE_TOKEN` (with `repo:public_repo` permission only)
* `BINTRAY_API_KEY`
* `BINTRAY_API_USER`

Those are self-explanatory, but check the [Shipkit Getting Started](https://github.com/mockito/shipkit/blob/master/docs/getting-started.md) for more information on how to obtain those.

Do everything like the "Automated" session but instead of pushing the tag to the remote repository, run:

ossrhUsername={your user name at Sonatype}
ossrhPassword={your password at Sonatype}
```bash
git checkout release/v0.31.1
./gradlew performRelease
```
* upload your public key to Ubuntu servers, e.g.
* `gpg --keyserver http://keyserver.ubuntu.com:11371 --send-keys {pub key ID}`
* you can also use Web UI and upload plain test key that you can obtain via
* `gpg --armor --export {your email used for the keys}`
* Run gradle upload to Nexus. Note that it might be necessary to close and release via Nexus UI.
* `./gradlew upload -Psigning.keyId=<key ID from gpg --list-secret-keys> -Psigning.password=<password you used to encrypt keys via gpg --gen-key> -Psigning.secretKeyRingFile=<home/user>/.gnupg/secring.gpg -PossrhUsername=<name> -PossrhPassword=<pas>`

## Closing Staging Repository Manually

* https://oss.sonatype.org/, log in, go to Staging Repositories
* In the top-right corner search box type `uber`, and find your uploaded repository
* Hit Close button. Monitor status on Activity tab at the bottom, hitting Refresh.
* Once Close is successful, the Release button will become available, so hit it
* Keep hitting Refresh while sync to Maven is in progress. Once it's complete, the repository will disappear.

54 changes: 5 additions & 49 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

import java.util.regex.Pattern

plugins {
id "org.jruyi.thrift" version "0.4.0"
id "jacoco"
Expand All @@ -11,12 +9,10 @@ plugins {
id "com.github.johnrengelman.shadow" version "2.0.4"
id "net.ltgt.errorprone" version "0.0.14"
id 'ru.vyarus.animalsniffer' version '1.4.3'
id 'io.codearte.nexus-staging' version '0.11.0'
id 'com.github.ben-manes.versions' version '0.17.0'
id "org.shipkit.java" version "1.0.12"
}

ext.developmentVersion = getProperty('developmentVersion','0.31.1-SNAPSHOT')

ext.opentracingVersion = getProperty('opentracingVersion','0.31.0')
ext.guavaVersion = getProperty('guavaVersion','18.0')
ext.apacheThriftVersion = getProperty('apacheThriftVersion','0.11.0')
Expand All @@ -34,8 +30,6 @@ ext.junitDataProviderVersion = '1.13.1'
ext.awaitilityVersion = '3.0.0'
ext.logbackVersion = '1.2.3'

ext.skipSigning = project.hasProperty('skipSigning') && skipSigning.toBoolean()

task wrapper(type: Wrapper) {
gradleVersion = '4.0'
}
Expand All @@ -45,7 +39,6 @@ allprojects {
apply plugin: 'jacoco'

group = 'io.jaegertracing'
version = getVersionForBuild()

repositories {
mavenLocal()
Expand All @@ -61,6 +54,7 @@ subprojects {
apply plugin: 'signing'
apply plugin: 'checkstyle'

updateReleaseNotes.enabled = false

compileJava {
sourceCompatibility = 1.6
Expand All @@ -76,19 +70,6 @@ subprojects {
from sourceSets.main.output
}

if (!version.endsWith("SNAPSHOT")) {
nexusStaging {
packageGroup = "io.jaegertracing"
username = ossrhUsername
password = ossrhPassword
// Dealing with error "Wrong number of received repositories in state 'open'" (http://bit.ly/2ybracm)
numberOfRetries = 50
delayBetweenRetriesInMillis = 3000
}

uploadArchives.finalizedBy closeAndReleaseRepository
}

animalsniffer {
sourceSets = [sourceSets.main]
}
Expand Down Expand Up @@ -122,18 +103,15 @@ subprojects {

check.dependsOn tasks.license

apply from: '../gradle/publish.gradle'

test {
testLogging {
events TestLogEvent.FAILED, TestLogEvent.SKIPPED
exceptionFormat TestExceptionFormat.FULL

// remove standard output/error logging from --info builds
info.events = [
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
]
info.exceptionFormat TestExceptionFormat.FULL
}
Expand All @@ -144,10 +122,6 @@ subprojects {
compileOnly 'org.projectlombok:lombok:1.18.2'
compileOnly 'org.codehaus.mojo:animal-sniffer-annotations:1.16'
}

signing {
required { !skipSigning }
}
}

task codeCoverageReport(type: JacocoReport, group: 'Coverage reports') {
Expand Down Expand Up @@ -176,10 +150,6 @@ task codeCoverageReport(type: JacocoReport, group: 'Coverage reports') {
}
}

task printVersion {
println getVersionForBuild()
}

configure(subprojects.findAll {it.name != 'jaeger-thrift'}) {
apply plugin: 'net.ltgt.errorprone'
dependencies {
Expand All @@ -196,20 +166,6 @@ configure(subprojects.findAll {it.name != 'jaeger-thrift'}) {
}
}

def getVersionForBuild() {
String candidateVersion = System.env.TRAVIS_TAG

if (null == candidateVersion || candidateVersion.isEmpty()) {
return ext.developmentVersion
}

if (Pattern.compile("[v]?((\\d+)\\.(\\d+)\\.(\\d+))(\\-RC\\d+)?").matcher(candidateVersion).matches()) {
return candidateVersion.drop(1)
}

return ext.developmentVersion
}

def getProperty(name, defaultValue) {
project.properties[name] ?: defaultValue
}
87 changes: 0 additions & 87 deletions gradle/publish.gradle

This file was deleted.

Loading

0 comments on commit acb4295

Please sign in to comment.