Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab-runner change builds_dir

My default builds_dir on the production server is /root/builds/qL8eZYTH/0/faramarzqoshchi/testing_gitlab_runner/ which i want it to be /home/[domain_name]/public_html/test_build which is for my test stage.
i've defined the builds_dir variable in /etc/gitlab-runner/config.toml with /home/[domain_name]/public_html/test_build value, but it still doesn't push the testing_gitlab_runner project to /home/[domain_name]/public_html/test_build.

am i doing everything correctly? is this the right way to push different stages like test and production to server?

OS: Centos

like image 428
Faramarz Avatar asked Oct 28 '25 04:10

Faramarz


1 Answers

According to the docs, you'll have to also enable the custom_build_dir setting, which is by default only enabled for docker and kubernetes executors:

[runners.custom_build_dir]
  enabled = true

See here for more info regarding this setting.

Also you should try to set the variable $GIT_CLONE_PATH:

variables:
  GIT_CLONE_PATH: $CI_BUILDS_DIR/project-name

test:
  script:
    - pwd

The GIT_CLONE_PATH has to always be within $CI_BUILDS_DIR. The directory set in $CI_BUILDS_DIR is dependent on executor and configuration of runners.builds_dir setting.

This can only be used when custom_build_dir is enabled in the runner’s configuration. This is the default configuration for the docker and kubernetes executors.

Source


So in your specific case I would try this in your config.toml:

builds_dir = "/home/[domain_name]/public_html/test_build"

[runners.custom_build_dir]
  enabled = true

And add this to the top of your .gitlab-ci.yml:

variables:
  GIT_CLONE_PATH: $CI_BUILDS_DIR/testing_gitlab_runner
like image 128
ph_0 Avatar answered Oct 30 '25 19:10

ph_0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!