Skip to content

Make CI_PROJECT_PATH absolute path and allow to use it directly in scripts

What does this MR do?

This MR makes CI_PROJECT_DIR to be an absolute path (as the documentation states) when Parallels Executor is used. Changes in this MR are partially inspired by: 0e50a433.

Why was this MR needed?

As per documentation CI_PROJECT_DIR is "The full path the repository is cloned to, and where the job runs from". In fact, when default configuration is used with Parallels Executor, CI_PROJECT_DIR neither an absolute path nor a relative one, but something else instead, for instance:

builds/kutelev/parallels-executor

As result of it, even cd does not work with CI_PROJECT_DIR: https://gitlab.com/kutelev/parallels-executor/-/jobs/2004563838

$ cd "${CI_PROJECT_DIR}"
bash: line 128: cd: builds/kutelev/parallels-executor: No such file or directory

This issue can be reproduced with both VirtualBox and Parallels Executors, this MR addresses only Parallels. In order to reproduce this issue a very simple .gitlab-ci.yml file is required:

macos:
  stage: build   
  script:
    - pwd
    - echo "${CI_PROJECT_DIR}"
    - cd "${CI_PROJECT_DIR}"
  tags:
    - parallels

cd command will fail.

Due to this issue it is not possible to use CI_PROJECT_DIR variable directly in build scripts when Parallels Executor is used.

What's the best way to test this MR?

-

What are the relevant issue numbers?

-

Edited by Alexander Kutelev

Merge request reports