Setting Gitlab-runner build path in Linux machine

146 Views Asked by At

I have a Linux(RHEL) runner and creating a CI/CD pipeline to build the project using .yml file from GitLab.

When I try to run the pipeline using .yml from GitLab, it automatically creates a folder as depicted below.

enter image description here

I want to change this initialized Git repository into my "/home" folder. Have created a Git directory under home folder "/home/new_build" using command.

Tried setting the "GIT_DIR" path on the RHEL server, but no changes observed to the Git Initialization directory from .yml file.

Any other steps I could infuse to change the Git Initialization directory, which can be picked by .yml file from GitLab.

1

There are 1 best solutions below

0
On BEST ANSWER

Add this field in the etc/gitlab-runner/config.toml on your linux machine:

**builds_dir = "<target-dir>"**

In the linux machine:

-gitlab-runner uninstall
-gitlab-runner install --user=gitlab-runner --working-directory=<target-dir>
-create the <target-dir>
-chmod 777 <target-dir>
-chown gitlab-runner <target-dir>
-gitlab-runner restart

**target-dir is the new repository path, where the git-clone and git-build will take place.