I have a server pointed as ab12.xy24.com in which the projects are placed as:


I am using gitlab-runner for CI and CD. The build is being built as:


I want the build path to be as in Path-1 style instead of path-2 style.

What have I tried?

I tried changing the build_path="path1" variable which only changed:

/home/ab12/build/{runner-token}/{commit-id}/{group name}/project1/{project-files}



I cannot also use docker as due to its virtualization concept and takes much space, which is not desired.

  • As far as I know you can't (to avoid race conditions between 2 builds). But if you're sure of uniqueness of builds, a symlink from path1 to path2 in the before section should do no?
    – Tensibai
    May 6, 2017 at 16:40

1 Answer 1


Conceptually, this approach is not the way to go; the build directory is not a deployment directory, it's a temporary directory, to build or to deploy from, whereas on a shell executor this could be fixed.

So what you need is to deploy from that directory with a script as per gitlab-ci.yml below, to the correct directory of deployment.

- deploy

  TARGET_DIR: /home/ab12/public_html/$CI_PROJECT_NAME

  stage: deploy
     mkdir -pv $TARGET_DIR
     rsync -r --delete ./ $TARGET_DIR
    - myrunner

This will move your projectfiles in /home/ab12/public_html/

naming your projects as project1 .. projectn, all your projects could use this same .gitlab-ci.yml file.

  • can you please explain its working for files handled with .gitignore... How would '''rsync help this''' Nov 24, 2017 at 5:53
  • @Wildfire not sure if I understand the question. .gitignore is used for your local tree, meaning items in .gitignore are not committed ( git commit ), thus also not pushed to the git repository and thus also not present in the CI_PROJECT_DIR. Nov 25, 2017 at 4:54
  • I am quite sure you know my question. my last comment has just my illusion... thanks Nov 27, 2017 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.