Thursday, December 26, 2024
Google search engine
HomeLanguagesJavaWhat is Jenkins?

What is Jenkins?

Jenkins is a tool that is used for automation, and it is an open-source server that allows all the developers to 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-endpoint automation.

Let us do discuss the necessity of this tool before going ahead to the procedural part for installation. Nowadays, humans are becoming lazy day by day so even having digital screens and just one click button in front of us then also need some automation. Here, I’m referring to that part of automation where we need not have to look upon a process(here called a job) for completion and after it doing another job. For that, we have Jenkins with us.

Installation of Jenkins in windows:

  1. Before installing Jenkins you should have already installed java on your device as above said it works on java, so it’s important to install and for that, you should install version jdk8. You can find the download it from the link provided. Make sure while downloading JDK8, choose a favorable option based on your OS (like windows X 64 bit), and then install the JDK8.
    • After installing java check it by using command prompt by java -version and this will show whether you have it or not.
  2. Now, go to the official website of Jenkins i.e. www.jenkins.io. Here you will have two options one is an LTS release and one is a weekly release. Download Jenkins for windows from the LTS section(recommended).
  3. After download, open that zip(compressed) file, and by right click and choose the all extract option extract the file. We are doing extraction to unzip the compressed file.
  4. After extracting, you can see a new folder of Jenkins. Open it and install Jenkins. After installing, it will automatically take you to the browser where localhost::8080 is running. 8080 is the by default port of Jenkins. And if the browser automatically doesn’t open then simply search localhost::8080.
    • After this, you will see the dashboard or interface of Jenkins. If you are installing it the first time then it will show you some plugins which are recommended to install. And then, you are ready to use Jenkins.

Procedure:

We will be creating a very basic job that will throw some output. So, let us begin. Creating and running a job on Jenkins  is as follows

Step 1: Click on a new item, and then you will have a page on which you have to give your name to your job and choose ‘freestyle project’ or any other option according to your need and then click ‘ok’.

Step 2: After this, you will reach a page where you have different options(like build, build triggers, source code management) that help you manage your job.

Step 3: Now, we will give some description of our job.

Step 4: Now, you have to provide which source code management tool you are using since here we are not using anyone so will choose the ‘none’ option.

Step 5: After this, if you want to give some triggers then you can choose accordingly even Jenkins provides us scheduled triggers. And you can choose to build an environment also accordingly. But, here we are making a simple job, so we are not using any triggers and build environment options.

Step 6: In the build section we have an option ‘Execute Windows batch command’ by which we can write some command or code.

 Step 7: Now, you can give the command according to your need.

Then click apply and save. So, your job is created.

Step 8: Now, we will run it for which click the ‘build now’ option and a building history will be created then click on it.

Step 9: Now, Click on console output, and you can see your output. Also, by console output, you can see whether your job is failed or successful.

By now we are over with the procedural part and Jenkins is installed on the machine. Lets us finally do discuss out the meaning of some terms listed as follows:

Console output- gives details on how/what it runs behind.
Run any job== build now.
The symbol of the sun means the success of your job.
The symbol of the cloud means the failure of your job.
The trigger means automatic run and also we can give a schedule in it.

Key Points to Remember:

  • Since we know in open source we use git and GitHub and to do automation we have to make interact Jenkins with GitHub so you need plugins to do so. And the plugin is nothing other than a software program that adds some important features to the existing one. Why plugins? Jenkins knows how to clone from GitHub and integrate, but plugins give it a mind to understand various commands of git.
  • Whenever a job is downloading a file/folder so that Jenkins has to provide a space and that space is known as workspace. Normally, we use Jenkins for job chaining.
  • Job chaining– Connecting the jobs with each other that is whenever the earlier job will run fine then Jenkins will go to the next job. This is also known as a pipeline. For example- Suppose you have made 3 jobs in Jenkins and you want them to run when the earlier one completes. So, when Job1 has been run already then Job2 will run and then Job3. So to do this, copy earlier job in copy tab and from triggers choose ‘build after other projects’ option. Here, Job2 is upstream with respect to Job3 and downstream with respect to Job1.
  • Install pipeline plugins to have a better view because by this we can visualize for upstream and downstream. By default, we can run only two jobs parallel in Jenkins. But we can also run more jobs parallel, and it depends on your RAM of OS.
RELATED ARTICLES

Most Popular

Recent Comments