Day 22 - Getting Started with Jenkins

Day 22 - Getting Started with Jenkins

ยท

3 min read

Bingo! Starting with the CI/CD pipeline tool Jenkins today ๐ŸŽ‰

Need of CI/CD automation

Help the lazy stay lazy... haha!

Jokes apart, automation in CI/CD is essential to avoid frequent errors that could cost the company a lot more money to pay for the services used (like cloud or other infrastructure).

The automation also speeds up the process overall.

What is CI/CD?

CI/CD stands for Continuous Integration/Continuous Delivery or Deployment, which is a set of practices and principles in software development. It is essentially to automate the tedious and time-consuming process of building, testing and deployment in a code-base.

  1. Continuous Integration

    • CI is the practice of frequently integrating code changes into a shared repository, typically multiple times a day or whenever a developer makes a change.

    • Thanks to CI that the code changes by various developers is merged in a central repository where automated builds and tests are triggered.

    • Main goal of CI : To detect and address early errors that may arise during integration in the development cycle.

  2. Continuous Delivery and Deployment

    • CD is an extension of CI to provide automated delivery of code changes to production or staging environments.

What is Jenkins?

  • Jenkins is an open-source software tool used to automate CI/CD in the DevOps domain.

  • It is written in Java programming language.

  • It is used to implement CI/CD workflows, also called pipelines.

  • It provides end-to-endpoint automation.

  • The need for a tool like Jenkins becomes essential when deploying to a microservices architecture.

What are plugins in Jenkins?

  • Plugins are but an enhancement to the Jenkins system - like the 'browser addons'.

  • They simply extend Jenkins capabilities and assist integration of Jenkins with other software.

  • Jenkins provides plugins which may help DevOps engineers in various domains like version control - Git, BitBucket, container runtime systems - docker, virtual machine hypervisors - VMware, public cloud - AWS, GCP and private cloud - OpenStack. These are just few domains, there are many more than this.


Task - Create a Jenkins account

  1. Download the docker image of Jenkins with the command :
docker pull jenkins/jenkins:lts

Note that the regular image is deprecated which you might be tempting to get from docker pull jenkins. But it won't get you the lts version :

  1. Use the following command to run the docker container of Jenkins :
docker run -p 8080:8080 -p 50000:50000 -d -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts

You can use any other directory from your machine, I chose the /var/jenkins_home.

  1. Get the password from docker logs <container_ID> and enter the password to redirect to the following page :

  2. Navigate to the URL localhost:8080 on your browser to land on the login window.

  1. Setting up Jenkins URL :

  1. You are now ready to shoot!

Task - Freestyle project : Hello World

Jenkins Welcome Window

Creating Freestyle Project - Hello World

Setting up build environment

Write the script for printing the "Hello World" here.

Build the image

Click on the build version

Check the output on the console

Done! Your first FreeStyle Jenkins project is complete ๐Ÿฅณ

Happy Learning ;)

ย