The GitLab docs on build env settings give the example that CI_BUILD_REPO has the Git repo CI is building from. From http://doc.gitlab.com/ci/variables/README.html:
Example values:
export CI_BUILD_BEFORE_SHA="9df57456fa9de2a6d335ca5edf9750ed812b9df0"
export CI_BUILD_REPO="https://gitlab.com/gitlab-org/gitlab-ce.git"
But this may be a case where the docs are trailing the code. As in fact it gives the URL CI uses to fetch the code with tokens. Example:
export CI_BUILD_REPO=“GitLab.org / GitLab FOSS · GitLab”
Here are a couple of Bash commands that can be used to get the actual URI:
# remove beginning upto @
BUILD_REPO=${CI_BUILD_REPO/#http:*@}
# remove path to actual project at end
BUILD_REPO=${BUILD_REPO/%\/*}
echo repo = $BUILD_REPO
repo = GitLab.org / GitLab FOSS · GitLab
Now one has the URL that can be used to pull other Git projects into the build and it is not hard coded in the .gitlab-ci.yml file so one’s build code will work in both the production build env and the CI development env.