Jenkins Beginner Tutorial 7 - Getting started with JOBS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello and welcome to this series on Jenkins beginner tutorial This is the seventh session and today we are going to see how can we get started with jobs in Jenkins So we are going to learn How can we create some basic jobs in Jenkins What are the basic configurations We will also run our jobs remotely and we will also see how can we change the execution of our jobs? Okay, so let us begin and let us see what is our step one So we have to go to our Jenkins and we have to create a new item and then we have to add details of the item So I am going to my Jenkins and you see new item here So just click here and you will be taken to the details to enter the name of your project or the job So let me say the name is Test one, okay, and you can select a freestyle or a multi-configuration project for this session Let us go with the freestyle project and click on OK Okay So as soon as you click on OK you will be taken to this window where you can provide different details for a job So we have these five sections available. As of now General source code management will trigger build and post-build actions So let us go to General So here you can provide a very quick description to your projector job So let me say this is Test project 1 and if I click on preview, this is how it will look like and as we have seen in our earlier session we can also use HTML tags So I am using tag H2 here Okay, and let me preview and now this is how my description will look like Okay So this is how we can give the description to our project Okay, then let us go to source code management So here in case you want to take the build from any Source code system like a get or a subversion, you will get the details here We will need to add plugins for those source code repositories which we have not added as of now In the coming sessions, we will see how exactly we can get our build and Trigger our job from a source code management system. Let us go to build triggers now in build triggers you have different options You can trigger the build remotely Okay, and we can build after other projects are built We can build periodically or pol sem OK Pol sem means that we have our source code management system. And in case we have configured with any SCM like a get repository as soon as a build takes place in that repository of a job should get executed Okay in the coming session, we will exactly see how can we use this option? But for this session, let me explain you what does build periodically means Okay So build periodically means that we can assign some expression here and based on that expression Our job will be executed at some particular double okay and to know exactly how we can configure this you can click on this help icon and it will show you exactly what or all the parameters so we have to give our syntax in this form okay and here are all the values that can be used for minute it is 0 to 59 for hour it is 0 to 23 and so on right and it keeps a very good description that what all you can use you can use so for example I want to say I want to give star in all my parameters I will give a space between these star and as soon as I click outside Jenkins gives me a message do you really mean every minute when you say star star star star okay so it also gives you what will happen if you give this expression so the last one would have been at this Time in the next one will be at this particular time, which is exactly the same time So we are making our Jenkins to run this job every minute,right If you want some other interval you can say let us say this is every 15 minutes we can use this expression Okay, and here now it is saying the last one would have been at 5:54 next will be at 6:09 So there is a gap of 15 minutes so we can you know, assign a fixed periodic interval to our jobs using this crone expression So as of now, let me just put star star star star which means every minute and we will see exactly what happens in this case. Okay, so I'm just leaving it as it is Okay, let us go to build Now in builds you can add any build step as of now We are getting very basic steps because we have not added many of the other plugins which we will see in the next sessions for now Let us select either a Windows batch command or execute shell if you are on Windows You can select execute Windows batch command Okay, and then you can give some command like dir or date or any command that can be executed on command prompt For me, it should be a shell because I am recording this tutorial on a Mac So I will say execute shell and I'll give some command liked it. Okay now coming to post build actions Now, this is very important because after you build your project you will need to do something For example, you want to build some other project after this particular project is completed or you want to send out some report notification or you want to trigger some acceptance test of performance test, right? So this is where this section is used for again We will not use it for this session, but we will use it in the next sessions as of now I'm leaving it blank and I will click on apply Okay, this is saved and I will save and this is my project page. I will go back to my dashboard And now I can see my project here, right It is here, right So in the dashboard you have different columns The First Column is the status of the last build So this is gray because it is not built at all Once we build it It will turn to Blue if it's successful or red if it is unsuccessful So let me just build it I can just go from here and say built now Or I can also go to the my project page and save built now Okay, so it will build I can look at the I can go here and look at the console output So see we executed the date command it executed successfully So the status is Success If you go back to our dashboard we can see now this has turned to blue because the last one was successful then we have our next column which is a weather report showing aggregated status of recent build Now, what does this mean is this column? Into account the last five runs of this particular job or project and based on the count of success of failures in the last five runs this icon gets changed Right So now if you see it is saying build stability No reason built failed if I go to configure project and let me make some mistake I am saying dat instead of dat which is actually wrong and it should fail, right Right now I will save it Okay, I will built my project and now did you see this ball turned red because it is based on the status of the last build and this is based on the status of the last five wheels So it is saying one out of four bills failed and that is why it turned to a cloudy Sun if I run it again Let us see this will change Now see it has again turned to a rainy Cloud because last three out of five build's failed if I run it again Now you can see it has again change and it is saying of last five Builds failed Now again, if we make the corrections and say this is date Let me build my project Now see you can see the build history here as well on your project home page You can see all these details Okay, and you can configure go to configure project from here. You can delete the project you can build now you can go to your workspace You can see what all changed and then the entire history of your builds is here You can click on any of the records here Okay, and you will get exactly what happened in that build Right, you can see the console output So what exactly happened is we executed the wrong command and this is the error message command not found and that's why it's a failure right so you can go like this Okay. This was a success So this page becomes very handy, if you want to look at what exactly happened in any of the previous built, what was the time it was executed and so on if you go to the dashboard again for every project you will get what was the last success?Okay, which build was the last success?What was the last failure how much time it has been and what was the build number that failed and what was the duration of your last build Okay, so this is how you can configure a very basic project also, let us look at How can you trigger the job remotely Okay, so I'll let us go to our project and let us go to configure Okay, let us go to build triggers Okay Now I am I will turn this one as off and I will say Triggers builds remotely Okay, and as soon as I click here Jenkins gives me this URL Okay This is the URL What I can do is I can just copy it from here go to a different tab of my browser paste it this particular section Jenkins URL. I have to change with my URL So as of now I am on localhost So I'll just say localhost:8080 Okay, and this Is the token name So that token name is whatever you will provide here So you can provide some complex string here So it is kind of a password for this session I'm just saying one two, three four, and I will say the same token here 1 2 3 4 Okay, and I will just say apply and save I will go to my Jenkins dashboard and you can see this is test one and it was last executed Let me go here and last it was executed at 6:12 a.m Okay, which was built number 11 Okay. So let me again go to my Jenkins dashboard Okay. So the last bill was built number 11 Now what I am doing is I am just going to any other system or any other browser so you can actually give your IP here instead of localhost and then you can execute this command from any other machine as well Which can connect to this particular Jenkins machine So I'm just joining this Okay, I go back to my Jenkins And did you see this build Queue So my test one project is Queued already Okay, and now we can if I again go to refresh it, you can see the last success was four seconds ago and built number 12 has already been executed Okay, so we triggered this build From outside We did not trigger it from within Jenkins, but from outside So this is how you can trigger your jobs from outside Okay Let us also see how to chain job executions Okay, so for that, let me create quickly create two new project I will create test to and freestyle project And I will just give some command here or execute shell Any command apply and Save Let me create another project test3 This is also a freestyle project and again give let me give some Shell command That's it save and yes, see now I have three project test1 test2 and test3 Let me go to test2 And go to configure Now I go to build triggers and here I am saying Built after other projects are built So the trigger for this particular project will come from another project And as soon as the that project will get completed This project should get built So here I am giving the name of the project Which is test1 you can give multiple project names here But as of now, I just want a single project Okay, and I can also select trigger only if build is stable or trigger even if the build is unstable trigger even if the build fails so as of now I am saying that only if the built is stable for test one project then built this particular project Okay, I will say apply Okay, and then in the post built actions, I will select build other projects Okay So this is a post build action that after this particular particular project is built I want to build another project which is test3 And again, you can give multiple projects here and I am seeing trigger only if the build is stable and I will say apply and save okay now you can see what tests to there is no build history. Let us get back to dashboard and go to test3 Let us go to the dashboard You can see for test2 There is no execution for test three as well as there is no execution So let me run test1 Now As soon as our test1 is completed test2 should get executed And as soon as our test2 is completed test three should get executed and this is how we have changed these three projects. So let me go and run my test1 Okay, so test1 got executed You can see in the queue we have test2 now And now you can see in the build Queue We have test3 now So test3 is getting executed Okay, so see test2 got executed 1.5 seconds ago and there is one built of this particular project I will refresh it again test 3 does not have anything as soon as I refresh it You will see even test3 got executed So if I go to tests to there is one built And test3 again there is one built So this is how we can change our projects and their executions Okay So This was all about very basics of job There is a lot more to learn and in the coming sessions We will go very deeply and we will see how exactly we manage different configurations and how we take our code from a repository and how can we trigger from a gate or a subversion Okay Hope you like it Thank you.
Info
Channel: Automation Step by Step
Views: 229,135
Rating: undefined out of 5
Keywords: jenkins, jenkins jobs, jenkins basics, jenkins introduction, basic jenkins, learn jenkins, jenkins beginner tutorial, how to run a job, Getting started with JOBS, basic job configuration in jenkins, how to trigger job, jenkins remote trigger, jenkins remote execution, jenkins job chaining, jenkins job configuration, jenkins how to, jenkins step by step for beginners, learn jenkins from scratch
Id: 63HEKFh8T2c
Channel Id: undefined
Length: 17min 52sec (1072 seconds)
Published: Sat Sep 10 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.