Allow Configuration of how cloning is performed by runner/pipeline
Description
When a pipeline job is run, the first process is to clone the target repo using an HTTP(S) process, which can fail for several reasons (e.g. target remote is missing port during clone):
Running with gitlab-runner 10.4.0 (857480b6)
on sonarQube (br5ac082)
Using Shell executor...
Running on someServer...
Cloning repository...
Cloning into '/home/gitlab-runner/builds/br5ac082/0/group/proj'...
fatal: repository 'http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@someServer/group/proj.git/' not found
ERROR: Job failed: exit status 1
Note: external_url
was in this case: http://someServer:8888
Proposal
Have the cloning process be configurable for:
-
protocol (
http
,https
,ssh
) -
authentication (
user auth token
,gitlab-ci-token
,ssh private key
) -
port (default to what's specified in
external_url
)
Links / references
Here is an example issue and workaround employed: https://stackoverflow.com/a/48478314/1080804
Here is a related on-going discussion: https://gitlab.com/gitlab-org/gitlab-ce/issues/22723