Jenkins Beginner Tutorial 7 - Getting started with JOBS

Jenkins Beginner Tutorial 7 - Getting started with JOBS


Jenkins Beginner Tutorial 7 - Getting started with JOBS

Tool to generate cron expression - http://www.cronmaker.com/
Free Tutorials - https://automationstepbystep.com/
Jenkins Beginner Tutorial 7 - Getting started with JOBS
Today we will learn:
———————————
1. How to create a basic JOB in Jenkins
2. Basic job configurations
2. How to run the Job remotely
4. How to chain Job Execution


Step 1 : Jenkins - New Item - add details

Step 2 : How to trigger the job remotely

Step 3 : How to chain job executions

====================================== .
.
_______ ONLINE COURSES TO LEARN _______

Visit - http://automationstepbystep.com/

----------- UI TESTING -----------
Selenium Beginners - https://bit.ly/2MGRS8K
Selenium Java Framework from Scratch - https://bit.ly/2N9xvR6
Selenium Python - https://bit.ly/2oyMp5x
Selenium Tips - https://bit.ly/2owxc50
Selenium Builder - https://bit.ly/2MKNtlq
Katalon Studio - https://bit.ly/2wARFdi
Robot Framework - https://bit.ly/2Px6Ue9

----------- API TESTING -----------
Web Services (API) - https://bit.ly/2MGafL7
SoapUI - https://bit.ly/2MGahmd
Postman - https://bit.ly/2wz8LrW
General - https://bit.ly/2PYdwmV

----------- MOBILE TESTING -----------
Mobile Playlist - https://bit.ly/2PxpeUv

----------- CI | CD | DEVOPS -----------
Jenkins Beginner - https://bit.ly/2MIn8EC
Jenkins Tips \u0026 Trick - https://bit.ly/2LRt6xC
Docker - https://bit.ly/2MInnzx

----------- VERSION CONTROL SYSTEM -----------
Git \u0026 GitHub - https://bit.ly/2Q1pagY

----------- PERFORMANCE TESTING -----------
JMeter Beginner - https://bit.ly/2oBbtIU
JMeter Intermediate - https://bit.ly/2oziNVB
JMeter Advanced - https://bit.ly/2Q22Y6a
JMeter Tips \u0026 Tricks - https://bit.ly/2NOfWD2
Performance Testing - https://bit.ly/2wEXbLS

----------- JAVA -----------
Java Beginners - https://bit.ly/2PVUcXs
Java Tips \u0026 Tricks - https://bit.ly/2CdcDnJ

----------- MAVEN -----------
Maven - https://bit.ly/2NJdDRS

----------- OTHERS -----------
Redis- https://bit.ly/2N9jyCG
Misc - https://bit.ly/2Q2q5xQ
Tools \u0026 Tips - https://bit.ly/2oBfwoR
QnA Friday- https://bit.ly/2NgwGpw
Sunday Special - https://bit.ly/2wB23BO

Ask Raghav- https://bit.ly/2CoJGWf
Interviews - https://bit.ly/2NIPPxk
All Playlists - https://bit.ly/2LSiezA


----------- Follow -----------
Facebook - https://www.facebook.com/automationst
Twitter - https://twitter.com/automationsbs
Youtube -    / automationstepbystep  


Content

2.48 -> Hello and welcome to this series on Jenkins beginner tutorial This is the seventh session
7.63 -> and today we are going to see how can we get started with jobs in Jenkins So we are going
12.8 -> to learn How can we create some basic jobs in Jenkins What are the basic configurations
18.4 -> We will also run our jobs remotely and we will also see how can we change the execution
24.9 -> of our jobs?
25.99 -> Okay, so let us begin and let us see what is our step one So we have to go to our Jenkins
34.19 -> and we have to create a new item and then we have to add details of the item So I am
42.41 -> going to my Jenkins and you see new item here So just click here and you will be taken to
49.69 -> the details to enter the name of your project or the job So let me say the name is Test
56.489 -> one, okay, and you can select a freestyle or a multi-configuration project for this
62.55 -> session Let us go with the freestyle project and click on OK Okay So as soon as you click
69.91 -> on OK you will be taken to this window where you can provide different details for a job
76.36 -> So we have these five sections available.
79.18 -> As of now General source code management will trigger build and post-build actions So let
87.13 -> us go to General So here you can provide a very quick description to your projector job
92.68 -> So let me say this is Test project 1 and if I click on preview, this is how it will look
100.72 -> like and as we have seen in our earlier session we can also use HTML tags So I am using tag
108.6 -> H2 here Okay, and let me preview and now this is how my description will look like Okay
115.7 -> So this is how we can give the description to our project Okay, then let us go to source
122.6 -> code management So here in case you want to take the build from any Source code system
130.17 -> like a get or a subversion, you will get the details here We will need to add plugins for
136.409 -> those source code repositories which we have not added as of now In the coming sessions,
141.349 -> we will see how exactly we can get our build and Trigger our job from a source code management
148.43 -> system.
150.06 -> Let us go to build triggers now in build triggers you have different options You can trigger
155.829 -> the build remotely Okay, and we can build after other projects are built We can build
162.239 -> periodically or pol sem OK Pol sem means that we have our source code management system.
170.81 -> And in case we have configured with any SCM like a get repository as soon as a build takes
176.909 -> place in that repository of a job should get executed Okay in the coming session, we will
182.269 -> exactly see how can we use this option?
185.29 -> But for this session, let me explain you what does build periodically means Okay So build
191.349 -> periodically means that we can assign some expression here and based on that expression
197.549 -> Our job will be executed at some particular double okay and to know exactly how we can
204.569 -> configure this you can click on this help icon and it will show you exactly what or
212.069 -> all the parameters so we have to give our syntax in this form okay and here are all
218.54 -> the values that can be used for minute it is 0 to 59 for hour it is 0 to 23 and so on
225.62 -> right and it keeps a very good description that what all you can use you can use so for
231.519 -> example I want to say I want to give star in all my parameters I will give a space between
239.92 -> these star and as soon as I click outside Jenkins gives me a message do you really mean
248.68 -> every minute when you say star star star star okay so it also gives you what will happen
255.62 -> if you give this expression so the last one would have been at this Time in the next one
262.16 -> will be at this particular time, which is exactly the same time So we are making our
266.1 -> Jenkins to run this job every minute,right If you want some other interval you can say
273.35 -> let us say this is every 15 minutes we can use this expression Okay, and here now it
282.23 -> is saying the last one would have been at 5:54 next will be at 6:09 So there is a gap
287.6 -> of 15 minutes so we can you know, assign a fixed periodic interval to our jobs using
294.94 -> this crone expression So as of now, let me just put star star star star which means every
300.25 -> minute and we will see exactly what happens in this case.
304.91 -> Okay, so I'm just leaving it as it is Okay, let us go to build Now in builds you can add
311.88 -> any build step as of now We are getting very basic steps because we have not added many
318.74 -> of the other plugins which we will see in the next sessions for now Let us select either
324.87 -> a Windows batch command or execute shell if you are on Windows You can select execute
331.26 -> Windows batch command Okay, and then you can give some command like dir or date or any
337.34 -> command that can be executed on command prompt For me, it should be a shell because I am
345.12 -> recording this tutorial on a Mac So I will say execute shell and I'll give some command
351.22 -> liked it.
352.86 -> Okay now coming to post build actions Now, this is very important because after you build
360.16 -> your project you will need to do something For example, you want to build some other
365 -> project after this particular project is completed or you want to send out some report notification
371.62 -> or you want to trigger some acceptance test of performance test, right?
375.71 -> So this is where this section is used for again We will not use it for this session,
382.34 -> but we will use it in the next sessions as of now I'm leaving it blank and I will click
386.75 -> on apply Okay, this is saved and I will save and this is my project page.
394.57 -> I will go back to my dashboard And now I can see my project here, right It is here, right
407.12 -> So in the dashboard you have different columns The First Column is the status of the last
412.52 -> build So this is gray because it is not built at all Once we build it It will turn to Blue
419.75 -> if it's successful or red if it is unsuccessful So let me just build it I can just go from
425.87 -> here and say built now Or I can also go to the my project page and save built now Okay,
434.64 -> so it will build I can look at the I can go here and look at the console output So see
444.9 -> we executed the date command it executed successfully So the status is Success If you go back to
453.68 -> our dashboard we can see now this has turned to blue because the last one was successful
461.37 -> then we have our next column which is a weather report showing aggregated status of recent
466.68 -> build Now, what does this mean is this column?
470.03 -> Into account the last five runs of this particular job or project and based on the count of success
478.97 -> of failures in the last five runs this icon gets changed Right So now if you see it is
486.08 -> saying build stability No reason built failed if I go to configure project and let me make
492.97 -> some mistake I am saying dat instead of dat which is actually wrong and it should fail,
500.14 -> right Right now I will save it Okay, I will built my project and now did you see this
512.13 -> ball turned red because it is based on the status of the last build and this is based
519.81 -> on the status of the last five wheels So it is saying one out of four bills failed and
527.569 -> that is why it turned to a cloudy Sun if I run it again Let us see this will change Now
536.439 -> see it has again turned to a rainy Cloud because last three out of five build's failed if I
544.9 -> run it again Now you can see it has again change and it is saying of last five Builds
553.81 -> failed Now again, if we make the corrections and say this is date Let me build my project
569.209 -> Now see you can see the build history here as well on your project home page You can
574.44 -> see all these details Okay, and you can configure go to configure project from here.
580.959 -> You can delete the project you can build now you can go to your workspace You can see what
585.459 -> all changed and then the entire history of your builds is here You can click on any of
591.35 -> the records here Okay, and you will get exactly what happened in that build Right, you can
600.42 -> see the console output So what exactly happened is we executed the wrong command and this
605.98 -> is the error message command not found and that's why it's a failure right so you can
612.819 -> go like this Okay.
615.829 -> This was a success So this page becomes very handy, if you want to look at what exactly
622.81 -> happened in any of the previous built, what was the time it was executed and so on if
628.3 -> you go to the dashboard again for every project you will get what was the last success?Okay,
638.87 -> which build was the last success?What was the last failure how much time it has been
643.309 -> and what was the build number that failed and what was the duration of your last build
648.85 -> Okay, so this is how you can configure a very basic project also, let us look at How can
659.8 -> you trigger the job remotely Okay, so I'll let us go to our project and let us go to
677.059 -> configure Okay, let us go to build triggers Okay Now I am I will turn this one as off
688.6 -> and I will say Triggers builds remotely Okay, and as soon as I click here Jenkins gives
696.779 -> me this URL Okay This is the URL What I can do is I can just copy it from here go to a
706.339 -> different tab of my browser paste it this particular section Jenkins URL.
712.26 -> I have to change with my URL So as of now I am on localhost So I'll just say localhost:8080
719.47 -> Okay, and this Is the token name So that token name is whatever you will provide here So
725.52 -> you can provide some complex string here So it is kind of a password for this session
731 -> I'm just saying one two, three four, and I will say the same token here 1 2 3 4 Okay,
738.189 -> and I will just say apply and save I will go to my Jenkins dashboard and you can see
747.22 -> this is test one and it was last executed Let me go here and last it was executed at
757.329 -> 6:12 a.m Okay, which was built number 11 Okay.
763.72 -> So let me again go to my Jenkins dashboard Okay.
767.529 -> So the last bill was built number 11 Now what I am doing is I am just going to any other
773.249 -> system or any other browser so you can actually give your IP here instead of localhost and
781.339 -> then you can execute this command from any other machine as well Which can connect to
786.319 -> this particular Jenkins machine So I'm just joining this Okay, I go back to my Jenkins
792.92 -> And did you see this build Queue So my test one project is Queued already Okay, and now
801.829 -> we can if I again go to refresh it, you can see the last success was four seconds ago
808.67 -> and built number 12 has already been executed Okay, so we triggered this build From outside
816.199 -> We did not trigger it from within Jenkins, but from outside So this is how you can trigger
821.22 -> your jobs from outside Okay Let us also see how to chain job executions Okay, so for that,
838.009 -> let me create quickly create two new project I will create test to and freestyle project
847.17 -> And I will just give some command here or execute shell Any command apply and Save Let
858.879 -> me create another project test3 This is also a freestyle project and again give let me
867.029 -> give some Shell command That's it save and yes, see now I have three project test1 test2
879.62 -> and test3 Let me go to test2 And go to configure Now I go to build triggers and here I am saying
895.129 -> Built after other projects are built So the trigger for this particular project will come
901.749 -> from another project And as soon as the that project will get completed This project should
907.019 -> get built So here I am giving the name of the project Which is test1 you can give multiple
913.72 -> project names here But as of now, I just want a single project Okay, and I can also select
921.019 -> trigger only if build is stable or trigger even if the build is unstable trigger even
927.25 -> if the build fails so as of now I am saying that only if the built is stable for test
931.959 -> one project then built this particular project Okay, I will say apply Okay, and then in the
941.149 -> post built actions, I will select build other projects Okay So this is a post build action
952.23 -> that after this particular particular project is built I want to build another project which
957.61 -> is test3 And again, you can give multiple projects here and I am seeing trigger only
964.22 -> if the build is stable and I will say apply and save okay now you can see what tests to
971.139 -> there is no build history.
974.26 -> Let us get back to dashboard and go to test3 Let us go to the dashboard You can see for
983.41 -> test2 There is no execution for test three as well as there is no execution So let me
988.69 -> run test1 Now As soon as our test1 is completed test2 should get executed And as soon as our
996.569 -> test2 is completed test three should get executed and this is how we have changed these three
1001.839 -> projects.
1002.839 -> So let me go and run my test1 Okay, so test1 got executed You can see in the queue we have
1012.35 -> test2 now And now you can see in the build Queue We have test3 now So test3 is getting
1021.759 -> executed Okay, so see test2 got executed 1.5 seconds ago and there is one built of this
1030.11 -> particular project I will refresh it again test 3 does not have anything as soon as I
1034.76 -> refresh it You will see even test3 got executed So if I go to tests to there is one built
1043.439 -> And test3 again there is one built So this is how we can change our projects and their
1050.649 -> executions Okay So This was all about very basics of job There is a lot more to learn
1057.62 -> and in the coming sessions We will go very deeply and we will see how exactly we manage
1062.15 -> different configurations and how we take our code from a repository and how can we trigger
1067.87 -> from a gate or a subversion Okay Hope you like it Thank you.

Source: https://www.youtube.com/watch?v=63HEKFh8T2c