Example for the Complete Jenkins CI/CD Project
Task-1
Fork this repository
Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.
- ssh-keygen generates public and private key-pair. These keys are used for integrating Jenkins project with git repository
id_rsa --> private key
id_rsa.pub --> public key
- To add ssh keys to github, Go to settings.
- Go to SSH and GPG keys.
- Select key-type Authentication key. Add public key that was created using ssh-keygen.
cat id_rsa.pub
In Jenkins, verify github integration plug is installed and enabled.
Configuring Jenkins:
- Open Jenkins Dashboard and click on “New Item” on the left menu
2. Enter the name and select “Freestyle project”
3. In the configure page, provide the github url and mention the appropriate repository branch.
Add private key which was created using ssh-keygen command in the credentials section.
4. Under “Build Trigger” select “GitHub hook trigger for GITScm pollling”.
5. Under “Build Steps” , select “Execute Shell” and add an echo statement and click “Save”.
6. Verify that the build is successful.
- Read About GitHub WebHooks and make sure you have CI/CD setup
Webhooks allow you to build or set up integrations, such as GitHub Apps or OAuth Apps, which subscribe to certain events on GitHub.com. When one of those events is triggered, we’ll send a HTTP POST payload to the webhook’s configured URL. Webhooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server.
Adding Jenkins Webhook in Github
Open github repository
Go to “settings” and then “Webhooks”
Click “Add webhook” button. The payload url will be “<Jenkins url>/github-webhook/”. Click on Add webhook.
Task-2
- In the Execute shell run the application using Docker compose
- You will have to make a Docker Compose file for this Project (Can be a good open source contribution)
- Run the project and give yourself a treat :)
The build is successful. It can be viewed from console output.
We can verify that the docker container is up and running
Browse public IP address with port 8001.
Since we have integrated the github and jenkins, whenever there is a change in code in github (new commits), new jobs are automatically build and deployed in Jenkins.
Subscribe to my newsletter
Read articles from Shuvojit Kar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Shuvojit Kar
Shuvojit Kar
Welcome to my Profile! I'm grateful to share about myself, Call me And mail shuvokarjit@gmail.com Shuvojit Kar. Relevant Work Experience 8Yrs , Project and Skill 7 Yrs Experience. 🌐Linux Linux Professional Institute Certificate Technical Writer \ Cloud Networking Cloud Computing \ Cloud Infrastructure Cloud Consultant \ Customer Engineer 🌐Virtualization - VMware, vSphere, vCenter Server 🌐Programming Skill Technical Skills Proficiency in languages like Java, Python, Scala, or JavaScript. System Administration: Experience with Linux/Unix systems, Windows Server. Networking: Understanding of network protocols, routing, VPC, Subnets, Firewalls, VPNs, Load Balancers, switching, and firewall configurations. Cloud Platforms: Experience with AWS, Azure, or Google Cloud Platform. Databases: Knowledge of SQL and NoSQL databases like MySQL, PostgreSQL, MongoDB. Scripting: Ability to write scripts for automation using Bash, PowerShell, or similar. Monitoring and Logging: Familiarity with tools like Nagios, Prometheus, Grafana, ELK Stack. Configuration Management: Experience with tools like Ansible, Puppet, Chef. DevOps: Knowledge of CI/CD pipelines, Jenkins, Docker, Kubernetes. Security: Understanding of security best practices and tools, Cloud security best practices, IAM, Security Groups, Compliance. Infrastructure as Code: Terraform, CloudFormation, Ansible Compute Services: EC2, GCE, Azure VMs. Storage Solutions: S3, GCS Customer Service Skills:- Communication: Strong verbal and written communication skills. Problem-Solving: Ability to diagnose and resolve technical issues efficiently. Interpersonal Skills: Building and maintaining relationships with clients. Training and Education: Ability to conduct training sessions for clients. Project Management: Managing customer projects and ensuring timely delivery. Knowledge/experience in configuring and supporting devices such as Cisco, Juniper, Checkpoint, etc. Knowledge Cloud Migration, Presale, Data Center relocation, Go-to-Market Strategy. Certifications: AWS Certified Solutions Architect Microsoft Certified: Azure Solutions Architect Expert Google Professional Cloud Architect Certified Kubernetes Administrator (CKA)