Getting Started with Jenkins

Getting Started with Jenkins

Β·

4 min read

What is Jenkins? πŸ€–

Jenkins is like a magical wand πŸͺ„ for developers! It's an open-source tool written in Java β˜• that dances to the rhythm of Continuous Integration and Continuous Delivery πŸš€. Think of it as a DevOps genie 🧞 that automates tasks. Jenkins helps make building, testing, and deploying software a breeze 🌬️ for all the devs out there. It's like having a helpful robot buddy in your coding adventure.

Jenkins is your trusty sidekick that speaks Java πŸš€. With its superpowers, it weaves CI/CD workflows called pipelines πŸ› οΈ. These pipelines are like well-choreographed dance routines for your code. 🩰 Just like adding toppings to a pizza πŸ•, Jenkins uses plugins to mix and match DevOps tools. Need to work with Git, Maven, Amazon EC2, or other cool stuff? πŸ› οΈπŸ”Œ Plugins got you covered!

Imagine being a bit lazy 😴 and letting technology do the heavy lifting. Jenkins is your tech butler πŸ€–. No more babysitting jobs! It takes care of completing one job and gracefully moving on to the next, all on its own. Isn't that awesome?

Curious about how to get started with this tech wizardry? Here's a spell for creating a Jenkins freestyle project: πŸͺ„

    1. Enter Jenkins and find the main dashboard πŸ–₯️.

      1. Spot the "New Item" button in the sidebar and give it a tap πŸ‘†.

      2. Whisper a name for your project, pick "Freestyle project" as the job style, and hit "OK" πŸ‘Œ.

      3. On the project setup page, choose source code management, set up triggers, create a comfy build environment, and define build steps. It's like decorating your project headquarters! 🏰

      4. In the build step, you can tell Jenkins the cool tasks you want it to do. Think of it like giving your robot buddy a to-do list πŸ—’οΈ.

      5. Once everything's set, chant "Save" and your project will come to life! πŸŽ‰

      6. Ready to see the magic happen? Click "Build Now" and watch Jenkins do its thing ✨.

Now you've got the power of Jenkins in your hands! 🌟 Let it automate, simplify, and sparkle up your coding journey. πŸš€πŸŒˆ

2. Create a freestyle pipeline to print "Hello World!!

Steps:

  1. Install Jenkins on AWS EC2 Ubuntu instance.

  2. For Jenkins used port 8080, browse instance-public-IP/8080 it will open the Jenkins dashboard.

  3. Click on the "New Item" button on the left sidebar.

Note: By now Jenkins should be installed on your machine(as it was a part of previous tasks, if not follow Installation Guide)

Step 1: Log into the EC2 instance. After logging in to the EC2 instance update the server as. First, we will update the system

Step 2: Install Java

sudo apt install openjdk-11-jre

step 3: Copy the curl command to install Jenkins

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io.key | sudo tee \   /usr/share/keyrings/jenkins-keyring.asc > /dev/null 
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \   https://pkg.jenkins.io/debian binary/ | sudo tee \   /etc/apt/sources.list.d/jenkins.list > /dev/null

And then we will update the server using the get update command

step 4: Install Jenkins using the command

step 5: Let's start Jenkins, before that open port 8080 on AWS in security groups as Jenkins listen to port 8080

First, we will enable Jenkins, then we will start Jenkins and then we will see the status of Jenkins

sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins

After this copy-paste the public address URL you will see Jenkins home screen as

  1. Now to login into Jenkins we need an admin password to get that copy paste the path and execute in your server as
sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Once you login inyo jenkins click on Install suggested Plugins as will install the plugins

  1. After installation, it will ask you to add an admin user as add your details and continue

After setting up we will be redirected to Jenkins's home screen

Now let us create the pipeline for Hello World in Jenkins

Click on the "New Item" button on the sidebar

  1. Give your project a name, select "Freestyle project" as the job type, and click on the "OK" button

  1. In the build section, we have an option β€˜Execute Shell’ by which we can write some commands or code:

No alt text provided for this image

6. In the command field, enter the command to print "Hello World", such as echo "Hello World!!".

7. Click on the "Save" button at the bottom of the page to create the project.

8. Once the project is created, click on the "Build Now" link to run the project.

You can now see changes in the Console output


Thank You ..... Happy Learning 😊 follow me on Linkedin

I appreciate you reading!! βœ…πŸ³

Did you find this article valuable?

Support DevOps_journey by becoming a sponsor. Any amount is appreciated!

Β