Shell Gitlab Runner with Terraform - Relative Path

I am been trying to copy a Linux script using terraform file provisioner with shell gitlab runner but always failed due to path issues:

provisioner “file” {
source = “script.sh”
destination = “/home/user”
}

I put the file script.sh in gitlab root repository, I already tried .script.sh, ./script.sh. (no such file or directory)

Someone can help me out, just I need to know the right gitlab runner path.

Thanks!

Hi @jcperezamin

The registered gitlab runner configuration is present in “/etc/gitlab-runner/config.toml” file. In this configuration you need to set the URL for your GitLab against clone_url parameter.

For example: If your GitLab is running at http://test.gitlab.com/ then you should set clone_url=http://test.gitlab.com/

[[runners]]
  name = "gitlab"
  url = "http://test.gitlab.com/"
  token = "51457ce97e0a59bb2d2bd429752bf6"
  executor = "shell"
  clone_url = "http://test.gitlab.com/"

Thanks,
Kiran

For some reason when gitlab runner execute, the gitlab runner root directory is /builds and I found to change to my project root directory using $CI_PROJECT_DIR in gitlab-ci.yml.

Thanks! anyway!

1 Like