Gitlab CI how to deploy the latter to a specific directory

I have two projects in Gitlab where one is a submodule (let it call repo "frontend-templates") of the other (let this repo "main"). I created a Gitlab CI build for the repo with the template interface. The fact is that I do not need tests or construction. I only need to install this CI in the correct directory. So, I registered a runner for the "frontend-templates" project and added .gitlab-ci.yml to the root directory:

job_main:
   type: deploy
   script: echo "Do nothing"

When I click on my repository, the runner fetches the last commit into the following directory:

/home/gitlab-runner/builds/6231b425/0/Gasimzada/frontend-templates

and just runs through echo "Do nothing".

Now I want the runner to deploy the “verified” commit to the dev server, which is located in:

/var/www/myapp/submodules/frontend-templates

EDIT: I changed the script to

script: cd /var/www/myapp/submodules/frontend-templates && git pull

but I got an error message:

/var/www/myapp/.git/modules/submodules/frontend-templates/FETCH_HEAD: Permission denied

, gitlab-runner /var/www/myapp, , gulp , , .

dev? ?

+1
1

, , . / (rm -rf /var/www/myapp/submodules/frontend-templates && cp -r . /var/www/myapp/submodules/frontend-templates), rsync .

- , , , . , /var/www/myapp/submodules/frontend -templates , :

/var/www/myapp/submodules
  | - 7348110b
  | - a03ed59a
  | - frontend-templates -> ./a03ed59a

. :

job_main:
   type: deploy
   script:
     - cp -r . /var/www/myapp/submodules/$CI_BUILD_REF
     - ln -s ./$CI_BUILD_REF /var/www/myapp/submodules/templink
     - mv -Tf /var/www/myapp/submodules/templink /var/www/myapp/submodules/frontend-templates

. , .

+5

All Articles