Masterclass | JENKINS Complete Course for Beginners | Step by Step | Jenkins Interview Questions |

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to the complete crash course  and master class on Jenkins i'm raghav and you can   find all my work on my website automation step by  step dot com this course is created for complete   beginners so do not worry if this is the first  time you are learning jenkins i will go from very   basics step by step and teach you everything from  scratch and you can follow this on windows mac or   linux operating systems and in the timeline in the  description below this video you will see timeline   with topic so just in case you want to jump to any  of the topic you can use the timeline and you can   always go to my website automation step by step  dot com and you can also find all these topics   here so with that let's get started with the  jenkins complete course jenkins is a ci cd tool   ci stands for continuous integration and cd  stands for continuous delivery or continuous   deployment i will tell you about continuous  integration delivery and deployment separately so   jenkins is a tool that we can use to do continuous  integration delivery and deployment it is   free and open source and it is written in java so  to use jenkins you will need java on your system   when we learn about system requirements i  will tell you exactly what versions of java is   supported so now let us move and learn about the  continuous integration delivery and deployment and   what exactly is this so if i go to my browser  and i just search for continuous integration   and delivery here and i will go to images  now here let me go to this image and show you   so you can see here this is a very  simple image where it shows some   uh differences between continuous integration  delivery and deployment now here you can see we   have a dev project then we have application test  process or project and then integration test now   in continuous integration the dev team integrates  their code on a central repository and then it is   built and if we have our application test process  and projects integrated along with our dev process   and also our integration testing we call it as  continuous integration now continuous integration   is a wide term and it can be used within a dev  team as well or we can say that when dev process   and test process and integration testing is all  connected and have a automatic trigger automatic   trigger means there is nobody manually running  these processes in a chain when a dev process gets   completed and it is successful it triggers the  application test process and when it is successful   it triggers the integration test now if we add  a acceptance test process in this chain in this   cycle it will be called as continuous delivery  because after this process our application or   product is ready to be delivered so this is  called continuous delivery and when we have the   deployment process also integrated in this cycle  then it is called as continuous deployment so   this is at a very high level what do we mean by  continuous integration delivery and deployment   now let us go to installation part now here we  will start with windows and then we will also   see other operating systems mac and linux let me  first show you the system requirements so we need   at least 256 mb of ram on our system this is the  minimum requirement i will say that you should   have at least 512 mb of ram or memory on your  system you should be having enough disk space and   this will be dependent on the projects we store or  create on jenkins so you may start with just 2gb   of empty space but it will depend on your project  the operating system we can use windows mac ubuntu   linux and i will show you all and then for java  as of now jenkins is supported or can run on java   8 or 11 and you can have either jdk or gre let me  show you if i go on the jenkins java compatibility   and if i go here java requirements on jenkins so  you can see as of now we have java 8 and java 11   and this is as per the time of recording this  video so if you go to installation on windows   the very first thing i will check is check java  is installed on your system or not so i will go   to my windows and i will first go to  command prompt and say java space hyphen   version to check the version of java and in my  case java 8 is set up now just in case java is   not available on your system or not setup you  can go on my website that is automation step by   step dot com and here if you scroll down you will  find a tutorial on java under programming section   if you click on this it will take  you to my youtube playlist on java   and here you can see how to install java on  windows how to install java on mac and all   these things you can see here just in case  it is not already installed on your system   so make sure java is there and then  step number two will be download   jenkins war file so now i will go on  my browser and i can go to jenkins.io   and here on jenkins.io i will go to download  and if you scroll down you will see here we have   we can download jenkins for a lot of operating  systems here and then at the top you will see a   generic java package or war so wherever you find  this war file click there and it will download   jenkins you can see it is getting downloaded  here and now i will go on my folder where it   is downloaded and we have jenkins dot war file  here now the next step is go to command prompt   and run command java hyphen jar jenkins dot war so  this is the command that i will use to run jenkins   and i have to go to my command prompt and then  i have to first cd or change directory to the   location where my jenkins dot war file is which is  downloads fault folder for me so here i will have   to first just copy this location and this is in on  c drive so i can directly just copy this location   and hit enter and i am on my downloads folder now  just in case you are on some different drive or   the file is on some different drive other than c  and your command prompt is on c drive first you   will have to change the drive let us say d colon  now it will change to d drive and then you can   go to your d drive location in my case i will just  change back to c drive and downloads now the other   way is if you do not want to directly uh go from  command line you can directly go from your folder   so wherever your jenkins dot war file is go to the  folder and go to this address bar and here type   cmd and hit enter it will open command prompt on  the same location and now you can run the command   so the command is let me just go back to my this  command prompt because the font size is larger   here i will say java hyphen jar and the file name  that is jenkins dot war as soon as i hit enter it   will start the jenkins server and this will start  jenkins on the default port that is 8080 but just   in case you want to change the port or in case  port 8080 is not available you can say minus minus   http port now this is important it is capital  p here and rest of the letters are in lower   case and this is double hash or double hyphen or  double dash and then i will say equals to whatever   port number you start you want to start jenkins  on i will say 9191 and hit enter and this will   start the jenkins server so it will take some  time and then you can see you will also see this   password this is the admin password that you will  need for the first time so you can copy it from   here or it will also be available in this folder  that is dot jenkins secrets initial admin password   now after some time you will see this  message jenkins is fully up and running   so once you see this you can start  jenkins and make sure that you copy this   password which you will need for the first time  and it will also be available on this location   so i will go on my browser and now i will go to  localhost 9191 so this is http localhost colon9191   let me show you this should be http colon forward  slash forward slash localhost or you can also give   the ip of your system and then colon and the port  number whatever you have used to start jenkins   and when you hit enter it will go to the jenkins  homepage or the jenkins unlock page here you will   have to add the password that you have copied  from the command prompt and say continue let me   copy it again let me go here and this  is the password i will copy and paste   and say continue and now we have got an option  do you want to install suggested plugins or do   you want to select the plugins to install so  in jenkins we have a lot of plugins and we will   learn more about it as of now you can just say  install suggested plugins or if you say select   plugins to install it will open this window where  all the suggested plugins are already checked   and you can check or uncheck them and then install  them and you can also see the categorization here   organization edit and administration build  features build tool plugins code management   plugins and all these are here i will just  leave all this default and click on install   and this will start the installation process  so you can see all these suggested plugins are   getting installed and once this process  is completed we will start using jenkins   and now we have got the create first admin user  page i will also write down the steps here step   number four is on browser go to http localhost  colon whatever port you have selected so it can   be 8080 if it is default port or in my case  it was 9191 because i used python hyphen http   port 9191 and then step number five is provide  password and complete the setup and this is the   admin password that we have to provide for the  first time so now i can actually create a admin   user so that i do not have to use the default  admin and default password every time i will   say raghav and i will give some password  here i will have to re-enter the password   i can give my full name here and then  i will give some id here for email and now i can say save and continue and  you can see it shows me my jenkins url   and now i will say save and finish and now  we are ready to use jenkins and if i click on   start using jenkins here it will go to the  jenkins home homepage where you can see   all this dashboard so this is how you can start  jenkins on windows and now we will learn how   to start and install and set up jenkins on mac  operating system now to install jenkins on mac you   can do it in two ways the first one is as we have  done on windows you can check java is installed   and this is always the first step so you can go  to terminal on your mac so i am pressing command   spacebar on my keyboard to open up spotlight  and i will start typing terminal and hit enter   and now here i will say java space hyphen version  and this will show me the java version on this   system and then you can see i have java 8 here as  well so this is the first step and then you can   download jenkins.org from jenkins.io as we have  done on windows and then using this command you   can start jenkins or the other way for mac is you  can use homebrew which is the package manager for   mac and if you go to if you search for homebrew  you will go to the homebrew website which is   brew.sh and here you can see this  is the missing package manager   for mac and this is the command you can just  copy this command and copy this on your terminal   and then hit enter and that will set up brew  on your system and once brew is installed   you can say brew space hyphen hyphen version to  check the version of brew installed on your system   in my case it is 2.7.0 now using home view we can  install jenkins so here i can say first i can say   brew check or i can say brew search to see what is  the package name for jenkins and it will show me   all the package names and i will search for j and  i will go to jenkins and here you can see we have   jenkins here so i can use jenkins or we also have  the long term support or long term stable version   which is jenkins hyphen lts so i can use this  and i can also say here brew info jenkins hyphen   lts to check the details of this and now to get  this i can say brew install jenkins hyphen lts   and this will download and set up and install  jenkins so here in my case it was already   downloaded otherwise you will see a download  progress bar here and it will take some time based   on your network and once this is done you can  then say brew list it will show all your packages   and here you can see bajanki's lts is already  there on my system and now if i again say i can also uninstall using brew uninstall  jenkins hyphen lts and it will uninstall and   then i can again say blue install this will  now start downloading and you can see and   because it already found the files so  it will go ahead and now it says that   to start jenkins i can use this command that is  brew services start jenkins lts so i will use this   i will say brew services start jenkins hyphen lts  and this will start jenkins on the default port   that is 8080 and you can see it says successful  and if i go on my browser and go to localhost   and the default port that is 8080 and  we will get the jenkins dashboard here   and then the rest of the things will be same as we  have seen on windows that you will have to provide   the admin password and then install the suggested  plugins and then start jenkins now if you want   to start on some other port you can go to this  location so if i say view info jenkins hyphen lts   it will show me the location where jenkins is  set up and in my case it is user local seller   this folder you can just copy this from here and  go to your finder and go to this location so i am   pressing command shift n g on my keyboard and i  am going to this location and here you will find   this file homebrew mxcl jenkins plist you can also  update or edit it from command prompt or terminal   i will open with any text editor and here  instead of port 8080 i can change this to 1990   and save this and now i will first stop or restart  jenkins i can say restart or i can say stop let me   say restart and then once this is restarted i will  go again to 1990 so now i'm going to localhost   1990 and now it will start jenkins on port 1990  so this is how you can set up and start jenkins on   mac operating system so now moving to how to  install jenkins on linux now i have a separate   session where i have shown how you can step by  step install and set up jenkins on aws linux   and you can get that session from my website  that is automation step by step dot com   and if you go to the home page and you can scroll  down and under ci cd devops you will see a jenkins   playlist you can get it from here or just  search for how to install jenkins on linux and   say raghav and it will show you the video and this  is the one let me also copy this link and put it   here i'm not re-recording it because it is already  available and you can check this also if you want   to jump to any of the topics you can go to the  description and you will see a timeline where   you can see all the chapters and you can click  on the timeline to jump to any of the topics   so this is where you can check how to install  jenkins on linux and now let me close all this   and we will now move to the next topic so next we  are going to look at the jenkins configuration so   once you have started your jenkins and you are on  the dashboard you can see here this is our jenkins   dashboard and here you will see some of the menu  items and then here you will see a message welcome   jenkins and in case you have already created any  projects or jobs on your jenkins you will see the   list of the jobs here so as of now this is a fresh  jenkins so i'm seeing a welcome jenkins message   also at the top you can see this is the jenkins  logo and here you can do any kind of search on   your jenkins this is your user and you can go  from here and see all the details about your user   and then going back to dashboard here is a option  to log out from jenkins and then if you go to the   bottom and at the bottom right corner you can see  the version of jenkins and then there is a rest   api of jenkins here and now if you go to manage  jenkins here it will take you to this window   where you can see all the details system  configuration security plugins status information   troubleshooting tools and actions and here if you  go to configure system this option here this will   take you to the settings or the global settings of  changes now here the first thing you will see is   the home directory and this is the directory where  all your job configuration all the project details   everything that you create on jenkins is stored  and by default on windows it is c users and your   user and dot jenkins folder and if you are on mac  and go to your jenkins and again go to configure   system this will show you whatever is the home  directory of your jenkins i will also show you   how you can change this directory if you want to  and here if you want to give any system message   and if you see this question mark here whenever  you click on this question mark against any of   the fields or items it will show you the details  or the information about that particular field so   here this field system message is to display the  message at the top of jenkins page for example   if i say myjenkins here and say apply and save  and now you can see it is showing me this message   at the top of jenkins so just in case you want to  do any kind of customization like this you can do   that and then this is the number of executors or  the number of concurrent jobs that can run on this   jenkins instance and you can change it from here  this will be the label for this particular jenkins   so in case you are doing any remote execution  and you want to select the jenkins instance   using labels you can do that this is the usage how  much do you want to use use as much as possible or   only build jobs with label expansions matching  this node so all this you can set from here   we have other settings like the jenkins location  so this is my current jenkins location that is   localhost 9191 and i have not yet configured any  admin email address that i can configure from here   then all these global properties pipeline  statistics timestampers fingerprints all the   settings are here i will show you some of these as  we go along with this series now if i go back to   my manage jenkins you can see we have a global  tool configuration here and here you will see   option to configure tools like maven gate gradle  jdk and and all these options we have i will show   you some of these and then again i will go to  manage jenkins we have manage plugins and this is   very important whenever you need any kind of extra  feature or functionality we have a lots of plugins   in jenkins and you can see all the available  plugins that are already installed on your jenkins   under the available section and then if you  want to install any new plugin you can go to the   installed section and then advanced section is  to install the plugin using a plugin file or   using a proxy configuration so you can directly  upload a plugin here or user update site or use   configuration and all the plugins that are ready  for updates or a new version is available will be   available under the update section i will go back  to many jenkins and when you have set up master   slaves or nodes in jenkins you can see all the  nodes here as of now this is a single node and   this is the master but in case i want to add a new  node i can add it from here and i will see all my   nodes here so this is used for distributed  testing or distributed executions i will go   back to manage jenkins now and then there are  some security configurations like global tool   security you can manage credentials and manage  users from here i will show you some of these   status information and troubleshooting and then  all these settings are here so this is about the   basic overall jenkins settings and configuration  let us go to how to change the home directory   and now i have already shown you that when you  go to configure system under manage jenkins you   can see this is your home directory or this  is the directory where all your jenkins data   all your plugins all your projects job information  is stored now just in case you want to change this   the reason you may want to change it is because  sometimes the default location or the default   directory where it is stored does not have lots of  space and you want to create lots of jobs and data   on jenkins and you want to keep the home directory  to any other drive where there is lots of space or   it may be due to some project requirements now  i will show you both on windows and mac how you   can change the home directory the first thing is  let me first go to this directory which is c users   administrator dot jenkins so i'm on my windows as  of now and if i go to my folder and i go to see   users administrator and here is my dot jenkins  folder now the first thing i will do is create   a new folder let us say i want to go to my d  drive and i will go to tools and i will go to   i'll just create a new folder here  let us say jenkins or jenkins home   and this is where i want to create my new home  directory the first step is i will create a new   folder and then copy all the data from the old  to the new directory so let me go back to my   old directory which is c users administrator  and dot jenkins i will copy everything from here   and paste it under my new folder and this is  important because this contains all your job   all your configuration everything that you have  on jenkins so if you do not copy all your data you   may lose your projects or any setup that you have  done on your jenkins let me write down the steps   as well step number one is check your jenkins  home and that you can do from manage jenkins and   step number two is create a new folder step  number three is copy the data from old folder   to new folder and now step number four  will be once you have copied let me just   check if everything is done so yes looks  like everything is copied here now i will   go to my environment variables and i will say  create or update environment variable jenkins   home so what i have to do is on windows i will  show you on mac in a moment but on windows i will   go to environment variables you can directly  go from settings or you can do a right click   on my computer this pc and go to properties  and then go to advanced system settings and   here are environment variables now search for  an environment variable called jenkins home   if you find it you just edit it if you do not  find you can always create it so i will create   a new environment variable called jenkins home  and the value will be the location of the new   folder which is in my case this one so i'll just  copy this from here the location and paste it here   and i will say ok and you will see the jenkins  home has come here and i will save this and now this is this should be in capital jenkins  home and then i will say restart jenkins so now to restart jenkins you can either just go  to your jenkins url and say restart let me see   if that works here and as of now it says jenkins  cannot restart as currently configured and because   this is not a windows service we have just started  it using a jenkins dot war maybe because of that   so the other thing i can do is i can go to  the command prompt from where it is running   and press ctrl c on my keyboard it will stop  and then i will run the command again to start   jenkins and let me just wait and once you see  the message and this is fully up and running   go back again to your jenkins url which is in  my case localhost 9191 and log to your jenkins   and this will update your jenkins home directory  and from now onwards all the updates and plugins   information projects everything will go on your  new directory now just in case you have added   or installed jenkins as a windows service or  using a installer or a msi file in that case   you can go to your jenkins folder which most  probably be on your c program files you will   find a jenkins folder here in your program files  if you have installed jenkins as a windows service   and they will be a jenkins dot xml file there you  will find genki stock xml if you open it with any   editor or notepad you will see there will be a  section for jenkins home and you can just update   that section with the new location of jenkins home  and then restart your jenkins and your location   of jenkins home will be changed now in case you  are on mac you will do the first few steps as it   is that is you will create a new folder and add  all your data and then to update the environment   variable jenkins home you can go to terminal and  then here i will go to a new tab of the terminal   i will press command t and now i am on the new  tab and then you can say export jenkins home   equals to whatever is the new location for example  if i create a new folder here and say my jenkins and i will press command i to copy its location and i will say jenkins home equals to my jenkins  and i will press enter now this will update the   jenkins home but this will update only for this  particular session that is temporarily on this   machine for the session of this terminal if i  have to do it permanently i will have to go to my   dot bash profile you can go to your users folder  i am pressing command shift g on jenkins and now   i will go to users and then whatever is your  user folder in my case it is stargave and here   you will see a hidden file called dot bash profile  if you do not see the hidden files you can press   command shift and dot on your keyboard and now  you will see all the hidden files and now you   will see this file which is dot bash underscore  profile in case you do not find it you can always   create a new file and now i will open this file  with any of the editors you can open with any   editors and now here you will again have to copy  this statement that is to export jenkins home   a new location and save and close and now i  will just restart my jenkins i am pressing   ctrl c and now i will run my jenkins again on  mac this is i am doing on mac operating system   so it says jenkins is fully up and running  if i go to my jenkins now on my mac   and i will log in and then you can check your  jenkins home on mac jenkins it will be changed   to the new location so this is how you can change  the home directory in jenkins let me close all   these extra folders and windows now we will learn  how to set up git on jenkins so git is for version   controlling and just in case you have to integrate  your jenkins with your git repository you can use   this on jenkins so step number one here is you can  go to manage jenkins and go to manage plugins let   me show you on my windows and it will be  same on your mac or linux jenkins as well   i will go to manage jenkins and here i have manage  plugins now here i have already shown you that all   the installed plugins will be present under the  installed tab and for getting a new plugin you   can go to available and search for the plugin  let me first check if git is already installed   i will go to the install tab and search for git  and here let me see yes you can see git plugin   is already installed here so i can just uninstall  and check this now you can see if i go here and   try to check this it is saying this plugin cannot  be disabled because it has dependence so just in   case you do not find it here you can always go to  the available section search for git plugin and   then you will have an option to install without  restart it will you can check that plugin and   install without restart and that will install git  and all the dependent plugins and then you can use   get source code management in the job i will show  you in the next session how can you configure a   job and then how you can connect a git repository  using git plugin so let us now see uh i will show   you first how to create a job on jenkins so here i  will go to jenkins and go to my jenkins dashboard   and now if you have no job already created you  will see a option here create a job otherwise   you can also go from here new item click here  and you can give any name i will say this is   test job you can give any name here and then  you can say this is a free style project i will   click here and say ok and this will take you  to the job configuration page now here on the   job configuration page you will see some tabs at  the top so we have general source code management   build triggers build environment build and post  build actions and in front of most of the fields   you will also find a question mark like this  and this will be very helpful if you do not   know what exactly this field means you can always  click on the question mark and it will show you   all the documentation about that particular  parameter or the field now if you go to general   you can give a description about this job or  project then we have some other options like   if you want to discard old builds of this job  if it is a github project you can get from there   and if you want to disable the project and then  there are some advanced sections where you can   say what is the quiet period retry count and  if you want to use a custom workspace for this   project you can do all this from here then if you  go to source code management now just in case you   see the options a little different that may just  mean that you have either some extra plugins for   source code management or any other section or  you have some less plugins that what i have on my   jenkins so do not worry if you see some different  options here normally you will see git sub version   and other source code management options  here in my case git plugin is already added   so therefore i am getting a get option here  and i will show you in the coming session how   do we configure a git repository then we have  build triggers so here how do you want to build   or how do you want to trigger the execution of  this job you can trigger it remotely or if you   want to trigger it after some other project  is built you can check this here and then   also give your project name here or if you  want to build periodically you can give some   crown expression here and you can click on the  question mark again to see how exactly you can   set a schedule for this job then if you want to  configure it using some github hooks you can do   that also if you want to poll sem that is poll  the source code management system whenever there   will be a new commit on the remote repository you  want to build this project you can also set the   schedule here so all these are the options  for build triggers under build environment   you will see options like delete workspace before  it starts and then some other build tools like and   gradle etc then we have the build section here is  where you will give your exact build commands like   if you want to add a windows batch command  or shell or and or gradle script all these   build steps can be added here and then post build  action is what should happen after this project   is executed if you want to send some email or  publish a report or build some other project   all that can be done from here and this can also  be configured by adding more plugins so this is   how your job configuration and the job  configuration page looks like in the coming   topics i will show you more on how do you create  different types of jobs so now let us move to the   next topic that is how do you connect with the git  repository or a git remote repository on jenkins   so the first prerequisite is you should have  already added the git plugin as we have learned   in the earlier session and you should be having  a git option under your source code management   now if you go to any of your github repository let  us say i go to github.com and it can be bitbucket   or any other repository and here you can create  a free account on github.com so you can just go   to github.com and do a sign up here you can create  a free account and if you do not have any account   on github i will suggest that you create a  account it will be very helpful in future as well   in my case i already have an account so i will  sign in and i will give my username and password let me give the password again and yes it has now  signed in now let me create a new repository you   can just click from here and say new repository  or just go here on this button and say new and   i will say jenkins demo and keep it public for now  and you can give any description which is optional   and then i will say create repository now  as of now this is empty now if you just   scroll down you can see it says get started by  creating a new file i will just click here and   i will say here this is readme.txt and i will  say here this is a sample file created for   jenkins demo and i will say here commit this  new file so this will add this new file to this   repository and you can see it is now added and now  to get this on jenkins or to clone this repository   on jenkins i will go to my job you can create a  new job or use this test job that we just created   go to the source code management section and  here click on gate and now here you will need to   provide the repository and your github credentials  so before you do that let us go and add the   credentials i will go to my jenkins dashboard  and let me also apply and save the changes i   have done on my job and now you can see if i go  to if i go to dashboard and go to manage jenkins   and scroll down here is the option to manage  credentials i will go here and here i will just   click on this jenkins and click on these global  credentials and here i have got a option to add   credentials i will click here and i will give the  username of my repository or github repository   and the password you can give some id if you  click on the question mark you can see this is   a unique id using this you can identify these  credentials and if you leave it blank it will   be generated by the system i will say my github  here so that i know this is my github credentials   i can also say here in the description my github  credentials and say ok and you can see this is   now added now if i go back to my job i will go  to dashboard and you can see my new job is here   that i just created i will go here and click on  configure and again go to source code management   and again go to git and now if i see here you  can see my github credentials have come here so   add this and in the repository url i will just go  and copy this repository which is jenkins demo if   you click on this jenkins demo here in the url you  can just copy this url or you can also get it from   here if you click on code and you can see you  can also get it from here or just copy this url   and i will add it here and if you click outside  you can see the error has gone so this is fine you   can also get a specific or a particular branch as  of now it is master by default so i will leave it   as it is and now i will say apply and save and now  if i build my job you can see a build now button   here i will click this and it will start the  first build of this job and you will see the build   history here so you can see it has shown me build  one i can go inside this and say go to console   output and check and you will see it is saying  cloning the remote git repository and this is the   location where it is cloning it so i can go here  i will copy this location and go to the folder   this folder and you can see as of now it  shows me a dot git hidden folder which is fine   let me go and check again on my repository now  here if you see the branch name is main and there   is only one branch let me try to go back to my job  i will go back to project here and say configure   and say source code management and now  here i will say the branch name is main   and apply and save and i will build the  project again and let me see this is the second   run i will again go to the console output and now  yes this is fine and success and now if i go and   check the folder again i will refresh this and you  can see readme.txt has come here if i open this   this is what i added on my repository now here  if you see the default location it goes to your   whatever is your jenkins home directory in this  case my directory is here and under the workspace   folder there will be a folder by the same name as  your job so in my case it is test job and this is   where everything will be stored for this job  just in case you want to change this location   you can go to your project i will go  back to my project and go to configure   and i will go to general and advanced  and now here you will see use custom   workspace here is where i can give any custom  workspace directory so let us say i go to my   desktop and i will create a new folder i will  say my test job and this is the folder i want   to use so i will copy this location and add this  location here if you want you can also give a   name i will say apply and save and now if i build  my project again you will see all this will come   in my new location or my new folder so you can  see the repository is getting cloned here also   if i go to this third job run and go to console  output now you will see it is using this new   location for this job so you can also change your  default directory or the workspace of the job like   this and then you can connect with your remote get  repositories and clone your projects using jenkins   i hope this was useful i have also written  all these steps here and all these steps and   all the nodes everything will be available in the  description section below this video so whenever   you have any questions any doubts always check  the description section and they will also be the   timelines for every topic if you want to jump to  any topic you can use the timelines in description   so moving to the next topic how to use command  line in jenkins cli so until now you have seen   that we have used this jenkins gui to create  and configure jobs and run everything from here   however sometimes we may need to run our jobs or  do any kind of setup or update from command line   and not use the jenkins gui and we need cli  for several reasons it is faster it is easier   and sometimes when you want to integrate your  jenkins or any process on jenkins with some other   project or some other process command line will be  very useful so let us see how we can use command   line and here i have written some steps we have to  start jenkins i am already on my jenkins and then   you have to go to many jenkins configure global  security and enable security so i will go to   manage jenkins and configure global security and  here if you see enable security you can check that   in my case it looks like it is already enabled  so i will say apply and save and now next step is   you go to the cli page of jenkins and this is  you just have to append forward slash cli to   your jenkins url so whatever url you are on  so in my case i am here localhost9191 i will   say forward slash and say cli here and hit enter  and it will take you to the jenkins cli page now   here you can see documentation and then here  are all the available commands and then here is   an option to download the jenkins cli jar i will  click this and this will download jenkins cli jar   and once this is downloaded you can keep it at  any location on your system so let me see it is   downloaded and if i see this is on my downloads  folder so it has come here on my downloads folder   i will just keep it here and i will open command  line or terminal in case of mac and go to the   location of this jar file so the commands or  the steps are same for mac as well so once you   have got this jenkins cli you can open terminal or  command line and go to the location of this folder   or a shortcut is on windows you can directly  say cmd here on the windows folder address bar   and then hit enter it will open the command prompt  on the same location and now from here i can   write the jenkins cli command now if you go to  the jenkins cli page you can see this command and   this is very intuitive you can see it is showing  me the location or the instance of my gen case   which is on localhost 919 so i can directly copy  this command and then go to the command prompt   and i will paste this command and hit enter  and you can see i am getting all these options   now just in case you do not get this command  running or you have some authentication issues   you can always go to jenkins dashboard and then  go to manage jenkins and here you can go to uh   security or you can go to your user whatever is  your is your user you will see it at the top here   and then go to this drop down and go to configure  and here you can see api token credentials and   ssh password everything so if you have set  some ssh you can just use this and use this   as a password in case it is asked when running  the cli command also the other thing is if you   are still getting some authentication issues  you can use this command that is use hyphen   hyphen username and your jenkins username and  hyphen hyphen password and your jenkins password   to run the jenkins cli command or you can go  to jenkins manage jenkins and configure global   security and here if you scroll down you will  see an option anyone can do anything this is not   safe but just for trial and doing hands-on you  can check this and apply and save and then open   command line again and then run the jenkins  cli command and you should see this working   so you can see all these commands you can do a  build you can update jobs get jobs copy delete   etc all you can do so let me try to run a job if  i go to my jenkins and go to this job we have this   test job created and as of now it's so it shows  six executions of this job now i will go to my   jenkins cli and here is the build command i will  hit this and this is the command that i can use   to build a job so i will say let me also show you  if i just say here if i just use this command let   me go to the cli again if i use this command java  hyphen jar and jenkins cli dot jar and say help   so here you can see it says neither minus s nor  the jenkins url environment variable is specified   so we have to say minus s and then we give the  instance of our jenkins that is http localhost   919 in my case and then the rest of the command so  i will use this and go to my command line and let   me clear this and i will paste this command and  now i will say build and i will give the job name   in my case it is test job and let me run this and  uh here it is saying anonymous is missing the job   built permission so again i will have to go and  check on my jenkins i will go to manage jenkins   configure global security and i will for now  say anyone can do anything and apply and save   and let me see if i can use the same command  line or i will have to open it again if i run   this yes it is running you can see it has  not given me any output here but if i go to   my job and check there were six executions  but now you can see there are seven executions   also if i want to wait and see the output i can  use the same command with minus s flag and if   i run it now you can see it says started  execution number eight and everything was   successful so this is how you can use a lot of  other commands from jenkins cli and you can try   all this and let me know if you have any issues  so this was about jenkins cli so let us now move   to how to create users manage users and assign  roles and here we are going to see how to create   new users how to configure users how to create new  roles assign user roles and then how to control   user access on projects so let's get started  and i have also written down the steps here   so here uh let me close all of this and i will go  to my jenkins dashboard and here if i go to manage   jenkins and here i have a option manage users i  will go here as of now i have a single user which   is my admin user and if i go to this settings or  configuration you can see all these options i can   add api token credentials update email password  ssh and termination session user defined time zone   all this i can do for users from here and i will  go back to users and now here i have an option   to create a new user let me go here and i will  give a username i will say user1 and i will give   a password here i will confirm the password and  i will say the full name is user1 and that's it i   will create a user it requires an email address  let me give some dummy email address for now   and say create user and user 1 is created i will  create another user i will say this is user 2 and   again give our password confirm password full name  is user 2 and i will again give a email here and   create the new user so as of now we have created  two more users and here this is the admin user   which i have which i am already logged in and you  can go to your user settings also from this top   user drop down and can go to configure and can see  your credentials views and builds everything from   here now the next step is we have to add a plugin  called role based authorization strategy plugin   so let me go to my dashboard on jenkins  manage jenkins and i will go to manage plugins   and i will go to the available section and search  for role and here you will find a plugin called   role based authorization strategy i will select  this and say install without restart so it will   install the plugin and all the  dependencies and this is done and now   i will come back to my dashboard and now you  can go to many jenkins configure global security   so here i will go to manage jenkins  configure global security and here   under authorization you will see this option role  based strategy and this you will see only after   the plugin is installed so i will select this  and say apply and save and then i will create   roles and assign roles so i will go back and  i will go to manage jenkins and i will go to   manage and assign roles and again this you  will see only after you have added the plugins   so i will go here and here i have manage  roles i will go here as of now you can   see we have a single role called admin  and this admin user has all the accesses   now i can add more rules i will say i want to add  a rule called employee and then let me go again   and i will scroll all the way here i have  a add button here so i will say employee   and click on add and let us say this employee is  now added here and i will say i want to give a   overall read permission to employee and here on  credentials i don't want to give any permission   agent i don't want to give any permission and on  view i don't want on the job let us say i want to   again give the read permission on job so if you  are an employee you can just view and read a job   and then if you scroll down we have item roles  and then we have node roles and if you scroll   all the way to the right you can also see this  question mark which will show you some help that   this pattern is used to match the item names  job nodes slaves etc and similarly for nodes   you can add so what i'm going to do is under  the rules to add i will create a role called   tester and i will say the pattern is test  dot star so jobs having this pattern or the   jobs or the notes or having this pattern will be  aligned to this role and i will say add and now   for this role tester which follows this  pattern i want to give all these permissions now i want to add one more role i will say   developer and here i will say the pattern that  it should be aligned to is dev dot star and   i will again click on add and then i  will check all the permissions here so now i will say apply and save and now  the next option we have here under manage   and assign roles is assign roles i will go to  assign roles and as of now we have this user   and he is admin i can now add more users so i will   add my user 1 and i will make him as employee  and i will also add user 2 and again add him as   an employee here so here this user raghav pal  is admin having all the permissions and these   two users are employees now i want to give item  specific roles so i will add again user one here   and say add and i will make him developer or  let me make him tester and i will add user to   and i will make him the developer these are the  two roles we had added and i will say apply and   save now as of now i am logged in as raghav who is  the admin user and i am going to my dashboard now   as of now i have a single job called test job  let me create a new job i will say this is abc   or let me say this is demojob and freestyle and  save the job i will again go to the dashboard   and i will again create a new job i will say  this is dev job one freestyle okay and now   if i go back to my dashboard i have three jobs i  have a demo job i have a dev job one and test job   and as an admin i can view everything and i can  also have all the access to all the management   configuration everything on jenkins now let me  log out and log in as user one so i will say   user one and give the password of user one and  sign in and user one is tester now you can see   he can view demojob and dev job because he is an  employee however if i go inside you can see he   does not have any permissions to change anything  also if i go to the dashboard you can see here are   limited options he cannot go to manage jenkins  or do any changes but if he goes to test job   he has all the options to make any changes and do  everything on this test job because he is a tester   and similarly if i log out and login as user 2  who is a developer i will give the username and   password and sign in and now again you can see  he can see the demo job and devtop uh let me   log out again and see this is user 2 who should  have who should be having the permissions to only   make changes in the dev job and let me go and  yes he can make changes here to the dev job   and if he tries to go on the test job he  cannot see the configuration here and then   here as well he cannot go to manage  jenkins and do any kind of configuration   so this is how you can create and manage users  and assign roles i hope this was useful and now   we can go to the next topic so next i want to show  you how you can create and change the jobs so that   there is a continuous integration between these  jobs and they are triggered one after the another   and for this i'm going to i can use these jobs  that i already have and i am now already logged   in as my admin user that is raghav and i have  a demo job dev job test job let me create one   more job i will call this as let me call  this as build job there will be a build job and inside this build shop i will go to the  build section and here i will add a windows   patch command as of now i am on windows if you are  on linux or mac you can say add shell or you can   say execute shell this is the option that you can  use for mac or linux now here i will say echo i am   inside build job and i will say apply and save and  if i now build this job and go to the locks or i   will go here and go to the console output you can  see this is just running this i am inside build   job so this is successful for the dev job i will  again go to the configure section and go to build   and here i will again add a windows patch command  which will just put on the console i am inside job   reply and save and i will go back to the dashboard  we have now all these three jobs we have already   seen a test job if i go to the configure and go  to the build section and i will add a command   i will say i am inside test shop now if you  want to change these jobs let us say i want   to first run the build job then the dev job and  then the test job i will go to the build job and   go to configure and i will go to post build  actions now here if i go to the post build actions   and here we have a option called build other  projects i will select this and now i can say   after this job is built i want to run the dev job  1 and i will remove the comma and click outside   so this is fine and now here again we have three  options trigger only if the build is stable that   means this particular job if this is stable only  then trigger the next job that is dev job one   or if you want to trigger even if the build  is unstable and even if the build fails now   what is the difference between stable and unstable  that means that if the last few runs of this job   are successful then only build this new job  or the next job otherwise do not build this   job if the current job is unsuccessful in the last  few instances so i will say let me do it again i   will say build other projects and this is dev job  i want to run and i will say apply and save now if   i go to the dev job if i go here you can see it is  already showing that this has a upstream project   called build job and now i will again go to this  its configure section and now i can also go to   build triggers and here we have build after other  projects are built so this is kind of pre-trigger   or this means that in this job i am saying if  some earlier project is built then build this   particular project or if you want to have a post  build trigger i can go here and again i will say   build other jobs and here i will say desktop and  apply and save and now if i go to my desk job   you will see there is a upstream job dev job  and if i go to the dev job the dev job has   a upstream job as well as a downstream job  now if i go and trigger the first job that   is the build job you can now see as of now the  build job has a single execution that is one   the dev job has no execution and test job has  eight executions i am just going here and i   will build the build job or i will start the build  job and you can see the next job in queue is dev   job here and after this is executed it will  run the test job so i can refresh and check   and you can see the build shop now has two  executions dev job now has one execution which   was earlier 0 and test job is under execution so  if i refresh it again you can see it is now having   nine execution so now we have changed our jobs and  this is how we can do chaining of jobs in jenkins   and now after you have changed your jobs  you can actually also create a pipeline   if you go to manage jenkins and go to manage  plugins and here you can find some plugins like   build pipeline so if i search for build  pipeline under available section so here   you can see there is a docker pipeline there  is a build pipeline there is all these pipeline   plugins available and you can use this to create a  pipeline uh something like if i say jenkins build   pipeline plugin and if i go to the images you can  see you can create here a pipeline something like   this so these jobs will be shown as tiles a job  that is in progress will be shown in yellow tile   which is yet to be executed in blue tile and then  the jobs which are executed will change color to   green or red now if i go and see here this build  pipeline plugin as of now it is showing that   this is not safe and there is some vulnerability  here so you can just skip this one for now until   this is fixed but because this is a test system  that i am using i will try to show you i will   say install without restart and now once this is  installed i will go back to my jenkins dashboard   and i will go and click on this plus button here  and here you will see a option build pipeline   view and this you will get only after you have  added this plugin and i will say this is build   pipeline and say ok and this will take you to the  configuration page now here we have some options   like a layout and select initial job the first  thing you have to do is select your initial job   in your chain and then you can say how many number  of bills to display on the screen i will say five   apply and okay and now you can see it will show  you a view like this and now you can run it from   here so if i click on run it will start the next  pipeline which will be pipeline number three and   you can see this is started what is in progress  will be shown in yellow what is done will be shown   in green or red and what is yet to be done will be  shown in blue so you can see as of now job number   uh test job is in progress and then it will  change the color to green after it is successful   you can go and check the console directly from  here and you can see the console of this job   if you want to restart or retry a job you can  start from here so this says you can rerun a job   you can go to the history here and see all the  history of these pipelines and all these jobs here   and then you can also configure delete or  manage this pipeline so this is how you can   do pipelines in jenkins and i  will show you more on this later in this session we are going to learn what is  jenkins pipeline and how do we start a jenkins   pipeline and how do we create a jenkins file this  is going to be a very basic beginner session so   do not worry if you have never understood what  is jenkins pipeline or what is a jenkins file   i will go very basic step by step and before  i write down the steps and show you the demo   let us see what is pipeline and what is  jenkins pipeline so i will just go and here   you can see until now on our jenkins we have been  creating jobs on the gui and we create a job from   here and then add all our details of the job in  the job configuration and then we run from here   now if i go and search for continuous integration  and delivery on google and if i go to images   and here let us see this image here so if you  see here here we have kind of a pipeline and in a   pipeline we have multiple jobs or processes linked  together that is one runs after the other and they   are all executed with the automatic trigger so  for example here is a dev job or a dev process   if this is successful it will then trigger the  test process and if this is successful it will   then do the integration part and therefore you can  see whether we are doing continuous integration or   delivery or deployment all these phases all these  jobs are linked with each other they are sequenced   and linked in the chain and they have automatic  trigger now when i talk about jenkins pipeline   jenkins pipeline is a process or a way to  implement this ci cd process and if you see   any of these images you can see here so let us  say we have these jobs we have a built job here   or a build stage we have a integration testing  other testing and then approval and deploy and   this is a pipeline so all these jobs are linked  with each other and this is exactly what we are   going to create using a jenkins file in this  session so jenkins pipeline is a way of jenkins   to implement ci cd that is continuous integration  delivery and deployment and that basically means   all these jobs that you have in your project all  the stages of your project starting from build   so starting from the dev build to deploy to test  and release all these stages or all these jobs   can be integrated or chained with each other using  jenkins pipeline and to implement jenkins pipeline   we use a file called as jenkins file so jenkins  file is basically pipeline as a code we call   jenkins file as pipeline as a code because  in this jenkins file we will write a code   or we will write a script now do not worry it is  going to be very easy don't think that you do not   have any programming or coding experience i will  show you very basic step by step how to do this   so basically we write a script or we  add the instructions in the jenkins file   to implement the pipeline or to run all these  stages that is build deploy test and release and   this is this can be anything for example you have  your project where you have some different stages   you can do that in a jenkins file so that is a  jenkins file and now i will show you how to create   jenkins file and how to implement jenkins pipeline  or pipeline in jenkins so step number one is start   your jenkins and i believe you have already  started your jenkins and i am here on my   zen case it is already started and i have some  jobs here now what i'm going to do is install   pipeline plugin so this is the second  step that we need to install the   pipeline plugin and let me very quickly  show you if you go to manage jenkins   and go to manage plugins first thing you can do is  go to the installed section and check for pipeline   so most of the cases if you have added all the  suggested plugins while installing or starting   jenkins for the first time you may already have  a pipeline plugin installed so if i search here   you can see here it is so this is the pipeline  plugin that we need so this is what we need just   in case you do not find it here you can always go  to the available section find this plugin and then   you can say install without restart and install  the plugin and once you have the plugin installed   go to step number three that is create a new job  i will go on my dashboard and now i will create   a new job sorry i will have to go back and i  will just have to click on this new item here   and i can name it anything pipeline one or you can  give any name here now the type should be pipeline   here until now we have been selecting freestyle  project but now it should be pipeline and this   option will come only after you have added the  plugin so click on this pipeline and say ok   now here you will see general section like in  earlier projects and then you will see build   triggers here we have all these options then you  will see advanced project options and if you click   on advanced here you can just add the name of  the project here and then we have a section   for pipeline and this is where we can create a  jenkins file or we can get a jenkins file from our   cloud repository or source code management tool  or repository now here i will say step number   four create or get jenkins file in pipeline  section so here if you see we have option   here we have pipeline script and here we have  two options either i can create a pipeline script   within this job that is here or i can also  get it from a source code management tool like   git or github or any cloud git repository or any  source code management system for now i will say   pipeline script and in the next session i will  show you how you can get it from a source code   management system so i will select pipeline script  here and now here is where you can write your   code or script and if you go to this  drop down here you can see we have   some sample scripts like hello world get a plus  maven and scripted pipeline a jenkins file can   be written in two ways a declarative format or a  scripted format the scripted way or the scripted   structure is the older way and the declarative way  is the more recent ways of writing a jenkins file   both of these uses groovy there is a difference  in the structure and format and in the drop down   you can see all these options are for declarative  but you can also select scripted pipeline here you   will see a sample here this is how we create a  scripted pipeline we give a node here and then   define our stages and give all our steps here so  there's a build stage and here you can see all   the steps what should be done in the build stage  then all this is here this is the earlier scripted   pipeline way but this time i am just going to have  descriptive which is i will select a hello world   pipeline here now if you see here it starts with  pipeline we say pipeline and a curly bracket start   and the curly bracket stop inside this we give  the agent if we have to run this on a particular   agent we can give the name here or if it can be  run on any agent i can say any then i say stages   and under this i will give the stage name so  this is hello and then i can give the steps of   this stage here i'm just saying echo hello world  so this is a very very simple descriptive pipeline   jenkins file where we are having a single stage  called hello and inside the stage we are printing   hello world on the console in real world the stage  name can be something like build deploy test etc   and in the steps you will have all the steps that  you will be needing to do in that particular stage   but for now let me keep it very simple as it is i  have got this jenkins file and here is what i have   written now if you want you can also click on this  pipeline syntax and this will take you to the page   where you can actually create steps for example  i want to create a build step that is build a job   in the pipeline i will select the job let us say i  say deaf job this is one of the jobs on my jenkins   and then i can give some quiet period like five  seconds or something you can always click on these   question marks to see what exactly this field  means and then i will say generate pipeline   script and you can see this is what i can use  in my jenkins file so just in case you have   to need you need any help you can always come  here and then select what you exactly want to   do and generate the script for that for now i  will say apply and save and now the job is saved   and now i will click on build now and let us see  what happens so you can see this is running here   and once this is executed you will see  we have got this stage view here so we   had a stage the stage name is hello and you  can see the name here and then you can see   the time taken by this particular stage and this  is the first pipeline you can see number one here   and then the date and there are no  changes from the source code management   and then this is the time taken and this is  the average time taken now if i run it again   you will see now this is the second pipeline  or the second run of the pipeline and this   is a time taken and this is the average time of  this particular stage and if i go to any of the   runs and go to console output you can see  this is how the stage or the output looks   like so in this particular stage we  are just printing this on the console   now let me go back to the project and i will go to  configure again and i will go to pipeline now here   i want to add some more stages so i'm just  going to copy this and hit enter and paste it   and paste it again so let us say this is my hello  stage which is where i'm just printing hello world   let us say this is my build stage and here  i'm saying building now as i have said in   real world you will have your actual steps to  build some project here then i will say deploy and i will say here deploying and let us say  i will have one more stage here called test and i will say testing here and then i will have a  stage called release and i will say releasing here   and i will again apply and save and now i will  build again and now you can see and here you can   see all these stages have come so this is the  build stage deploy stage test stage and release   and i can go and check the lock for any of the  stages this is as of now i am only printing   building here similarly if i check the logs it is  printing testing but otherwise you will have your   actual build steps here and this is exactly  how this looks like as we have seen earlier   so here i will say run and check the output so  this is in very very simple words in very very   simple way how you can start with jenkins pipeline  and jenkins file in the next session i will show   you how you can create this jenkins files in  your source code management system and then get   it on jenkins and run from jenkins i hope this was  useful thank you for watching in the last session   we have seen how we can create a jenkins pipeline  using a jenkins file within a jenkins job now let   us see how we can get this jenkins file from git  or any source code management system and then use   it in our jenkins job so here let's get started  with step number one you can create a new job or use existing job and it should be of  type pipeline and we have already created a   job of type pipeline in the earlier session so i'm  going to use that job this is pipeline one that   we created and here if i go to configure you can  see we have already run some of the pipelines and   if i go to configuration page of this job and go  to pipeline you can see this is what we used here   we have two options we have pipeline script and  pipeline script from scm in the earlier session we   used this and we added this jenkins file here now  i am going to create a git repository so i will   say create a repository on github and you can  use bitbucket or any other cloud repository or a   git repository for this i will go to google  and search for github and go to github.com   and you can create a free account here and  do a sign up in my case i will do a sign   in i already have an account i will  add my user and password and sign in   and i am going to create a new repository here  you can go from here and say new repository or   just go from here and click on new and  here i have to give a repository name   i will say jenkins pipeline demo and you can  give some description which is optional and   you can make it public or private i will keep  it public so i do not have to add credentials   although i will show you how to add credentials  in your jenkins and i will say create repository   so this is my git repository on github now  the next step is step number three will be   add jenkins file in the repository now inside your  git repository you can create a file and commit   it on your repository now you can do it from your  local system and then commit it here just in case   you want you can watch my git and github tutorials  but for now i am going to keep it very simple i   will go and click here so here it is create a new  file and even if you do not get this option from   here i will show you later as of now i am going  to click on create a new file and here i will give   the file name now i'm saying jenkins file although  you can name it anything we will anyways have to   provide the location on our jenkins job so i will  say jenkins file or you can say abc123 whatever   you want and here in this file i want to add the  script of my stages as we do in the jenkins file   as we have done in our earlier session so this  is the declarative script the groovy script that   we add in our jenkins file and i'm just going  to add it here and now i will commit this file   now just in case you want to add any other file  you can go from here and create a new file and   add it now as of now i have added this file so  from my jenkins in my junkies job i will now say   pipeline script from scm and the scm i am going  to use is git and this comes if you have the get   plugin added in your jenkins just in case you do  not see this option you can go to manage jenkins   manage plugin and add the git plugin now i  have to give the repository url so this is   my url i will click here i can copy the url from  this address bar or i can also copy it from here   both will work i will add the url here and now  if this is a private repository i will need to   add the credentials otherwise i can leave it  just in case you have to add you can go here   click on jenkins and give your github username in  this case i will i'm using github so i will say   my github username my github password  if you want to give any id that is fine   otherwise it will auto generate and i will  say my github credentials here and say add   and now here i can just add these credentials and  then i have to select the branch so if i see on my   repository the branch that i have is called main  i'm just going to change from master to main here   and now here i have to give the script path now  in my case i am calling it as jenkins file so if   this is fine i can keep it as it is otherwise if  you have any other name you can give the name here   also if you have your file in some folder then you  can give the folder name first for example you can   first say whatever your folder name is and then  forward slash whatever your file name is so you   can do that just in case you have any issues  you can always click on these question marks   which will give you the description how you have  to give this field so you this will help you now   this is done i will say step number four is add  repo and jenkins file location on the in the job   under pipeline section or i  should say even before this   step number four should be under  jenkins job pipeline section select so we have to select here pipeline script from scm this is the definition and now i should  save and run so i'm going to apply   and save and i will say build now and let us  see we have already done three builds of this   pipeline and you can see the fourth build is here  and everything is fine and you can see all this is   now coming from our repository the jenkins file is  coming from the repository and now it is running   i can go and check the details in the console  output and you can see this is coming from our   repository which is here github jenkins pipeline  demo and it is first cloning the repository   and you can also see the location where this  repository is cloned if i go to this location   i will see my jenkins file from the repository so  if i just go to my folder and go to this location   you will see this jenkins file has come here  and then it is running all the stages that we   had on our jenkins file and if i go back to  the project and i will say build now again   and you will see the next build of this  pipeline and everything is running fine so   this is how you can get a jenkins file from  get sem and then run the jenkins pipeline   i hope this was useful for you thank you for  watching so now in this session we are going   to see how we can clone a git repository using  jenkins file in the jenkins pipeline series so   here i will go on my jenkins and let me  create a new item here and i will say pipeline   git demo you can name it anything and  i am selecting pipeline here and say ok   now here i will go to the pipeline section  and here we have already seen in the earlier   sections that we can get a pipeline from  source code management system or we can   create a pipeline script here itself and we can  create the pipeline syntax or code in two ways or   two formats declarative and script it and we have  already learnt about this in the earlier sessions   so now here if i show you i can just click on  hello world and it creates a sample descriptive   pipeline code of jenkins file so this is a  jenkins file with a groovy script that we write   and here we have all our stages now  i can go to pipeline syntax here   to take some help and to generate the syntax  and here in the sample step i will say git so   we have a git here and here it will ask us for  the git repository so let me go on my github   and let us say i am just going to use this jenkins  pipeline demo that i created in the earlier   session so this repository url i will copy and i  will paste the url here you can get any of your   repository urls and the branch name i want is main  and you can see the name is main here and then   if i want i can add the credentials i have already  shown in the earlier session and if it is a public   repository even if you do not give the credentials  it should work and then let me just add it here   and then if you want to include polling or  include change log all that you can do from   here and you can click on this question  mark and you can see the details of this   step or this field and now i will click on  generate pipeline script and this is what is   generated i can just copy it from here go back to  my job and here in the step i can say instead of   just saying echo hello or i can say  echo hello and then i can also add   this step here so here if you see it says  git branch main and then the credentials   id if you have added your credentials and then  this is the url let me show you the url here   so this is the url of my repository and now i  will say apply and save and say build and this   will start the execution and you can see this  is done and if i see the logs here you can see   it printed the message hello world here and  then if i go and check the console logs again   i will go back and click on the logs again and  here i will say git and this stage or this step   of this stage is cloning our repository and you  can see it has cloned our repository and this is   the this is the location where it is cloned and  i can also go to the run of this pipeline and go   to console output and i can see all the console  output here so this is the way how you can use   jenkins file to clone a git repository or a cloud  repository and wherever you want to have this step   in your jenkins file you can do it like this  i hope this was useful thank you for watching   i hope this complete crash course and master  class on jenkins for complete beginners was   really useful for you and jenkins today is the  most widely used ci cd tool it is free open source   and learning jenkins is very easy if you want to  re-watch any of the topics or any of the sessions   again you will see a timeline in description below  this video where you can jump to any of the topics   and for more videos on jenkins you can always  go on my website which is automation step by   step dot com and here if you scroll down you will  see a section on ci cd and devops and you can see   jenkins beginner and jenkins tips and tricks and  i will also add this complete jenkins crash course   and master class here all this will take you to my  youtube channel and my youtube playlist on jenkins   and i will keep on adding new resources new videos  here so you can always keep your learning up to   date and i wish you all the best do share your  knowledge with everyone and never stop learning
Info
Channel: Automation Step by Step
Views: 137,521
Rating: 4.9350228 out of 5
Keywords: automation testing beginner tutorials, test automation jobs, jenkins beginner tutoiral, jenkinsfile tutorial for beginners, jenkinsfile - jenkins pipeline tutorial for beginners, what is jenkins, how to install jenkins, jenkins masterclass, jenkins by raghav pal, learn jenkins, jenkins training, jenkins bootcamp, jenkins for complete beginners, jenkins full course, learn jenkins in 1 video, jenkins interview questions
Id: woMAXn4e8NA
Channel Id: undefined
Length: 94min 8sec (5648 seconds)
Published: Mon Jan 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.