Jenkins for CI/CD — DevOps Project 06
In this project, we will integrate CI/CD principles in our EventApp application.
Links:
- Docker hub: https://hub.docker.com/repository/docker/bhavyansh001/eventapp/general
- EventAPP: https://github.com/bhavyansh001/EventApp/tree/jenkins
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:
- (When dev pushes code, Jenkins…) Clones code from GH using webhooks
- Builds docker image
- Runs RSpec tests
- 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!