What is Jenkins? How to run a maven GitHub project in Jenkins? | Tech Primers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome to tech primers in this video we are going to see what is Jenkins and how can i integrate a maven project in Jenkins and how can we use Jenkins in our day to day life so if you're not aware about Jenkins so Jenkins is a open source automation server which we can use for running your build so basically when you want to run or compile or deploy something you can use Jenkins so if you see most of the companies are using Jenkins for automating their workflow so if you see the latest devups model so most of them are using the Jenkins and the pipeline building Jenkins to automate their build deploy procedures into UAT production and stuff like that so in this particular example what we are going to see is we are going to see how we can create a job inside Jenkins basically how we can set up a continuation integration for your project ok so we are going to see various steps involved in creating a job in junkit and also I am going to show you how Jenkins can run your build so basically what I have done is I have created a github project already ok this is basically the fizzbuzz project which I took and then I have put inside Jenkins example so that we can play around with this particular project so I can modify this here and then I can trigger build on this particular project project so if we notice here this is the Jenkins server so what I have done is I have gone to the Jenkins website I have downloaded the Jenkins package ok and I have installed it in my machine so in my laptop I have installed so you can also try that at home so basically I download the Mac OSX version so if you have Windows you can try the Windows version if you have open to water that you can try that version as well ok so basically it's like any other server like a tomcat or something like that ok once the server is started so basically you will just go to the command company start or you can start it using the launches ok so for example if you notice this this is how it looks like so I have started my Jenkins server so right now it is running in the 8080 port so what I have to do is basically when I start off verge in case I can create start creating new jobs basically these are nothing but new items so I can click on a new item and Jenkins shows me water all the different stuff I can do so if you notice here there is something called freestyle project ok so this is there it combines different axioms and you can turn it it based on your type of particular thing you have a what you call a make project on C or C++ or Python or something you can use restart so in this particular example we are going to see the maven project so I'm gonna show maven there is something called pipeline ok you can create pipelines or workflows basically inside junkit that will be in the next video because it is slightly complex version of a job ok so in this video we will see what is maven project and then there is something called external job multi contributor configuration project folder github organization so get a github organization is like you give your login and it will scan all the projects inside that particular organization or the login and then it creates a build or pipeline for each of these projects okay that also will see as a part of pipeline because it is slightly different multi branch pipeline is like it it can it is similar to pipeline but it checks all your branches so basically when you create a pipeline you can configure it to listen to a particular branch but multi branch pipeline is something similar to how it scans through all your branches in that repository so it can build any branch so let's say your team is working on different branches right your team members are working on the front bracket when you configure a multi branch pipeline it can trigger a build for each branch so based on the hook from the bid packet or wherever your code is hosted so the multi branch pipeline will be triggered and the build can run on branches also you can you can control that using something called Jenkins 5 so that we will see in the next video but let's get started by creating a simple build right with this particular project so I'll I'll take to you love this project okay I'll create the Jenkins no job name as Jenkins example and I'm going to just select maven project and I'm going to say okay okay if you see here there are different options in the general I have the project name which we have already given now it is this car all this let's not discard old old bins I'm going to say this is a github project and I'm going to just paste this this project is parameter is no throttle bills no disabled this project no execute commands books expense I know so I'm going to say so Scott is good yeah so I'm going to give the git repository URL don't get okay now I have already configured my credentials here so I'm just going to select it here okay and also you can specify a branch so right now if you notice this is running on the master branch okay I have only one branch called master for this particular project so I'm going to run on only on master also the trigger point for this build so how does this particular bed gets triggered right so these are the different trigger points you can have a bit hook or you can have a pole SCM you can just schedule how many times it needs to be pulled so far no and will not do anything or you can do a periodic build periodic scheduler so you can configure this particular job to run at a particular time every day okay or you can add a dependency on another project okay but also you can do for now I will not do anything because I am going to just trigger it manually but you can configure that and it works out of the box there is nothing baked it okay during the builder now I will say delete my workspace so workspace is where all your code gets checked out and stuff like that so I'm going to say that delete my workspace every time when the build starts okay guess further making it good so these are the maven goals so I'm going to say clean and deploy okay I'm going to say clean and apply as a part of deploy it is going to run my test and also it is going to create a package as because deploy is a deploying close source and also you can have post validation steps or something so based on this particular criteria you can add some different scripts or see for example set build status to pending it github commit so you can even automatically commit of the build if it fails or something okay that also you can do right so in this particular example what I'm going to do I'm going to show cleaned apply so what I have done is I have created a free maven propo so if you notice here I have some files which are pushed here if you notice you have the GFI example that is my project name I have already pushed that under comm tech primers testing J unit 5 if you notice here that is what we have that so what we can do is I have the project open and IntelliJ here let's change this particular artifact ID to something else so that we can test it so I'm going to say Jenkins example ok and the version I'm going to save 1.0 snapshot so what I'm going to do is I'm just going to come at this particular file took it and push it to github I'm going to say artifact ID update artifact ID I'm going to say commit and push so this is going to push my changes onto the github repository as well so if you notice here it's asking me to push I'm going to say push it ok and this is going to push my changes onto the github repository and we are going to say see that has all your the push is successful and if I reverse this particular file now my bomb should have got updated yeah if you notice in 19 seconds ago so we have updated artifact ID so if you notice here in the maven index this particular in this particular folder context primers testing here and my artifacts should get created right now it has only jfi examples here it should get created so the only difference between the je units I example project and this is these two parts ok so I have added a repositories and I'm just passing my URL from there I can pull it and push it so basically this particular project is going to be pushed into this particular wave and repository ok that is why if you see here the URL is Howard so it is going to push my repository day so I have added this configuration here ok as a part of maven build as a part of the deploy it will be pushed to this particular repository because these are my repositories where I have permission so that's what we are going to do if you are working in a company you will see the company's central maven repository which I mentioned here right so now let's finish this job so I'm going to save this job and if you notice here this is going to check out my code from github and automatically build it okay so we are going to trigger the build no option in general however this continuation decoration stuff works is whenever you commit something it automatically gets triggered the build automobiles get stupid so if you notice here these are different options which we have you can go to the workspace and see how the code is getting checked out what is the code which is present here you can wipe out the workspace you can build it you can configure you can change whatever we configured here anytime ok so I'm going to go to the build and I'm going to go to the if I go to the build is I click on build so you have different options here I am going to go to the console output so that I can see the log ok so if you notice here the build has already got triggered the code has got checked out and the Maven comer has already run so let's check for the goal which we did so if you notice here they may one command is running clean and deploy for that particular form got excellent alright and if you notice here the test which we wrote also has the runt of its first test and the build is successful so once the build core successful we did a deploy right so the maven deploy plug-in is automatically got triggered and it is automatically uploading my jars into the maven Drupal and the build is successful if I go out I can see the build is successful if you see you build a successful ok now here I should get my new project let's refresh it yeah I can see this so I can see the Jenkins example I can see my snapshot version here so I have the jar here if I rerun this build it should again upload it but the only thing is the jar will have a different timestamp now if you notice yes I am I'm stamping the timestamp in the jar ok so if I rerun it again this particular jar will decay we'll get it again and it will be pushed to this so is particularly poor but with a different time so just trigger the build so if I go to the log my tests are already completed okay the jars are getting uploaded nope load should be successful by now yeah if I note if you notice here it has already appended - - and also the time stamp is deficient right so that is what that is how it works so let's for simplicity for checking how whether our chains are picked up or not let's fail some test case wait I will just comment one piece of code okay to check if this particular test cases getting kicked off or not if the build is still body cams Ascona will commit and push this okay so this should push the change which I did here okay the push is successful let's go ahead and trigger the build now so this should pull all the latest changes whatever we did on the build should fail because the test case where we have a written test case for each and every scenario and but first a sophisticated way now that's what we are going to see here okay if you notice here the clean deploy command has got sugar so basically this is running the running the command which we are going to run in the command prompt here if you notice here we will run a clean install right inside I just do the deploy because I want to push my jobs on to a repository it's basically running the same thing so I am just giving the maven goal there but only thing is the build is going to run on a different server and that will be automatically triggered and controlled by Jenkins if you notice here the test case has failed but I have since I have mentioned I haven't mentioned that the build should fail if the test case of failed the bail got succeeded if you notice here the test cases failed here it is saying that expected three but worst case right it came a three but should be safe all right so that is what is happening so this is how we configure the Jenkins job on to a maven project okay if we notice here the toast is also showing and the test shows is unstable right if you so if we will see this success and this is unstable okay so this is how we configure a maven project inside the Jenkins build and most of the time what happens you won't have admin privileges on to the Jenkins film and that is why you won't be seeing this configure option you might see the read-only configuration but that's ok still this is how in general you can configure genkai so if you want to try out drinking that you can just download that onto your local laptop and try it out and you can configure any github project to pull that change because github is a free anyway a free and open source or save agent Keens is also open source so you can do that also Jenkins has the capability to do master slave so if you have lots of bills running in your project and you want to use Jenkins extensively you can using master slave concept where you can configure slave nodes so if I go to the manage Jenkins option so there is an option to configure the nodes so there is a managed nodes option so if you notice here there is only one master right now but I can add a new node and I can add it I can add a slave so that the jobs can be half the jobs can be running in the master half the jobs can be run in the slave and you can allocate this case you can allocate equal space in both e-service that that is how you can configure Jenkins and Jenkins does must escape out of the box so it can it can just control math they can control the place okay so that's it for this particular video so hope you understood what Jenkins is and how we can configure Jenkins to run a maven project so if you have any doubts queries or something you can just post it in the comment below I will reply whenever I see it if you liked that video go ahead and like it if you haven't subscribe to my channel go ahead and subscribe it meet you again in the next video thank you you
Info
Channel: Tech Primers
Views: 138,993
Rating: undefined out of 5
Keywords: techprimers, jenkins, what is jenkins, maven with jenkins, jenkins maven project, jenkins continuous integration, jenkins tutorial for beginners, jenkins server, jenkins ci, continuous integration jenkins, ci jenkins, jenkins pipeline, continuous integration tools, jenkins test, jenkins devops, jenkins open source, continuous delivery, continuous delivery using jenkins, jenkins build, maven jenkins build, maven jenkins setup, maven setup using jenkins, jenkins maven
Id: BfJvxGs-HxQ
Channel Id: undefined
Length: 15min 42sec (942 seconds)
Published: Sat Jun 17 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.