Jenkins

Jenkins

·

3 min read

What is Jenkins?

Jenkins is an open-source DevOps tool that automates the CI/CD process. The term CI/CD refers to continuous integration, continuous deployment/delivery.

Continuous integration involves code building and testing, the code

As we all know any software goes through the basic steps of code, build, test and deploy before its production ready. Jenkins can be used to automate all these steps.

Jenkins works and runs on Java as it is written in Java. Any other tools that are needed to achieve the complete CI/CD process can be installed through plugins.

What is a job/pipeline?

A job/pipeline in Jenkins refers to a unit of work that Jenkins can execute, such as building a software project, running tests, deploying applications, or performing any other automated task.

Jenkins installation

Click the link (Jenkins installation link) to install Jenkins on your system. Be sure to install java before installing Jenkins.

Follow these steps to set up Jenkins on an EC2 ubuntu instance.

  1. Jenkins runs on port 8080, so make sure to add a rule in the security group for inbound SSH traffic (You can refer to this link to learn how to add a rule in the security group)

  2. You can access Jenkins browser by appending the port no to your IP address(you can find your IP address in your instance details) in my case it is 34.211.230.88:8080

  3. The Jenkins server opens up to this page where you are supposed to unlock Jenkins.

    To do this , you need to enter the security token from the path /var/lib/jenkins/secrets/initialAdminPassword .

    We can use the command below command to fetch the token

    sudo cat /var/lib/jenkins/secrets/initialAdminPassword .

  4. Once the token is pasted, click "Continue" and the following page opens up.

    Click on "Install suggested plugins"

  5. Next, create the First Admin User by entering the required credentials

    Now, we can start using Jenkins

What is a Freestyle project?

A freestyle project refers to a type of project that allows you to configure and customize various aspects of our build and deployment process using a flexible, user-friendly interface.

Here, we have the freedom to define our build steps, specify the source code management system (such as Git or Subversion), configure build triggers, set up post-build actions, and more.

Freestyle project to display Hello world

  1. To display "Hello world"

    1. Click on "New Item" or "Create a new job"

    2. Enter the project name "display-hello-world" and select "Free style project" and click "OK"

    3. Enter the project description, "This job displays the phrase "Hello world!"

    4. Scroll down and select "Add build steps"

    5. Enter the shell script to display hello world and "Save"

    6. Press "Build now" button. The build starts and you can find in the bottom left corner that the build**(#1**) is successful.

    7. To view the output, click on the #1 and then "Console output"

We can see that code is successfully built displaying the required output "Hello world!"