Day 22: Getting Started with Jenkins: Automate Your Software Development with a Freestyle Pipeline

Day 22: Getting Started with Jenkins: Automate Your Software Development with a Freestyle Pipeline

What is Jenkins?

Jenkins is a tool that helps software developers and IT teams to automate parts of the software development process. Imagine you're building a house. Instead of manually laying every brick and hammering every nail yourself, you use machines to do some of the repetitive tasks, making the construction faster and more efficient. Jenkins acts like those machines but for building software.

Here’s how Jenkins works in simple terms:

  1. Automation: Jenkins automates repetitive tasks. For example, every time you make changes to your code, Jenkins can automatically check if your changes break anything by running tests. It can also build your application and deploy it to a server without you having to do it manually.

  2. Continuous Integration: This means Jenkins helps in merging code changes from multiple contributors into a shared project frequently, often several times a day. This helps to detect problems early.

  3. Plugins: Jenkins is highly flexible because it has a lot of plugins. Think of plugins like apps on your smartphone. They add new features or integrate with other tools. For example, there are plugins to work with different code repositories, testing tools, and deployment platforms.

  4. Pipelines: Jenkins allows you to create pipelines, which are sequences of automated steps that take your code from development to production. For instance, a pipeline might include steps to fetch the latest code, build it, run tests, and then deploy it to a live server if all tests pass.

In summary, Jenkins is like a helper robot for developers. It takes care of the tedious and repetitive parts of software development, making the process faster, more reliable, and less prone to human error.

Tasks

  1. What is Jenkins in own language?

Jenkins is a tool that automates parts of the software development process. It helps us make sure our code works correctly and gets deployed smoothly.

Key Points:

  1. Automation: Jenkins can automatically run tests and build our software every time we make changes, saving us from doing these tasks manually.

  2. Continuous Integration: It helps us merge changes from multiple developers frequently, which makes it easier to catch and fix problems early.

  3. Plugins: Jenkins has many plugins, like apps on a phone, which add extra features and allow it to work with other tools we use.

  4. Pipelines: We can set up pipelines in Jenkins to define a series of steps (like testing and deployment) that our code goes through automatically.

In a nutshell: Jenkins is like an assistant that handles repetitive and error-prone tasks in software development, making our workflow faster and more reliable.

  1. Create a Freestyle Pipeline to print "Hello world!"

To create a freestyle pipeline in Jenkins. Open your Jenkins server on :8080 port. Below screen will appear

sign in with your username and password. When you first time start the Jenkins server it will ask you to get the password from this location

/home/sh/.jenkins/secrets/initialAdminPassword

then reset the password.

after resetting put the username and password to login into the server then below screen will appear

  • Click on create a job

  • Enter the name and click on Freestyle project

  • Give the description as you need

  • after that scroll down and click on add build step in the Build Step section.

  • A drop down menu will appear. Click on execute shell

  • Write the syntax in bash format as
echo "Hello World!"

and click on the save button at the bottom.

After you click on save the below screen will appear

  • Click on Build Now button the left side

  • Your build will happen below

  • Click on #1 to see all the logs and configurations

  • click on console output on the left to see the result

As you can see the project is properly built and we got the proper output

~Dipen : )

Did you find this article valuable?

Support Dipen's Blog by becoming a sponsor. Any amount is appreciated!