Gitlab-CI: GIT_CLONE_PATH does not work with child-pipelines

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When using the variable GIT_CLONE_PATH variable within the parent of a Gitlab-Parent-Child-Pipeline, the child pipeline will fail with an error similar to:

 ERROR: Job failed: the GIT_CLONE_PATH="/3131/pipeline-tests" has to be within "/builds"

Steps to reproduce

  1. Create a parent pipeline with the variable GIT_CLONE_PATHset:
variables:
  GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_PIPELINE_ID/pipeline-tests

parent-step:
  stage: test
  script:
    - echo "A parent step"

child-pipeline:
  stage: deploy
  trigger:
    include: .child-pipeline.yml
    strategy: depend
  1. Define the child pipeline:
variables:
  GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_PIPELINE_ID/pipeline-tests

child-step:
  stage: deploy
  script:
    - echo "This does not work, checkout fails..."

This fails with:

 ERROR: Job failed: the GIT_CLONE_PATH="/3131/pipeline-tests" has to be within "/builds"

Example Project

What is the current bug behavior?

The GIT_CLONE_PATH Variable within the child pipeline is completely ignored. No matter if you set it to something different or completely leave it out.

For whatever reason, it always trys to check out to the absolut path of /$CI_PIPELINE_ID/$CI_PROJECT_NAME.

What is the expected correct behavior?

When set, the GIT_CLONE_PATH should be respected within a child pipeline. If not set, it should at least check out to $CI_BUILDS_DIR/$CI_PROJECT_NAME which (i think) is the default path if no GIT_CLONE_PATH is set.

Relevant logs and/or screenshots

see example project above

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by 🤖 GitLab Bot 🤖