Skip to content

Expose refspec and depth to runner

Shinya Maeda requested to merge expose-merge-ref-to-runner into master

What does this MR do?

This MR exposes refspecs and depth (for git-fetch) to runners according to this specification.

GitLab-Runner uses the exposed spec and depth in order to checkout source code.

We're going to use merge request's refs (e.g. refs/merge-requests/:iid/head) in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25504.

Sample response on POST jobs/request

When the job is not associated with a merge request

{
   "id":6594,
   "token":"FNWRozxyDZ4Q1HHWyW-1",
   "allow_git_fetch":true,
   "job_info":{
      "name":"deploy",
      "stage":"test",
      "project_id":89,
      "project_name":"prospective-merge-pipelines"
   },
   "git_info":{
      "repo_url":"http://gitlab-ci-token:FNWRozxyDZ4Q1HHWyW-1@localhost:8181/root/prospective-merge-pipelines.git",
      "sha":"abb6076c965eec51b92667388be8e7ef559f9ca3",
      "before_sha":"0000000000000000000000000000000000000000",
      "ref":"patch-7",
      "ref_type":"branch",
      "refspecs":[
         "+refs/heads/*:refs/remotes/origin/*",
         "+refs/tags/*:refs/tags/*"
      ],
      "depth":0
   },
   ...
}

What are the relevant issue numbers?

Related: https://gitlab.com/gitlab-org/gitlab-ee/issues/7380

Does this MR meet the acceptance criteria?

Edited by Kamil Trzciński (Back 2025-01-01)

Merge request reports

Loading