PPL2021 — Continous Development — Where Your Development Environment Never Runs Dry

Photo by Jonathan Chng on Unsplash

Work smarter…not harder — Allen F. (1930)

When we talk about the development process, it’s easy to forget the importance and significance of git CI/CD. When in fact, pipeline has made developer’s task so much easier. Have you ever wondered what would happen if there is no git pipeline? We must test our code on the server, and then every time we want to merge our work, we have to test it again. After that, when we want to deploy it, we have to configure our server and our repository and do the same step, again and again, every increment. I believe what Allen in above quite, we have to work smarter, not harder. And behold the technology called CI/CD that will ease every developer pain to deploy a product to production.

Introduction to CI/CD

CI/CD stands for two acronyms. The first one is the CI part, which means Continuous Integration. Successful CI means new code changes to an app are regularly built, tested, and merged to a shared repository. It’s a solution to the problem of having too many branches of an app in development at once that might conflict with each other. So, in other words, every time you push your code to the repository, your code will automatically be built (or compiled) and then tested before merging with the existing code in another branch.

Source: https://www.synopsys.com/content/dam/synopsys/sig-assets/images/cicd-loop.jpg.imgw.850.x.jpg

Introduction to Continous Integration

Our project uses the Gitlab pipeline for our CI tools, pylint for the linter, and the sonarqube for the code scanner. We also use three main branches, the lowest branch is called PBI-<backlog description>. On this branch, every developer will write their increment implementation. The middle branch is the staging branch. On this branch, every developer will be merged. On branch staging, we also deployed our work to be tested by our product owner, client, and lecturer. Every code must be built and tested before it can be merged into the staging branch.

Sonarqube Dashboard Example

Introduction to Continous Development

Now that the code in every branch has been built and tested. The next step will be combining all that code from various branches to one branch and deploying it to production or staging branches. Just for your information, we use docker latest image and PostgreSQL in Heroku for our database (will be explained in the docker article ). The goal in the CD stage is that our code can be deployed to the server. See the YAML code below before we will break down the part one by one.

Benefits of using CI/CD

  • CI/CD will ease your development pain. All you need to know is to write your code.
  • One setup will handle everything, the effort spent on the beginning of the project is so much smaller than having to test and deploy every time you made a change.
  • Lower maintenance cost because the script only has to be initiated once at the beginning of the project.
  • Lower human-error. Using one script will unify every stage and branches. This way, human error regarding testing and deploying will be so much lower and easier to detect.

Under-graduated Students Majoring in Computer Science