Utilizing Gradle, Jenkins and Slack for better Developer-QA interaction

Yasir Ali
AndroidPub
Published in
3 min readApr 29, 2018

As we are engineers naturally, hating manual laborious tasks is in our blood. Most of the time, due to work load in our offices we might forget to make our life easy. Currently i am working on a structure of QA teams which looks like:

There are two types of QA teams. Internal QA Team and External QA Team.

After full Internal QA sessions (i.e: Sprint is completed) we share the final build in release configuration with External QA team. After getting green flag from External QA team, we publish the apk to Google Play Store in alpha channel. Then another Final External QA session is done on PlayStore’s alpha channel. After the successful final QA session on PlayStore’s Alpha channel we move the apk from alpha to Production Channel from Google Play Console.

In the past, i never thought to automate the android build process but at one stage i realized that these manual processes are becoming headache. Then i luckily found some time to dive into Gradle system in depth and decided to blend the Gradle with Jenkins and Slack to automate most of the tasks i usually do manually.

All i wanted was

1- To prepare the Android builds automatically on a git commit and
2- Share different builds with multiple QA teams and then
3- Inform QA teams automatically on Slack Channel about the availability of new builds

“A picture is worth a thousand words.”

So basically in this example, we are going to build and distribute the apks on three channels one after another.

Stage -1: Internal QA
Stage-2: External QA
Stage-3: PlayStore (Alpha Channel)

Before going into the details of each stage, lets get an overview of a general process that will be applied to each of these three stages.

1- Developer merged the code into a git branch (QA, release/*, master).
2- Jenkins Job is polling that git branch every minute and after detecting the changes in that branch, Jenkins fetch the new source code and execute a Gradle Task (internalQADist, externalQADist, publishApkRelease).
3- That Gradle task performs the necessary tasks to clean, build and distribute the apk on Fabric Beta among given Tester Groups.
4- That Gradle task also sends a Message to Slack Channel related to current build (build version, status, url to Fabric Beta for instant access to latest release)

Every task related to building, distributing and sending build notifications to slack channel should be done in Gradle, not in Jenkins using plugins. In this way developers would have full control over build/distribute/notify process via Gradle, otherwise developers will have to go to Jenkins Server each time they want to modify any of the process (e.g: adding a new gradle task “cleanBuildCache” before “build” task).

Next Steps

In the next article we will setup the J-G-S (Jenkins, Gradle and Slack) to get the jobs done for Stage-1 (Internal-QA) and Stage-2 (External-QA). In the further next article we will setup the J-G-S for our last stage (PlayStore).

--

--