WIP: Expose merge ref and proper repo_url to runner
What does this MR do?
This is a rails counter-part for gitlab-runner#3983 (closed). It exposes refspecs for merge requests via refspec
attribute. The composed specs will look like this
- +refs/merge-requests/1/head:refs/merge-requests/1/head
- +refs/merge-requests/1/merge:refs/merge-requests/1/merge
Runner side will fetch source with the given refspecs and checkout the relevant code with the given SHA.
NOTE: This implementation requires the new version of GitLab-Runner. Therefore, we show errors on job details page in case users use an old runner.
POST jobs/request
Sample response on When the job is associated with a merge request. ".../head" or "../merge" will be passed
{
"id":6591,
"token":"qjEvjQVZzJtsyY_2xgqx",
"allow_git_fetch":true,
"job_info":{
"name":"build",
"stage":"test",
"project_id":89,
"project_name":"prospective-merge-pipelines"
},
"git_info":{
"repo_url":"http://gitlab-ci-token:qjEvjQVZzJtsyY_2xgqx@localhost:8181/root/prospective-merge-pipelines.git",
"sha":"5b9b19cd1b6ee9fdce2f7ddb852f7878b8ce6d4a",
"before_sha":"0000000000000000000000000000000000000000",
"ref":"patch-1",
"ref_type":"merge_request",
"refspecs":[
"+refs/merge-requests/5/head:refs/merge-requests/5/head"
],
"depth":3
},
"runner_info":{
"timeout":null,
"runner_session_url":null
},
...
}
What are the relevant issue numbers?
Related: https://gitlab.com/gitlab-org/gitlab-ee/issues/7380
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process. -
Security reports checked/validated by reviewer
Edited by Shinya Maeda