I have two projects in Gitlab where one is a submodule (let's call repo "frontend-templates") of the other (let's call this repo "main"). I have set up a Gitlab CI build for the "frontend-templates" repo. The thing is that I don't need testing or building. I only need deploying for this CI in the needed directory. So, I registered a runner for "frontend-templates" project and added .gitlab-ci.yml to the root directory:
job_main:
type: deploy
script: echo "Do nothing"
When I push to my repository, the runner fetches the latest commit to the following directory:
/home/gitlab-runner/builds/6231b425/0/Gasimzada/frontend-templates
and just runs echo "Do nothing"
.
Now, I want the runner to deploy the "tested" 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 saying:
cannot open /var/www/myapp/.git/modules/submodules/frontend-templates/FETCH_HEAD: Permission denied
This makes sense because gitlab-runner user does not have access to any directory in /var/www/myapp but it a problem for me because I want to run gulp
after deploy, so it compiles necessary scripts after it pulls from the remote repository.
Should I give permission to the root directory of dev environment? Or is there another way to do this?