Automatic releases
in micro-infra
(with Gradle, Git, Bintray and Travis)
Marcin Zajączkowski
sTools team
2015-01-09
Slide 2
Slide 2 text
Agenda
● Issues with manual releasing
● Releasing steps
● New releasing mechanism in micro-infra
projects
2
Slide 3
Slide 3 text
● Required configured workstation
● Required knowledge of Voodoo magic
● Not repeatable and not reliable
● Consumed developer’s time
● Longer feedback loop
● Boring...
Manual releasing - issues
3
Slide 4
Slide 4 text
● 5 separate Git/Gradle projects
○ released separately
○ depended on each other
○ with specific release order
○ error-prone-bumping dependant projects-version
in every build.gradle
○ hard to determine real changelog in top-level
project
○ hard to do a few complete releases a day
micro-infra - additional issues
4
Slide 5
Slide 5 text
● Everything after commit done
automatically on CI server (Travis)
● Artifacts immediately available for
everyone (Bintray/JCenter)
● On demand releasing controlled by
command embedded into commit
message
● Power of Gradle under the hood
Initial assumptions for micro-infra
5
Slide 6
Slide 6 text
● Managing versions across the projects
● Triggering release of the higher level
project(s)
○ Usually all higher level modules should also be
released
Predicted problems
6
Slide 7
Slide 7 text
7
Live demo -
part 1
Slide 8
Slide 8 text
1. Bump version number in local Git
repository
2. Build and upload artifacts to Bintray
3. Push changes to GitHub
4. Publish in Bintray previously uploaded
artifacts (make them available in JCenter)
Release process - steps
8
Slide 9
Slide 9 text
● Bump project version number
● Make release commit
● Create version tag on created commit
● Git tags - ultimate source of current
version
● Implemented with Axion release plugin
1. Bump version in local repo
9
Slide 10
Slide 10 text
● Build artifacts (jar, source jar, war, …)
● Upload artifacts to Bintray
2. Upload artifacts to Bintray
10
Slide 11
Slide 11 text
● Push release commit
● Push release tag
3. Push changes to GitHub
11
Slide 12
Slide 12 text
● Publish artifacts to jCenter
● Make them available to the world
4. Publish artifacts
12
Slide 13
Slide 13 text
● New micro-common-release project
○ Release mechanism
○ Default versioning and publishing configuration
○ Available at: https://github.com/4finance/micro-
common-release
○ Based on Continuous Delivery conception by
Szczepan Faber
Implementation
13
- source build/release/gradle/setGitVariables.sh
- ./gradlew release -Prelease.localOnly
- ./gradlew check finalizeRelease publishUploadedArtifacts
● Secure variables to handle credentials
● Can be used together with build matrix
○ Builds on different JVM versions
Configuration - Travis
16
Slide 17
Slide 17 text
● In the last commit of given feature
○ With commit message
________________________________________________
[#132] New cool feature
[#DO_RELEASE]
________________________________________________
● In separate triggering commit
git commit -m “Trigger release” -m “[#DO_RELEASE]”
Triggering release
17
Slide 18
Slide 18 text
● merge 5 projects into one umbrella project
○ unified versioning
○ consistent changelog
○ easier and faster to release
○ less confusing for newcomers
Internal changes
18
Slide 19
Slide 19 text
● micro-infra releases done automatically on
Travis
○ With just [#DO_RELEASE] command in commit
message
git commit -m “Trigger release” -m “[#DO_RELEASE]”
Current status
19
Slide 20
Slide 20 text
Live demo -
part 2
20
Slide 21
Slide 21 text
● Every contributor can simply release new
version when needed
○ without any secret knowledge
○ from any machine with GitHub access
○ even from mobile phone (for @MGrzejszczak ;-) )
● Simplified build.gradle configuration
● More time for developers to deliver
business value ;-)
Benefits
21
Slide 22
Slide 22 text
● Automatic smoke testing before publishing
to everyone
● Use in all FOSS projects in 4F
● Convert to separate Gradle plugin
○ Easier to use in other projects - also outside 4F
● Integrate with GitHub milestones
mechanism
Predictable future
22
Slide 23
Slide 23 text
● Automatic CHANGELOG.md generator
● Optional automatic releases after every
commit
○ If requested
● Support for other CI servers
○ If requested
Distant future
23
Slide 24
Slide 24 text
Q & A
Slide 25
Slide 25 text
Feel free to create an issue:
https://github.com/4finance/micro-common-release
or contact me directly
More
questions?
Slide 26
Slide 26 text
Marcin Zajączkowski
m.zajaczkowski@gmail.com
2015-01-09
Thanks for
listening