Create a first basic Job in Jenkins

In this blog post, we’ll learn how to create a very basic job in the Jenkins. First, login to jenkins with your credentials. From left pane, select new item.

Select new item to start creating new jobs.JPG
Select new item to start creating new jobs

If you are unable to see this icon, it means that you don’t have sufficient privileges. In the next window, type the name of the job such as first job and select job type as free style job and then click ok:

Select type of job.JPG
Select type of job

In the next window, we’ll leave default options unchanged. Move to build tab and select add build step:

Add build step to the new job.JPG
Add build step to the new job

This list may vary a lot depending upon the plugins installed for Jenkins environment. For now, since this is a very basic job, we’ll just select ‘Execute shell’ and enter following command:

pwd
ls -al

If you have installed jenkins on a window machine, select ‘Execute windows batch command’ from the list, and then enter this command in the build step:

dir

cd\

dir

and click save. Once it’s done, click build now from left pane of the job:

Select build now from left pane of the job.JPG
Select build now from left pane of the job

Once you click, in the left pane only, under build history, you would notice that a new line with a number pops up along with a progress bar on it like this:

build-history-after-you-start-building-your-project

This means that, we have started first build for our job. Once the job is completed successfully, the icon ball color will turn from grey to blue and progress bar will go away. This build number keeps increment every time with the project build. Again, it can be customized to your choice. Once the build is complete, you would notice the time of build completion in front of build no. Along with it, there is a small black triangle which can be used to see various details with the build:

build-job-details

For now, we’ll click on the console output so that we can see logs generated for this build. It should be something like below:

Build Job output.JPG

In the ouput, we can see various useful details such as who started the build, what is the workspace for the build, what was the command executed by hudson for the build along with the project name, and offcourse, output related to our commands. In the last, we would also see the overall status of job as successfully completed or not.

One thought on “Create a first basic Job in Jenkins

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s