Sunday 27 August 2017

Creating Jenkins Job Is This Much Easy !!!

ad300
Advertisement

I am assuming that if you are looking how one can create a job in Jenkins, you have Jenkins Installed. If you still want to know how Jenkins can be installed please click here.

Create a Jenkins Job

Lets us begin creating a new job:

  1. Once you are done installing Jenkins, you will be taken to the Home page, where you will see the option to create a new job Or you can click "New Item" on the top left-hand side.
  2. Now Enter the suitable name for your Job, select freestyle option and click ok button.
  3. Now you are on the configuration page of your job. Jobs are configured based on your project requirements, Here I will be covering basic configuration that will help you in getting started.
  4. Under General Tab, enter the details related to your job. Giving Job description is important which will help someone to under stand what is this job about and this becomes very important when there are a lot of jobs added to the Jenkins. I have given the value of 30 but you can give any value for "Days to keep builds".
  5. Slave Node Configuration: Now you can mention the remote VM where your automation will be executing. This option will only be visible if you have added a Node as a slave to the Jenkins (Please click here to how to add a Node to Jenkins). If there is no node available then the Jenkins machine itself will behave as a slave and will execute test on the same machine where Jenkins has been installed. This execution may happen in Headless mode (means, you won't be able to see the execution going through), but you will be able to see the proceedings in the Jenkins console. 
  6. As we are just doing the basic configurations, we can leave Source Code Management and Build Triggers, to make the job creation simple to understand.
  7. Build Setup: This is the where you can specify what you want to execute. Suppose I am executing one of my Ruby files at a specific location then I would to the following configuration. First, you need to click "Add Build Step" and select "Execute Shell" and then add below lines, you can do a similar setup for executing batch files, java files etc.
  8. For the testing purpose, I am adding "Execute Windows Batch Command" and executing the command "@echo off title This is your first batch script! echo Welcome to batch scripting! pause"
  9. Click Save button to save all your configurations.
  10. You will be navigated back to the Job.
  11. These are the basic configurations that can be done for your project.
  12. If you want to add few more configurations you can click "Configure".
  13. Now you are ready to execute your first job 😊
  14. Click Build, This will execute your job.
  15. Now click on the job just executed and click console output.
  16. You will find the execution log for the job just executed. Ball Color turns Blue if the build is successful. It turns Red if there is an error in the build.
Hope this info was useful to you. Do let me know if you need more details related to the job creation.

Share This
Previous Post
Next Post

Welcome to my blog, I am Subhash Junas, I have been working on Core Java, Ruby, Selenium, Cucumber and on various automation technologies from past couple of years. I love to work on new challenges, solving problems and obstacles.

0 comments: