Kristal BlogKristal Blog

>

Tech Blogs

>

How Kristal.AI built the Android app CI/CD pipeline using Jenkins

How Kristal.AI built the Android app CI/CD pipeline using Jenkins

By

Dhruv Jindal

July 7, 2021

Kristal.AI is a digital wealth platform that aims to provide private banking solutions through transparent access to investment and services, which are traditionally reserved for the Ultra-high net worth. We leverage technology, algorithms, and human expertise to help clients with portfolio allocations and optimization. We are licensed and operational in Singapore, Hong Kong, and India.At the center of Kristal.AI, sits the 35 person engineering team. While small in number, for building and managing our digital wealth management platform. We are the tech-savvy ones and love to try different things to improve the performance, scalability, and reliability of the platform.Amongst other things, the team is driven by this simple motto:"Some things are meant to be done by machines."- Vineeth Narasimhan, Co-Founder & CTO, Kristal.AI.Here’s our journey of how we built our Android app CI/CD pipeline using Jenkins.

The Problem Statement

Before we moved to Jenkins. we used to manually attach the QA Android device and give the builds via Android Studio. This made sense to our use case at that time as it saved time, rather than going through the DevOps route.Then with the pandemic and WFH situation, we were forced to rethink this approach as we could no longer give the build manually.We started giving build via Slack. We started sending .apk files directly. Why it failed: The build was dependant on the developer’s machine and it was eating up the developer’s time. What if the developer is on leave or his/her system crashes? We had to do something to eliminate this system/developer dependency.

We then moved our Android build process to Jenkins. We already have our backend build deployments set up via Jenkins. So it only made sense to add our Android build process in the same Jenkins machine that we had in AWS.

Now all our builds of staging and prod build automatically go via Jenkins.In a later section, we get into the details of how we implemented this development. But first let's take a look at how this benefited the platform, the team, and the business overall:

  1. The dependency on a single developer machine was eliminated
  2. It freed up the developer’s time which was getting wasted due to the system dependency
  3. Now our developers can focus on building great apps rather than worrying about giving out builds
  4. Deploying Emergency builds has now become easier
  5. Saving developers’ time eventually saves business cost
  6. As it saves developer’s time, which eventually saves business cost

The Implementation

Now to the tech-y part of the article. The Implementation. Here’s how the team implemented this development, broken down into 3 Jobs:

In a Nutshell :

  • Daily Cron job is triggered at 10:00 AM IST (4:30 AM UTC) to run this workflow
  • Workflow is divided into 3 jobs
  • The workflow can also be triggered manually on-demand basis

Workflow Steps Overview :

  • Job 1: To generate Android build for internal distribution via URL
  • Job 2: Upload the app files to S3
  • Job 3: Upload app files to BrowserStack for Automation Testing
  • Job 4 (Optional): Upload build to Beta if it is prod environment

Workflow In-DepthSummary: This workflow is aimed at providing Android build for testing on a daily purpose. The jobs are run synchronously.No of jobs in the workflow : 3No of machines used: 1 (centOS)Job 1 Steps (Build) :

  1. Send message in Slack that Build has started
  2. Checkout to staging branch
  3. Install NodeJS so that npm command can be used
  4. Install NPM packages. Make sure to have a package-lock.json for correct NPM packages to be installed
  5. Run the android build command which generates APK file which can be distributed to users for testing.
  6. Send message in Slack that Build has completed

Job 2 Steps (Uploading to S3) :

  1. Send message in Slack that Build is uploading to S3
  2. Configure AWS credentials
  3. Copy the APK file from centOS machine to S3
  4. Send message in Slack that Build is ready for testing

Job 3 Steps (Uploading to BrowserStack) :

  1. Upload the APK file from the CentOS machine to BrowserStack so that whenever Automation tests are run, the BrowserStack always has the latest app
  2. Perform Unit and UI testing of the whole app
  3. Prepare Testing Report and publish it in Slack

Job 4 Steps (Uploading to Beta) :

  1. Upload the app build to Beta if is a Prod Workflow

Conclusion

CI/CD is a must in today’s world which really enhances your tech stack. It really saves a lot of boring, repetitive tasks that can be easily done by machines and also is very cost-effective.

Related articles

Go to BlogGo to Blog

Ready to start investing?

A fully digital onboarding process that can be completed within 15 minutes.
No more voluminous paperwork and queuing!

Ready to start investing?

A fully digital onboarding process that can be completed within 15 minutes.
No more voluminous paperwork and queuing!

How would you want to invest?

Your Details

Financial Guide Details

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Your Details

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

I understand the financial products and would want to proceed with investing without a financial guide

X