Creating pipline :
Step 1: -> go to gitlab and create one empty repo
Step 2: - > go to repo and create new file name -> “.gitlab-ci.yml”
Step3: -> inside this file you can write script for n number of jobs
:::: so what is job ?
➔ It is basically most fundamental element of .gitlab-ci.yml
Basically it is a title for some set of script
Example ->
Job1:/build -------------------------------------------→ 3 type-> 1. Create,2) test , 3) deploy
Script :
-echo “ hii this is job 1 “
- echo “ this is a simle job”
Job2:/deploy
Script :
-echo “ hii this is job 2 “
- echo “ this is a simle job 2”
Step 4 : Now you have to commit the change :
So here you can see practical ->
Step 1:
Step 2:
Now commit and see what is happening
Here you can see the status of your pipline : it is in running status
Now you want to see the details then click on it and You can see it
1. -> It is running on a git lab runner
:: so runner is a machine which execute the script that you define in your job.
2 . Now you can see a build has been created using docker image which is of Ruby image
:: so the image is use to execute the particular image is Ruby image
3 -> Next it is creating preparing an environment for our job
4 . it is getting the source from repository executing the script
5 . This is the last msg Hello from vani
Gitlab runner:- >
Step 1:
:::: go to the setting you need to go to settings in cicd click on Runners and
you need to click on these three
So we will use Amazon Ec2 to setup our Runner
Click here
Gitlab runner Types
1. Shared
. Available to all project in a GitLab instance
2. Group
Available to all project in a group
3. Project
For a single project or a set of project with specific requirements
There is a command to install and run the gitlab runner In your machine
Then follow these steps :- login to the aws account
Step 2:
Now before going to install gitlab runner we should chack our architecture
Step :
Now we will update all the packages
::::: sudo apt update -y
Then write command ::::::::::::
nano script-runner.sh
then nano terminal will be open you have to copy all the command and then
past it
after :::: press ctrl + s
::::: ctrl + x
Then write the command
If it done once then go to the next step ::->
sudo gitlab-runner register --url https://gitlab.com/ --registration-token GR1348941rtXpaZP-FmAcJ6FVdV83
Then it will ask the instance url ::: if it is same then press enter
Tags are something which are required for a job to choose which Runners to run
the job on
I am writing 2 tags
1) Server
2) Ec2
Then press enter and you will got messages Runner …. Succeeded
Now we have to chose one thing to run the runner
Now it will show the msg
Now its time to check my runner status
/\
Write command sudo gitlab-runner status
Now come back to gitlab runner section and refresh it you will be find the
current running runner
Now We will see another example::: ---::::
Again: -> 1) create a new repo
2. Go to the Repo and create a file for python
3. Then create again new file .yml for corresponding python file
Let’s see
When u create your all file
Now install flask
Now we will create docker file