1. There is a repository on the Hitlab ;
  2. There is a remote server.

How to deliver code from the repository to the server (after each commit)?

Can you please tell me what (what to use) for this?

    2 answers 2

    On the server, you need to install a runner and configure it in the gitlab. Then without problems, you can execute the ground-level file (analogue of the command line). Read the documentation for runners.

    • Yes, thank you, I did this thing. but when I make some changes in the repository, the job gets pending and only after I go to the server I write sudo gitlab-runner run only after this job in the gitlab works. can it be done like that so that it runner itself started after any changes in the repository? - moovs
    • Activate the shell make! Reconfigure again and when asked how to run - choose a shell - Andrey Ivasko

    So everything set up. And it turned out to be easier than I thought. For an elementary code delivery to the server in the form of git pull, after each commit or action with the repository you need:

    1. Download Gitlab-runner https://docs.gitlab.com/runner/install/ according to your system (macos, linux).
    2. register the Gitlab-runner on your machine https://docs.gitlab.com/runner/register/index.html .
    3. install and run Gitlab-runner as a service.
    4. add the .gitlab-ci.yml file in your repository
    5. In my case, I used such a set of instructions for the runner:

    stages: - deploy git-pull: stage: deploy script: - cd /your/gitlab/repsitory - git pull tags: - name of your runner

    • git pull not required. GitLab Runner automatically when starting job retrieves changes in the repository at the time of the commit. And the repository directory becomes working. - Pavel Parshin
    • Now we will test!) - moovs
    • if I only do cd / to / my / gitlab / directory / without git pull, then gitlab puts the repository in a separate daddy ~ / builds / runner-number / 0 / mygitlabname / nameofrepository. but if I want to do git pull in my separate folder, then I do - cd /your/gitlab/repsitory - git pull and then the code is delivered to that folder where I need - moovs
    • And, inattentively read the question. Then you do not quite use the necessary means. GitLab CI is deployed on a test server where it builds, compiles, and tests source code. Delivery of the code to the production depends on the technology stack: for example, we use Docker, GitLab Registry and remote connection to the server via Docker - Pavel Parshin
    • Thanks, helpful! and what means would you recommend to use for my purpose? Jenkins? - moovs