S
S
Sazoks2021-08-19 17:00:59
Continuous Integration
Sazoks, 2021-08-19 17:00:59

How does GitLab Runner work?

Good afternoon. I am a first year student. I have a project in python (Flask).
I have set up CI and am currently trying to set up CD. I picked up ubuntu on a virtual machine, installed docker (until I deployed the project in it). For the sake of testing, I decided to just run the project on ubuntu. Cloned the project from the repository, created a virtual environment, downloaded all dependencies, launched the project. Works.
The problem is that I don't seem to understand how gitlab's runner works. Because all the commands that I wrote manually and that led me to success do not work if they are written in a .yml file!
I thought that the runner, which is also installed on the server (on a virtual machine), simply runs commands on the current system from a .yml file. But this is apparently not the case.
I just can't get the CD to work and I'm really asking for your help as I've been trying to figure this all out for two weeks now...
Many thanks in advance to everyone!

PS I apologize for such verbosity, it's just that my head doesn't cook at all anymore. If it's not difficult, poke your nose at how it generally works and how in my case to implement continuous deployment.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sazoks, 2021-08-20
@Sazoks

Generally. I figured everything out and everything worked.
1) Yes, as I said, the runner executes commands on the installed machine. But! In my case, that was what was required, and in order to get it, it was necessary to specify the shell executor. Those. if you specify docker, then, judging by the logs, the docker container will be launched and the commands will be executed in it.
2) I noticed a very strange behavior that sometimes my runner was launched with my executor, and sometimes some other runner with the docker+machine executor. Disabling default runners helped (there are 15 of them).
3) My server is running on ubuntu as a normal user. And the execution of some commands required the use of sudo, and when using sudo, it asks for a password. It is possible to disable the password prompt for the gitlab-runner user by editing sudo via sudo visudo. At the very end of this command, you need to write % username% ALL=(ALL: ALL) NOPASSWD: ALL, where % username%, in my case, is gitlab-runner.
All these actions led me to the fact that now the commands written in .gitlab-ci.yml are executed on my ubuntu server, where the docker is deployed (I will deal with it further) and my service will be raised.
I hope it will be useful to someone.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question