Jenkins for CI/CD — DevOps Project 06

Bhavyansh @ DiversePixel
3 min readJun 26, 2024

--

In this project, we will integrate CI/CD principles in our EventApp application.

Links:

Know the application:

  • EventApp is a full-stack Event Management app for Educational institutions.
  • Moderators can create Events which are later approved or put on hold by the admins.
  • Allows downloading PDF of the Event details once approved by admins.
  • Built on Ruby on Rails, uses postgresql database.
  • Have RSpec setup for (Unit, Integration and Feature) tests:

Jenkins Workflow:

  1. (When dev pushes code, Jenkins…) Clones code from GH using webhooks
  2. Builds docker image
  3. Runs RSpec tests
  4. Push to Docker hub

Let’s begin with building a docker compose image

Running tests inside the container

Now we will add Jenkinsfile in our application code and configure a new job in Jenkins, and on github, we will add webhook triggers.

Updated sudoers file to allow jenkins passwordless sudo

sudo visudo

To be able to pass env vars:

Docker pipeline plugin

All good

Plugins:

  • Build Timestamp
  • Pipeline utility steps

Pipeline concepts:

  • Node/agent
  • Stage
  • Step

Had to increase the volume for jenkins from 8 to 16GiB

Slack notification

add apps to slack

Copy the token

Now in manage jenkins, system->

Test the connection before saving

other popular triggers:

poll scm : jenkins will check for changes

schedules jobs

remote triggers (can be used with ansible)

Next: pushing to docker hub

Generate token, use with Global properties -> env vars

And we’re all set

Questions, suggestions always welcome.

Connect with me on X @ bhavyansh001, I am learning and building in public!

--

--

Bhavyansh @ DiversePixel
Bhavyansh @ DiversePixel

Written by Bhavyansh @ DiversePixel

Hey I write about Tech. Join me as I share my tech learnings and insights. 🚀

No responses yet