Over the past few years, Gradle has become a popular build tool in the JVM space. This is not surprising, considering the power and the features it brings, compared with its competitors. However, one thing Gradle lacks is history and the collective knowledge at the same level of other alternatives: how does one organize a Gradle project in an ‘idiomatic’ fashion?
We feel that we’ve put together a decent build pipeline for each of our microservices over the years, and each one starts with their build.gradle file(s). We’d like to share it, although we’re not sure if it’s the ‘correct’ way.
In this talk, we’ll walk through a sample project structure and build process. We’ll discuss the various checks and tools we use (e.g. Sonar, CodeNarc, Jenkins) at each step of the build. We’ll explain how each of the components in the process work for us, and share samples of our Groovy scripts. Most importantly, though, we’d like to hear what the audience are using in their builds!
17. @svpember
Agenda
• Musings on Builds
• Some background on the situation at ThirdChannel
• Responsibilities of Gradle
• Responsibilities of Jenkins
• Let’s look at some code
• What did I miss?
18. @svpember
Agenda
• Musings on Builds
• Some background on the situation at ThirdChannel
• Responsibilities of Gradle
• Responsibilities of Jenkins
• Let’s look at some code
• What did I miss?
42. @svpember
Local Vs Remote Builds
• Local: Fast, with some minimum level of acceptable testing
• Remote: thorough testing, with some minimal acceptable build time (15 min?)
• Your Gradle file will be more expressive than local needs
• Needs to support both Local and Remote in one build
43. @svpember
Parent vs Service Build File
• Parent: defines global config
• Parent: defines approved dependency versions, with excludes
• Service: local overrides
44. @svpember
Our (MY) Requirements:
• No building ‘final’ artifact from command line
• No deploying from command line
• Should act as guardrails for additional services and new engineers
49. @svpember
Agenda
• Musings on Builds
• Some background on the situation at ThirdChannel
• Responsibilities of Gradle
• Responsibilities of Jenkins
50. @svpember
Jenkins Responsibilities
• Repository of Build History
• Integration / Communication
• Build Planning & Execution
• Environment Setup and Isolation
• Build Reporting
• Artifact Production
51. @svpember
Agenda
• Musings on Builds
• Some background on the situation at ThirdChannel
• Responsibilities of Gradle
• Responsibilities of Jenkins
• Let’s look at some code
65. @svpember
2 Main Take-aways
1. Pater Build plugin: provides parent POM behavior to your projects
2. Isolated Integration Builds: quality gate checks on every push
66. @svpember
Agenda
• Musings on Builds
• Some background on the situation at ThirdChannel
• Responsibilities of Gradle
• Responsibilities of Jenkins
• Let’s look at some code
• What did I miss?