GitLab Beginner Tutorial 7 | GitLab CI/CD Getting Started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome I'm Jakob and today we are going to learn about get lap CI CD from very scratch from very basic and if you do not have any prior knowledge on get lap CI CD do not worry I will go from scratch and we will go up step by step and in this session we will learn what is good lap CI CD we will create our dot get lab - Zi dot y ml file this is a file where we add our jobs and we create a pipeline and I will show you how to do that and then we will run our CI CD pipeline in gate lab so this is going to be very easy and very interesting let us start with step number one and before we start with our practical let us also learn what a CI CD and what is good lab CI is silly so I will go to Google and just search for continuous integration and delivery and I will go to images and let me go to this image and here you can see we have this continuous integration so CI stands for continuous integration then continuous delivery is CD and continuous deployment is again CD so this is what we call as CI CD and here if you look at continuous integration this is the process where we have these three jobs or these three processes chained and linked with each other by linked I mean if this first def process or a def job runs and passes it will trigger the next job that is in the test job application test if this passes it will trigger than the next job that is integration test and we will have our continuous integration pipeline completed so this is what is called as CI or continuous integration and if this all these jobs in this cycle are chained with each other and our automated triggered we call it as a continuous integration system now if we also add a acceptance test job or acceptance test process which is also automated and linked this becomes a continuous delivery because after this step our application or our product will be ready for delivery so this becomes continuous delivery and if we also add our deployment job or a deployment process that will reply to the production and all these jobs are automated and chained and can be automatically triggered then this becomes a continuous deployment pipeline so this is what we call as continuous integration and continuous delivery and continuous deployment now in good lab as well we have this corners integration delivery and deployment and here this good lab CI is an open-source CI service or a continuous integration service included with good lab and by default this is integrated with every project in your get lab since version 8.0 so if you are using version 8.0 or above get lab then in all your projects by default you will have good lab CI integrated and enabled by default and to go to the settings and to configure get lab CI you should be a maintainer or our owner or a admin on your project so if I go to my github account if I just go to my grid lab I will sign in so I am already signed in and you can see here are my projects and if you see the projects here I'm a maintainer on one project and owner on the other project so I can configure get lab CI CD so this is what good lab see ICD is now to actually create a good lab see ICD pipeline we will have to add a file called dot get lab - CI dot y ml so y ml files or ml is a format of writing text files and like we have JSON and XML ml is also a format and I will show you in a moment how to create it and we have to create this file in the root folder of your project or your repository so whatever is the root folder and we have already created a project earlier in the earlier session so we will be creating this file in the main folder or the root folder of our project now before we start creating this file this file so this is used to configure our pipelines and in every project we will be heaven we will be adding this file where we can add the details and it will define the structure and order of the pipeline and once I create it you will know exactly what I mean do not worry if there is there are some things that you are not getting once we create the file and run it you will know exactly what it means so let me create a file now if you are on Mac you can use any text editors like we have text editor on Mac and then we have text Wrangler anything will work if you are on Windows you can again use notepad or notepad plus plus or in fact you can use any editor but we have to make sure the syntax is correct and I will show you how you can check the syntax so let us say this is my Window System here I can open a notepad plus plus I will open this and let me open a new file so that I can show you from scratch and on my Mac I will open our text Wrangler file so that I can create it here so to create a file I will just give some name of the job I will say this is demo job one let me increase the font so that you can see it properly so I hope you can see it now so I will say demo job one any name you can give here and give a colon go to the next line and I will give five species so one two three four five you can give any number of spaces but you have to be consistent with that so now I will say tags and here give a Colin again go to next line give two spaces here and I will give a hyphen and space and I can give any tag here now tags are important because in your gate lab you will be having the get lab runners and they have some tags and the text should match only then the gate lab runner will run this particular file and we have already learnt about get logroño in the earlier session so if I go to my project on get lab and here if I go to settings and go to see ICD and we have runners here I will click on expand and you can see we had created this runner earlier and we had given this these tags here CI and SSS so I should be having one of these tags so that the runner can pick up this file and run it so let me say the tags I will say CI here and I will go again to next line now again I will give here script and this is in line with tags again go to next line two spaces - and here I can write any command or script I want to run so let us say I will say hello echo hello world so they should run this command in this job so this is a very simple file where I am running this script echo hello world so they should print hello world on the console and now you can also do the same thing on your windows on the notepad so you can create it like this and now we have to make sure the syntax is correct and for that you can copy the contents and you can just go to google and search for any ml file validator utility or application so I will search for y ml file validator and you can see have Yemen lint oh yeah Mel validator online all this I will go to Yemen lint and waste my contents of the ML file and here we have a Go button I'll click here go and check and yes everything is fine it says it is a valid yeah Mel so that is fine I will now just save this so I will save this file and we have to make sure the name here should be dot gate lab - see I dot Yemen as of now I am saving on desktop but I will move it to my project folder so I will say save and let me say here use dot and here it is let me just see the file I will go to my desktop and I will press command shift and dot on my keyboard because this will be our hidden file I will copy this and move it to my projects folder so in the earlier session we had created a project and in the project folder we created a folder called git lab in get lab we had my first project I am going to move it here so let me show here I have moved this file here right the same thing you can do on Windows so the steps will remain same you can just copy it in your projects folder wherever it is so it is here my first project you can just copy this file here so I can actually copy this file here alright now this was step number one and I will also copy the contents of this file so you can see it I'll also copy this in the notes this is the file I have created this was step number one and now step number two is we have to commit and push file to get lab repository so now because we have added this in our project we just need to commit and push in our github repository we have already seen the commands for committing and pushing in the earlier session so let me open my terminal here if you are on Windows you can open git bash or the command line and first I will change the location to my project so I will say CD and go to my project folder and here if I say git status you can see I am getting this file is not yet added so I will say git add dot and all these comments we have learnt and then I will say git commit so if I again say git status I should see it in green so you can see now it is added and then now I will say git commit minus M and give a commit message I will say added dot git lab - c i dot e ml file and now I will push say git push - you origin/master okay so I have I can give the URL instead of origin so here I will add the URL of my repository I will go to get lab and go to my project and here I will click on clone and copy this HTTP link and provided here and hit enter I think I'm not on my I have not already added my credentials here and I believe I have done it on Windows so let me try it from Window System I will go to my command line and go to the location of my project here and now I will say git status and yes I am having the file here I will say git add I will say git status again I will now say git commit - M added dot good lab - Zi dot y ml and I would say get push - you origin/master or I will say git push - you and give the link here I will again copy the link and they should push the changes and yes they should push the changes if I go and check my project now I should have my good lab CIE ml file here so you can see now it is here so I've pushed the changes now the next thing is step number three will be we have to create good lab runner for the project now this step we have already seen as a separate session so I hope you have seen the earlier session where we have done this get lab run now we have learnt how to install restart register and start get lab Donna and you should have watched this session I will also keep a link of that video in this session so if I go to my project you can go to your project go to settings and here you should go to see ICD and in the runners if you expand you can see we had this runner created earlier so this runner is already created so this step we have already done step number three step number four will be also make sure that the runner that you are using has our tag that you have given in your ml file so we have our tag here CI that we have given in our UML file now step four will be start the runner now I can start the runner so I can also start from my Mac or Windows anywhere we have learned this how to start so I will just say here brew service says start get lab you don't know and just to show you although we have covered this if I go to get LeBron oh so here is the documentation for get LeBron oh and we have seen this earlier all this how to install and register and everything all this we had seen earlier so if you are on Windows you can see here we have four Mac four windows all these things we have if you see rod the resisting part we have done this as well earlier in the earlier session this is for Mac OS and for Windows this is the thing and you can use this so if you are on Windows you can just run this get labs honor exe dot start dot exe start so here this is already started so that is fine so this is already started I can stop and start but that is fine it is started so once you start that or now then step number five will be make any change in the project and then commit and push so basically what we have done is we have added this CI job or we have added this gait lab CI ml file in our project that will now check for any commits and push in the project whenever you do any commits it will if you have a runner running if you have a good lab runner running having the same tags like what you have given in the file for example we have given CI here then it will start the job whatever you have given in the CI file in the gait lab CI file so now let me make some change here I will go here to my project and let me say I will just some file here or I will not add a folder I will just add a file I will say new file I'll say this is test1 dot txt this is a test file and I will save and close it if I go to my command line if I say git status this is added so I will say git add I can say test1 dot txt or I can say dot for adding everything and I will say git commit minus M and give the commit message add it test1 dot txt and now I have to push so I will say git push ma su and the URL and master and once I do this when I go to my project here when I go to my project here and I will go to see I CD and here once I go here you will see this job's getting triggered in the job section so let me push it and show you I will push this and if I go here and refresh or I go to the jobs you can see it is now here it is saying pending so this is this will run now if I go inside you can see this is a demo job one that we created in our gate lab CI file if I click here you can see this is running and this is now passed and you can see here it is running HelloWorld so it says echo hello world and it is printing hello world and you can see the locks here you can scroll from here this was a very small job so we do not have a lot of logs you can erase the job log you can see the complete raw log all this you can do so now on every commit and push in project it will check if we have a good lab runner running and we have this CI file the good lab CI file it will run the file and whatever jobs we have added whatever scripts we have added it will run accordingly so from now onwards whenever you make any changes it will trigger this jobs whatever you have configured in your file so this is in a very basic way how you can get started with get lab CI CD of course there are a lot of complex ml file set you can create as per your needs if you go to the github documentation you will see examples and samples of a lot of UML file and you can check them and see how you can use them so this was a beginning of get lab CI CD at a very basic level so I hope all this was very useful for you please do a hands-on and try some more jobs running some more jobs and get labs e ICD do show your knowledge with others and if you have any questions or any doubts do send your questions to me and I will try to reply to you as soon as I can I hope all this was very very useful thank you so much for watching
Info
Channel: Automation Step by Step
Views: 249,586
Rating: 4.6898732 out of 5
Keywords: gitlab ci cd beginner tutorial, how to run ci on gitlab, how to create .gitlab-ci.yml file, gitlab continuous integration demo, gitlab ci cd example
Id: jUiKi6FWYrg
Channel Id: undefined
Length: 22min 10sec (1330 seconds)
Published: Mon Sep 30 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.