What is Jenkins | Jenkins Pipeline Tutorial for Beginners | Jenkins Continuous Integration Tutorial

Hello everyone this is Hemant from Intellipaat and I welcome you all to this session on what is Jenkins. During this session I’m going to teach you guys Jenkins from scratch. So let’s go ahead and start with the agenda to understand what all we’ll be covering in today’s session. So we’ll start this session by first understanding why do we need continuous integration followed by what is continuous integration After that we’re going to understand what is Jenkins and then I’m gonna show you guys how you can set up Jenkins on your own computer or on an AWS. So after that we are going to understand the Jenkins master slave architecture followed by creating the Jenkins master slave on AWS and towards the end we’re going to create a CI CD pipeline which is going to be triggered by a git web hook Alright guys so this is our agenda for today I hope it’s clear to you so without wasting any more time let’s go ahead and start this session with the first topic which is why do we need continuous integration so why do we need continuous integration let’s understand this using an example so imagine yourself being in a company and where there are three or more developers who have been asked to add features to an already existing website so in the beginning you all were given version one code and you had to work on this code to add your features so developer one had his features to add developer two had his features to add and similarly developer three had his features to add. So developer 1 added his features and he submitted first and he submitted to the source code management system and his code was labeled as version 2 but when developer two has to submit his work he basically added changes to the version 1 code not to the version 2 code right so his changes in the version 1 code had to be integrated with version 2 code and only then it would amount to become version 3 and at the same time you know testing was also supposed to be done once this was integrated testing was also supposed to done to see whether the new features were been added to the website. Are they not interfering with the already existing features of the website. Is everything functioning normal so this was the normal routine or this was a normal I would say the life cycle of a software development methodology so once the bugs have been identified in manual testing everything was given back to the developer saying that you know these are the bugs please fix them. Now there were problems in this structure you would say that this seems perfect but there are some problems in this structure let’s understand those problems. So the first thing is that because it took a lot of time and integrating things and took a lot of times in manually testing things developers used to work on three or four features together and at once say twice in a six month time or once in a six month time they used to commit their changes or to the source code management system and then a manual integration was done because such a large code base is there a manual integration took a lot of time because there are there were a lot of features which had to be integrated and I’m just talking about three developers imagine a company when there are 100 plus developers working in the company right and everyone is commenting to the source code management system now integrating that takes a lot of time and this was a problem so first you have to integrate that and of course after that you’ll have to test him and testing was also done manually which again took a lot of time and because of a lot of time in manual integration and manual testing it affected the time when we will give the feedback back to the developer now imagine you submit your work to the company but you have not got the feedback how you work is and of course no person is perfect every code that goes through the software development lifecycle will have some bugs that we’ll have to fix right so the developers used to wait for the bugs to come back from the testing team and took a lot of time and this led to a big gap in the software development life cycle. It took a lot of time to develop code or to develop applications with respect to the features that were requested from the application and because of this there was a high risk and uncertainty when you look at it from the business perspective because you could not pinpoint on a date which were near to the customer expectations it always took a lot of time to make changes in our already existing application. So these were the problems before continuous integration and we had to solve this time problem that we have so that our you know our release cycles become shorter artwork becomes more accurate and because of this we came up with continuous integration so what is continuous integration exactly. So continuous integration is basically the process of having shorter release cycles by creating small features in our code

and simultaneously integrating them to our source code management system but there’s a catch the integration and testing now happens automatically rather than manually right and this is why continuous integration is such a hype it benefits a lot of organizations because not only do you have short early cycles that’s your features are going out every day but also you have automated integrations and automated testing because of which a lot of time gets saved right so how does the time get saved let me prove you using an example. So this is a classic scenario of how things happen these days so you have a developer the developer finishes his code and he submits his code to the version control system which is picked up by the continuous integration tool Now the continuous integration tool automatically deploys it on the testing server and the testing server automatically has built suits which have been defined for your application it tests all the features of the application automatically and if there are any bugs which are identified probably a test case failed or something like that it gives that feedback to the developer and all this happens in a matter of minutes, that’s how fast it is now imagine yourself in the earlier world when I told you it took a lot of time to manually integrate things to manually test things so you used to get feedback in these if not us and in this case that is today you get automatic feedback in a matter of minutes and this has led us to improve our release cycles in such a way that today we are getting releases two or three releases in a day earlier we used to have releases twice or thrice a year and now we have two or three releases every day obviously it’s shorter releases shorter features but that’s how powerful our software development lifecycle has become with the use of continuous integration and it does not stop here. With more mature continuous integration or with more mature DevOps model what happens is if your test succeeds it will automatically also pushed on to production and this is the power of continuous integration now obviously continuous integration is just a concept if you want to implement it, it always will be implemented using some tools so we’re going to discuss that in a few moments but before that let us summarize what we just discussed. So the advantages of continuous integration include frequent commits and hence small feature updates to our website but every day or every twice or thrice a week.We have automated built testing that saves a lot of time. It gives the feedback instantly to the developer and also because of this there’s a low risk and faster delivery of products when you look at it from the business perspective. Now like i was saying that all of this is possible using continuous integration but continuous integration itself is just a concept. It can be implemented using hard code tools and we’re going to discuss that in a few moments. So continuous integration is a topic for today and the continuous integration tool that you’re going to discuss today is Jenkins now Jenkins is an open-source tool which is basically used for continuous integration it is based on Java and a lot of companies are working on Jenkins to get their day-to-day work in the DevOps life cycle done right so this is a brief introduction about Jenkins and I already told you the features of continuous integration or all of them pertain to what Jenkins can do in your life right so without wasting any time let’s go ahead and start with Jenkins by first installing it on your system so how can you set up Jenkins on your computer now there are a set of commands that you would need to run on your Linux box that would set up Jenkins but there are two or three ways you can install Jenkins with if you have Dokken installed in your system and you want just into testing you can have Jenkins installed in a docker container so with that you do not have to set up your environment with Java you do not have to you know go through the process of downloading things just download that container and that would have Jenkins up and running on your system right but this is a bare-metal installation that i’m going to show you guys so let me just switch back to my server that I that I’ve deployed on EWS to see how you can deploy a server on Jenkins alright guys so this is how my AWS server looks like so what I have to do is I have all the commands written over here in my notepad so let me copy these commands the first command will basically install open JDK 8 on my system so let me do that okay so it’s unable to plate reason as we haven’t updated so let me update the system first sudo apt-get update and once that is done I’ll install open JDK

all right so now it’s installing open dedicated next step would be to copy this command this will basically add the Jenkins key in the repository so let us do that all right so this is done the next step would be to install this command all right so this is a next one this would basically add the binary of Jenkins to this list and now we’re going to update so our repository links gets updated and now let’s install Jenkins you alright guys so Jenkins is installed so first of all let’s check these details for our Jenkins service so for that we can check it using service jenkins status all right so the Jenkins service is active so our next step would be to open the port of the ec2 server so let us do that so the inbound connections let’s open all traffic to be on the safer side if you want to be more secure kindly open port eight zero eight zero because that is what Jenkins operates on alright and let me click on save alright so this is done so now what I’m gonna do is I’m gonna come back to my dashboard this is my Jenkins master let me copy the IP address and this IP address I’m gonna use with the port ether a zero to open Jenkins so you can see the Jenkins dashboard is now visible so the first time you install Jenkins you’ll have to enter the administrator password which can be obtained from this part so what I’m going to do is I’m going to go to this part and I’m gonna cat over there so this will basically so I let me do a sudo so this would basically give me the password and let’s copy it and paste it over here continue is booting up so the first thing screen that you would see is customized Jenkins so let’s install this nested plugins just for basically install all the plugins that we would require for today’s session so once you’ve clicked over there your plugins will start to install and we are wait a while until this finishes all right a next screen is going to add a oscar for adding a user so let us do that let’s give the user name as in telepath password as inter a part when you filled out all the details let’s click on save and finish and this would bring you to your Jenkins dashboard so you would get the Jenkins is ready page and just click on start using Jenkins all right so this is how your Jenkins dashboard looks like and we’re gonna come back to this but before that let’s just go back to our slides all right so guys we’ve installed successfully installed Jenkins on our system our next topic would be to understand the Jenkins master slave architecture all right how does Jenkins work in the production in mind is what we are going to discuss over here so the tank is master slave architecture is basically important drink complex continuous integration reason being your testing will always happen on the testing server and your production code will always be deployed on the production server right you always have to deal with multiple machines when you’re working in a DevOps environment and that is exactly why you need to Jenkins master slaves so for in this kind of situation where you have to deploy your code to the testing server Jenkins becomes your master perso and your testing server becomes useless server for Jenkins right similarly your production server would become slaves or for Jenkins and the master Jenkins will only have the Jenkin installation Jenkins will not have to be installed on any of the other systems which are serving as the slave of Jenkins right the third thing is why do we need a master slave kind of scenario so I’ve seen a lot of people basically just use Jenkins on the same computer where they have to deploy the code as well and that is because they are not dealing with

probably parallel jobs of deployment or they are not dealing with complex bills and that the reason they have it on the same machine but when you are working on to the production environment you have to have a master slave kind of an architecture where in the testing and the production server would become slave for your Jenkins master all right so now what we’re going to do is we over a set up master slave on AWS and let’s see how we can do that all right so the first thing that we have to do is deploy two servers on AWS that is slave one and Slade two and then we connected to Jenkins using the jnlp can I so let’s see how we can do that so the first thing that I’m going to do is let me jump on to my easy to my admin console and let me create two slaves you by specifying the number over here that is too so we’re going to launch the instances so our instances are launched let us rename them as slave 1 and we have our other witches slave do now mind you guys we will not be installing Jenkins on either slave 1 or slave 2 we will be controlling these slaves through the Jenkins master now there are some settings that you will have to do in your Jenkins master let us go through that so the first thing so this is your dashboard so the first thing that you have to do is you’ll have to go to click on Jenkins and go to manage Jenkins go to configure global security once you are here just scroll down and you will reach this section which talks about agents now over here we are talking about TCP port for genies be agents just change this to random and click on save once you’ve clicked on saves now we will go to manage nodes and now we will add a new node let’s name this node node as slave 1 and now click on permanent agent and click on ok.now over here you will have to add the launch method will have to change it to launch agent via Java Web Start and the current working directory path specify that to slash home slash window and slash Jenkins alright just specify this and click on save you will reach this screen so I’ll tell you what to do after this for now let’s add one more new node let’s name it as slave two and we’ll copy everything from slave 1 and click on OK all right so everything is the same so the remote root directory would be this slash home slash mundo and then Jenkins all right so slave 2 is also configured let us check what we can do now all right so the next thing that you have to do is now click on slave 1 and download the agent jar by clicking over here alright so your agent or jar is now normally I had one before so just ignore this thing so this agent dot jar is now downloading and now I’ll have to send this file to my slave and so and I’ll show you how you can do that right for now just click on show in folder remove the older agent rename this as agent all right and now we’ll have to send this to our slave 1 and the way we can do that is by first selecting slave 1 take the IP address from over here we’ll have to download a clock client called FileZilla just open that in FileZilla paste the IP address over here use name would be Ubuntu for the window operating system port is 22 and in the settings you’ll have to click on edit and then click on settings go to SFTP and you’ll have to add the key file over here viral already added that just click on add key file just go to your key file select that click on open and you be added over here this is important to connect because when you’re connecting to EWS the only method that you can connect to is using your PEM file or your PPA file and this is the way you can add it in in

your files at our browser right so once you have added that just click on quick connect and now you will be connecting to your slave 1 so once you are connected you will be given all the directory so here are all the directories now I’ll have to copy my agent Gaad jar on my slave once just click here and it will copy your file to slave 1 ok so let us also verify that if our slave 1 has been copied or not so let us connect to our slave 1 so we’ll connect it using this IP address let us go to put the click on your session connect to slave 1 and let us give a special appearance to this let us give let us decide a color on this let us decide the orange color so the orange color is slave 1 so let’s click on OK and let’s click on open all right so login as Ubuntu great so now if I do an LS I can see that agent or jar has been successfully copied all right so slave 1 is done now we’ll have to do the same thing for slave too so let us go to slave to download the agent or char while it’s downloading just copy the IP address for slave 2 enter it in FileZilla so that we can connect to it all right click on quick connect so you will have the directory listed over here all right now we’ll go here and we’ll rename our agent one dot jar two E’s in Georgia and the way we can do that is like this so we’ll just go here rename this all right remove the water reading file and I’ll rename this to agent or job once that is done just drag and drop it on the sole and now let’s connect the slave to using pootie so let’s click on your session as such add the file and let us keep the color for this slave as white say all right so this is slave to I do an LS over you it’s the Agent Orange our file has been copied successfully all right so now the next step would be to basically go to your slave and you’ll have to execute this particular command at the place where your agent jar is present all right but before executing this command will have to install open JDK on both these swords that is slave to and slave one so let us do that so here is the open JDK command let us pass it over here so we’ll have to update the server first let us update it you all right and is the command right so while Java is being installed over here let’s do the same for us slave 1 as well so let’s update it first you so it’s updated and now let’s install JDK all right so while Java is being installed on this I think we are almost done on our slave – all right so slave to the jar the Java is installed so what I can do now is I can go to my champions page and go to slave 2 and I can run

this command over there now and this is it the moment you run this command can you see it says connected and the moment it says connected just come back here refresh the page and your slave 2 is now connected let’s do the same with our slave 1 just copy this command go to your sleep one clear the screen and basis command all right so both sleeves are connected to your AWS Jenkins solo and your set so if you see the nodes you have a master now you have slave 1 and you have slave 2 and this is what we were supposed to do so let me come back to my slides all right so we have successfully setup Jenkins master slave on AWS our next task is to basically create a pipeline which would be triggered by get webhook to deploy a project on Jenkins let us do that so for that these are the steps that we’ll have to do so basically we have a project I’ve created a project on my github repository now this project has a doc file and this docker file can be built to basically deploy a website on docker all right so we’re going to deploy a web site on our slave one first which will basically act as our testing server it will be sudo testing kind of a thing right and if our website is successfully deployed on us s server that is slave 1 it’ll then be get deployed on slave 2 which will be our production server so this is basically a job and this should happen automatically so up get web boo basically means that the moment I commit on git it should automatically trigger job on Jenkins it should automatically deploy the website on my website on my testing server first if it gets deployed successfully then it should move forward and deploy the same on my production server alright so this is what we are going to do so let us quickly go to our github website to see how our code looks like so basically this is my code guys I have the docker file I have the website in here docker compose please ignore it we are not going to use it so we’re going to use the docker file the docker file code looks something like this so basically this is a container which it’s going to pull and after pulling the container it is going to add the DevOps IQ folder inside the where W W HTML DevOps IQ directory that is this is inside the container all right so this is getting now this will get deployed inside my sir would once I trigger it from Jenkins now to do this first we have to install Jenkins on both the slaves as it is mentioned in the steps and like it says like we will have to configure it in a way that if the build on Jenkins slave 1 is successful then it should be built on slave too once it’s done we should finally trigger the job using gate prep box all right so let’s do this guys let’s go ahead and start with the demo so that let’s see how it can be done all right so the first thing that we are going to do is install docker on both the slaves so let us go to put eternal let’s go to slave 1 first now remember guys you will have the connected state over here do not close this terminal otherwise your connection will stop so what I’ll do is I’ll just minimize it and I’ll duplicate the session so that I can work in a different terminal all right so the first thing that we have to do is install docker so let’s do that sudo apt-get install docker dot IO ok so installing now so Wild Orchid installing over here let us do the same on slave to so just duplicate the session and go to Punto now install dog you all right so doc docker is being installed on slave – it has installed a slave one let us check so docker – I have inversion if we can do that that means docker is installed yes docker is installed on sleep one and is installed on slave to as well let’s check the sudo apt pseudo docker version

okay so docker is installed on slave two ways well awesome so our first job is done we had to install docker now our next job is to configure Jenkins to build the project on slave one if successful should be built on slave too so for this we will have to go to Jenkins so Jenkins is over here and we’ll have to create a job all right now you can check the status of your slaves over here so you can see that master is idle slave is also idle and slave to is also idle now first let’s create a job for our slave 1 so our slave 1 basically will have a pre side project and let us name slave ones job as slave 1 so let’s name it as test ok and then click on ok all right so the job has been created now the first thing that we had to do was to copy our code to the workspace so let’s uh scope clone a repository or it mentioned the repository link over here and by clicking it up project ok and then go to source code manling click on kit and mention your repository over here as well now because this job has to run on slave 1 we’ll have to just shit where this project can be run and select slave 1 right so slave – job and loosely one once you select slave on this job will only run on slave 1 ok once you have done with that the next thing that you would have to do is come down and click on add build step but before doing this let us check if you know my job is being built or my workspace is being populated by the git repository content if I build this job on sleep one right so this would basically test our connection as well so let us do that so let me click on build now and this will basically start a build wherein it will copy the get content on slave 1 ideally right so the blue ball basically tells us that the job has completed successfully so let us click over here and I can see that you know it has been successfully being finished so let us verify that let’s go to slave 1 and if I do an LS over here great so I can see the workspace is there let me go inside workspace all right so inside workspace let us see what do we have we have test so this is the job name awesome so if you go inside test do we have the git repositories content yes we do alright so my git repository was successfully cloned into the test shop that basically means from my master I’m able to build a job on the slave one node which is great so that basically means our connection is working fine awesome so let’s go ahead and go back to configuring our job right so what we want to do is we want to deploy the website which is mentioned over here in this repository to my project now the way to do that is by running this docker file right for running this docker file I’ll have to check what is the present working directory so my present working directory is this so let us copy this and once you come back to Jenkins you’ll have to scroll down and click on add build step once you click on add we’ll step click on execute shell what will execute shall do so execute shell is basically used to run any commands that you want to run on the terminal of the other machine that you’re trying to build on Jenkins right for example we are trying to build on slave one from Jenkins so what commands do we want to run over there so I want to run docker build command so it’s a docker build and then hive dockable and then the repository where the dockerfile is so it’s over here and then the name of the image that I want to give so the name of the image would be say I want to say it’s test okay so this is the image name once the image is built I’ll have to run it so let’s run it on port 80 no so let’s land on port 80 – and then let’s means like this so this is the command for running the docker image that you have just built right once it’s built the next step would be to check whether it’s there or not we can do that on the browser and I forgot one thing I’ll have to add pseudo and because this job can be build time and again what we’ll have to do is we’ll have to remove the older containers which are running on the system right so for doing that I can say that sudo talker RM – F and for removing all the containers which are running I’ll have

to pass in sudo docker PS – a and – Q this should delete all the containers which are running inside my sleeper now to check if my docker file is building my containers or not what we can do is we can simply copy the commands from over here so the first thing that I want to do is I want to build it let’s build medaka file so the file is now being built awesome so it’s been built the next thing that I want to do is I want to check if I want to run this command right so for running it the command is this let’s copy it paste it over here hit enter and my container is now running so I’ll have to check that if it’s running or not so I go to slave 1 papi this paste it over here so and port number is 82 so I can see the Apache base that means the container is working let’s check if our files are being showed or not so if I go to develop psyche folder yes I can see the website so means these commands are running fine but what I have to do is I have to check if it’s running through docker or not so I have configured the commands over here and these commands are work on the terminal they should work over here as well right so let us go ahead and save this okay so our job has been saved and the next thing that I would do is let me remove all the containers which are running over here so for that I have to do Rock of PS let me remove this container so the container is removed now let’s go ahead and run this container run this job all right so now let’s go ahead to our Jenkins dashboard and let’s build the project now to see if everything goes fine so I’ve clicked on build now all right so it gives me a field bill let’s see what the problem is so the problem is over here it says the first command sudo docker PS – da – cue blocker I am require at least one argument okay so I’ve got the problem so the problem is there is no container running over here as of now right and that’s why it is not able to remove any container and that’s why this is it is giving me this error okay to swallow this what we can do is for now let’s in the configure part let us remove this line or what we can do is we can start a container over there right so let’s run any arbitrary container docker run – 90 – D and then we’ll do let’s run it so that there is a container running because ideally there will be one container running at least on my system so let’s click on save try to build the project okay so the build has gone successful okay fourth checking that I’d say let’s just refresh this and yes my website is being deployed over here so let me just do it one more time so I’m sure it’s working so let me just do a dr. PS you sudo Locker PS and let’s move this pseudo doctor RM F&F remove this and now let’s run our arbitrary continued let’s ensure that this website is now not working so it’s not working now let’s rebuild this project all right so now if i come here and i refresh this yes so the website is working successfully awesome so it’s works on slave 1 let us now configure the same thing in slave to west belle right so let’s come back to

our dashboard so the test job this could be our arbitrary test shop so basically we are trying to deploy it on a server if it gets deployed successfully we are going to deploy it on the Proud as well so let’s create a new job and let’s name it as prod free start project click OK and the github project is going to be the same this one let’s place the URL over here and we have to restrict this to run on slave 2 great the source code management diskette repository and the build step also would be the same so basically we want to delete all the containers which are running right now so for that it’s sudo docker RM hyphen F dollar docker PS – 8 and I think you okay next step is to build a file to do sudo docker run – 90 – P and we want to run it on port 80 because its production right and the image name is dest – D and – and before this you forgot one command which is pseudo docker build and then the directory which is flash home / bun – slash workspace / the job name which is broad and then over here it did aqua fire would be pleasant and I want to name it as sea production the container name would be production and over here also the container name would be production awesome so let’s click on save and let’s now try to build it but before that we’ll have to launch one container on test so let’s run an arbitrary container you all right so container is ready now let’s check by clicking on bell now if this job is working fine so we have clicked on built now and if you want to see the console output we can see it over here okay so it says job failed and the reason for that is god permission denied okay so the problem is I have forgot to add pseudo so let’s add pseudo let’s add food over here and that should be it let’s click on save and let’s try it again okay again they have a problem but I think it’s new error so let us try to resolve that so it’s unable to prepare context and the path is slash home slash you’re going to workspace and fraud not phone okay so let’s check if this path exists so we if you do an LS we have Jenkins okay let’s go inside Jenkins if you do an address okay so workspace is over here so basically I’ll have to change the path to slash home slash a bun to slash Jenkins slash box Brod – t and then production you can save if we check if there is a container running on my slave – if there is no container running the lab to run macho pseudo run – 90 – d12 ok container is running and that is also ensure that we do not have any website running on mad slave to okay so this is the command if you are getting ready this is the hope with the do getting right now all right so let’s click on bill now and let’s see if I build a successful all right so it’s getting built let’s hope for the best

let’s hope it successful all right so it gives us a blue sign blue means that build was successful let’s try to refresh over here and yes it works now let’s just go to DevOps iq folder and see if our website is up and running yes so our website is up and running awesome guys now what I want to do is I want to trigger so first I want to trigger prod job only when the test job is completed now let’s see how we can do that so we’ll go to configure and let’s see if we can configure this all right so I’ll have to go to – of actually let’s go to the test shop let’s go to configure and over here I’ll have to go to add post build actions ok let’s click on that and after this we’ll have we’ll say build other projects click on that and which project to build I want to build prod and trigger it only if the bailiffs table so if the bill passes only then it should start with prod okay awesome great so let’s click on save and if my test gets succeeded then my fraud job will run alright so let us check this as well so let me try running it so we can run the test job using the pipeline view as well so if we you just have to come back to the dashboard and over here you will find both your jobs just click on the plus sign that you see you over here and once you click on the plus sign you should be seeing a build pipeline view option over here if you are not so that means the plug-in is not installed so let’s install that plug-in for that you have to click here go to manage Jenkins and then click on manage plugins click on available and then search for build pipeline build pipeline select it and then install without restart just click on that all right and now Europe your plugin will start to install on your Jenkins so all right so my bill pipeline plug-in is installed let us go back dashboard click on the plus sign and you can see there’s an option down which says build pipeline you select that and name this viewers CI CD or anything that you wanted right click on OK all right everything seems fine over here bill pipeline new title let’s name it as CI CD ok let’s click on okay you all right let’s check so in my CI CD view I just see the broad job so let’s see how we can fix that so I want the test job to also be there so let’s see so let’s click on configure and build other projects after the test is done okay you okay so we forgot to choose the initial job so the initial job will be test right and let’s click on okay okay so now it looks good so the first the test job will be executed and then we’ll have the broad job executing okay let’s try running these jobs by clicking on run you

all right so as you can see our test shop started and then our prop started and it completed so this completed in 1.5 seconds and this completed in 1.5 seconds as well and both of these have these websites awesome now what I want to do is I want the moment I commit on my github this should trigger my Jenkins job so for doing that let’s go over here that is my Jenkins dashboard and let’s try doing that with tests okay so we’ll click on tests and we’ll click on configure all right and you yes so in the bill triggers option just go to github hook trigger forget SEM polling alright and just click on save the moment that’s done just come back here on your github so for configuring your web book all you have to do is click on settings and click on settings go to web hooks inside my books click on add web hook and now just copy the IP address and port number of your Jenkins dashboard or your Jenkins page and paste it over here slash github – the book specify that and click on add book if the response is received by gate and everything works fine it will give you a tick which means everything is working fine right and just go back to your dashboard and you can see that everything works out great now what we have to do now is we have to push a commit on github and that should automatically trigger a build over here so let us check that so we’ll just open this over here and we’ll go on Master let us trigger a build so this build can be triggered from anywhere I’m just doing it on master for the sake of simplicity so I’ll just do a get load of your repository get clone all right everything is now I have something on my I have a website right so what I’ll do is I’ll change the contents of that website let’s see if that content is visible on a service as well so I’ll just change the index file I’m gonna change is the title so I’ll change this as Jenkins prod website okay and let us change the image as well so I have one more image over there so let’s name the images to jpg great so now let’s push this on docker hub so let’s add it commit it all right and let’s push it now get push origin master the username and the password all right so the push has been made let’s check if anything has triggered over here so as you can see the test got triggered and now the prod also got triggered so both the jobs have been successfully completed just wanna push let’s verify that so this is my so let me see which one is my slave one so slave one is 1:08 she let us see okay so this is my slave one let us refresh this and see which website is coming as you can see the background board changed and as well as the title also got changed similarly if this job is successful it should also be triggered over here let us check if the website is also pushed here and yes so job is also pushed here awesome so let us try this one more time and with this let us try to bring back the same background that we had right so let’s do a nano on index.html

and let’s change the title to Jenkins final website and let’s change the image name to one dot jpg which was the earlier image save it now let’s push it on github so we’ll add it committed and now let’s push it all right so our code is now being pushed it’s been pushed now let’s come here and see what is happening so our job should now be running so test got completed fraud is being completed so prod is running right now and prod also got completed successfully awesome so let’s check if a website got changed over here so this is my testing server so the title got changed and even the background let’s see for a production and even a production website code changed so awesome guys we have successfully completed what was asked to us in the hands-on so we were supposed to create a Jenkins pipeline which would basically if slave one job is completed should be built on slave 2 and the job should be triggered by a gateway book and that we have done successfully alright guys so I think we are done so thank you guys for attending today’s session I hope you guys learned something new today so if you’ve got any doubt that you have that you’re doing this session or if you’ve got any errors while doing the same demo as I was doing you can push it down in the comment section we’ll be happy to answer it for you alright so thank you guys for attending today’s session I hope you have learned something new today so see you again in the next session good bye and have a great day