Getting Started with Jenkins | Day 22 of 90 Days of DevOps

Ajit Fawade
4 min readAug 15, 2023

--

Hello, everyone!

I am back with another blog post on my DevOps learning journey with 90DaysOfDevops. Today, I will introduce you to Jenkins, a popular tool for automation and continuous integration and delivery. I will also show you how to create a simple freestyle pipeline that prints Hello World using Jenkins.

What is Jenkins?

Jenkins is an open-source automation server written in Java that helps build, test, and deploy software. It works or runs on Java as it is written in Java. By using Jenkins, we can make a continuous integration of projects (jobs) or end-to-end automation.

Jenkins supports various version control tools such as Git, SVN, CVS, etc., and can execute different types of projects such as Ant, Maven, Gradle, etc. as well as arbitrary shell scripts and Windows batch commands.

Jenkins also provides many plugins that extend its functionality and allow us to customize our pipelines according to our needs.

Jenkins has two main components:

  • Jenkins master: The main server that manages the configuration and scheduling of the jobs and communicates with the agents.
  • Jenkins agent: The node that executes the tasks assigned by the master and reports the status back to the master.

Jenkins uses a web-based interface that allows us to create, configure, monitor, and manage our jobs and pipelines.

How to Create a Simple Freestyle Pipeline in Jenkins?

A freestyle pipeline is a type of build job in Jenkins that allows us to configure any build job using a graphical user interface. It is flexible and easy to use for beginners.

To create a simple freestyle pipeline that prints Hello World in Jenkins, follow these steps:

1. Go to your Jenkins dashboard and click on New Item.

2. Enter a name for your pipeline (e.g., Hello World) and select Freestyle project. Then click OK.

3. On the configuration page, you can add some description for your pipeline if you want.

4. Under Source Code Management, select None since we are not using any version control tool for this pipeline.

5. Under Build Triggers, you can choose when you want your pipeline to run automatically. For example, you can select Build periodically and enter a cron expression (e.g., * * * * *) to run your pipeline every minute. For this example, we will leave this section blank and run our pipeline manually.

6. Under Build, click on Add build step and select Execute shell (or Execute Windows batch command if you are using Windows). This will allow us to run any shell or batch command as part of our pipeline.

7. In the text area that appears, enter the command echo "Hello World" and click Save.

8. Now, go back to your Jenkins dashboard and click on your pipeline name (e.g., Hello World). Then click on Build Now to run your pipeline.

9. You will see a new build number appear under Build History with a blue ball indicating that the build is in progress. You can click on it to see the details of the build.

10. Click on Console Output to see the logs of the build. You should see something like this:

Congratulations! You have successfully created and run a simple freestyle pipeline that prints Hello World in Jenkins.

I hope this blog post helps you understand the basics of Jenkins and how to create a simple freestyle pipeline.

In the next blog post, I will show you how to create more complex pipelines using different types of projects and plugins.

If you have any questions or feedback, please feel free to contact me on:

Thank you for reading! 😊

--

--

No responses yet