Creating a  simple freestyle project with Jenkins

Creating a simple freestyle project with Jenkins

Freestyle Project with Jenkins

Creating a  simple freestyle project with Jenkins:

In my previous blog we have studied installing steps for the Jenkins from scratch. In this blog we will be going to create a simple freestyle project.

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 to 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 from "Build Steps" we have an option ‘Execute shell’ 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: Once a Job ran successful click on that job and go to the console output to check the logs.

& Job executed successfully.

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.