GitLab CI/CD - Providing your own docker runners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay okay so you are here and you want to run your own cicd Pipeline on gitlab cicv you want to start to learn and test how it works but you do not want to provide them with your credit card so how can we run our own testing runner in gitlab CI CD without giving away the credit number to the website because you know internet follow me and learn in five minutes how to achieve it easily and for free first let's create a new project on gitlab like the one that I am launching right now and now let's say that this project is going to be part of my temporal projects and it is going to be a test ciccd yeah I brought yet I'm going to keep it private it doesn't matter and yes why not let's create the project with uh read me a proper readme file here it is now we need to define a pipeline but look at this we have a warning from gitlab telling us come on you really need to provide your own runners or either give me your credit card so I know that you will be responsible they are not going to charge you any amount of money it is just a way to control What actors on the internet that are abusing of the runner's services that is why we cannot have nice things in the internet anyway the point here is that it is super easy to configure your own Runner follow me to the left part of the project and we need to choose settings and from settings we go to size CD and once we are here inside a CI CD we expand the runner tab like this oh sorry not like this but like that now first thing you can take advantage of the shared pool of Runners but this is not what we want to do we want to run our own so we are going to disable the shared Runner spawn and create a new Runner like this one new project Runner is the button that we need to push then we select Linux and we provide attack for our new Runner the machine that will execute the pipeline which is going to be Docker in Docker okay located in Docker is going to be the the attack that will allow us to later when we understand better how cicd Works select a particular set a subset of Runners to execute pipelines that require some characteristics important activate run untagged jobs this is the way to allow us to create super simple pipelines that will not even require to Define this Docker in docker attack to do choose our runner and once we have that we press create Runner okay we have defined our runner but we do not have it in place so the next thing that you are going to need to need is a machine that is able to run containers uh take note of this token because we will use it later okay so just copy it to the to the clipboard for example and save that for later and don't close this screen because we will need it later to check that everything is all right the next step is is where can I find our machine to run my Docker containers if you are just learning you can take advantage of play with the girl this service is super cool and will allow you to run experiments on Docker for free through your browser of course don't put any sensible data here use only use it only to to learn and to run pipelines that do not contain any important information this is super important because this is a shared environment that is not intended to be focused on security okay anyway I'm going to jump here or and of course if you have access to any local instance on a public cloud or your own laptop you can use it instead of this service this is just because it is super easy to to play with it I am going to click on a start and I'm going to add an instance that is going to be our our runner here it is the user interface for this instance let me just clear it sorry for the small size of the of the font face but it is something that I do not want to change because not always works as expected inside this user interface now we have access to a computer through our browser with Docker already in place if we run Docker version here it is the answer to the command and we can use it to start our runner how do we do that the first thing that we are going to to do is to create the volume the disk that will contain the information with the configuration of the runner I'm just going to paste the line because I have it in the instructions in my cheat sheet I will share it with you later that is a simple URL to reach that cheat sheet here it is we have our Docker hard drive configured and the next step is to execute the alien that will interact with the system to create our runner again I not I am not going to spend too much time here it is basically an image that will execute the infrastructure to communicate with the coordination system of gitlab CI CD it has been download and it will be installed soon let me let me save you a few seconds of your life oh no it's already here it's super cool so the next thing that we need to do is to configure this Runner to be able to interact with our project to do that I'm going to clear the screen again and we will execute another command taking advantage of Docker again the instructions will be available in the in the cheat sheet and here what you are doing is executing the register command now you need to provide two things first the name of the gitlab instance that we will use to coordinate the jobs the pipelines and that is going to be https Dash Dash gitlab.com and then the registration token that if everything is as expected it will be you took note of it before so that was our previous register registration token and okay we need a name for this Runner this is going to be a play with Docker Docker in Docker Runner and what kind of gitlab Runner is this in this case we are going to configure the runner to be a Docker Runner it's not because we are using it through Docker but because we want to execute our pipelines inside containers so we type docker and finally which is the default image to be able to execute the workloads and this is super important yes docket colon dog head in Docker so Docker d-i-n-d as the image that we will use this way this container will be able to run other containers too okay looks like it is at least properly configured let's check it I'm going to clear the screen again I'm going to use dockerps just to to see what are the containers containers in place the container is has an ID starting with the number 71 so Docker please please show the locks of the container starting with 71 and follow the output of the Lux configuration loaded builds zeros so it seems that we have configured it so uh now we can just check it back in our Docker in our gitlab page so we go back to the other tab with the configuration of our gitlab page and let's see oh here it is you have created a new Runner awesome we can go to the runners page and now we should see our runner here ah it is working and available for our project so forget about this other one it is just another runner for another another laboratory and now let's create our first pipeline super simple pipeline but enough to check if everything is in place so let's go back to the project overview and let's add a new file the name of the file should be the the name that we use for all our pipeline so let's start with Dot gitlab ciucd and the content of the pipeline I cannot think of a pipeline that is simpler than this one test script Echo hello okay I'm going to just Commit This pipeline and this should trigger the execution of everything we still have here our message warning as that maybe it is not going to work but let's see if it is happening something in our runner instance so I go back to oh I go back to our dock here play without care instance and as you can see looks like that different things are happening here so our runner reset the instructions to execute the pipeline and if we go back to our to our system and we see for example our project overview we see how the pipeline was executed with us success let's try it let's try to to get the details of the execution of the pipeline so we go to build we go to Pipelines and our pipeline was executed with a past and here we are our test step was correctly run oh this is so cool so we can now just turn off this warning okay if you want to to take a look at the instructions in a in a text format feel free to open this address foreign ER and you should see the instructions as a GitHub guest okay if you have any question question Do you know how to contact me don't hesitate to do it and thank you so much for your attention
Info
Channel: Javier Moreno
Views: 1,419
Rating: undefined out of 5
Keywords:
Id: Y0qT6MCnRG0
Channel Id: undefined
Length: 14min 17sec (857 seconds)
Published: Sun Jun 25 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.