Expose merge request entity for pipelines
What does this MR do?
This MR exposed the following properties of a merge request for pipeline.
expose :merge_request do
expose :iid
expose :merge_request_path, as: :path
expose :title
expose :source_branch
expose :source_branch_path
expose :target_branch
expose :target_branch_path
end
expose :flags do
...
expose :detached?, as: :detached
end
These values are used for both attached and detached pipeline. The UX mock is displayed in https://gitlab.com/gitlab-org/gitlab-ee/issues/7380.
Backend just needs to expose there values in PipelineEntity
only. This is because all the related endpoints go through this entity class.
Sample JSON reponse
{
"id": 995,
"name": "job",
"started": "2019-02-28T07:01:08.840Z",
"archived": false,
"build_path": "/root/detached-merge-request-pipelines/-/jobs/995",
"retry_path": "/root/detached-merge-request-pipelines/-/jobs/995/retry",
"playable": false,
"scheduled": false,
"created_at": "2019-02-28T07:01:07.621Z",
"updated_at": "2019-02-28T07:01:09.709Z",
"status": {
"icon": "status_success",
"text": "passed",
"label": "passed",
"group": "success",
"tooltip": "passed",
"has_details": true,
"details_path": "/root/detached-merge-request-pipelines/-/jobs/995",
"illustration": {
"image": "/assets/illustrations/skipped-job_empty-8b877955fbf175e42ae65b6cb95346e15282c6fc5b682756c329af3a0055225e.svg",
"size": "svg-430",
"title": "This job does not have a trace."
},
"favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png",
"action": {
"icon": "retry",
"title": "Retry",
"path": "/root/detached-merge-request-pipelines/-/jobs/995/retry",
"method": "post",
"button_title": "Retry this job"
}
},
"coverage": null,
"erased_at": null,
"duration": 0.861057,
"tags": [],
"has_trace": true,
"stage": "test",
"stuck": false,
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"web_url": "http://localhost:8181/root",
"status_tooltip_html": null,
"path": "/root"
},
"runner": {
"id": 1,
"description": "shinya-Galago-Pro",
"edit_path": "/root/detached-merge-request-pipelines/runners/1/edit"
},
"pipeline": {
"id": 49,
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"web_url": "http://localhost:8181/root",
"status_tooltip_html": null,
"path": "/root"
},
"active": false,
"coverage": null,
"source": "merge_request",
"created_at": "2019-02-28T05:34:36.364Z",
"updated_at": "2019-02-28T07:01:10.076Z",
"path": "/root/detached-merge-request-pipelines/pipelines/49",
"flags": {
"latest": true,
"stuck": false,
"auto_devops": false,
"merge_request": true,
"detached": true,
"yaml_errors": false,
"retryable": false,
"cancelable": false,
"failure_reason": false
},
"details": {
"status": {
"icon": "status_success",
"text": "passed",
"label": "passed",
"group": "success",
"tooltip": "passed",
"has_details": true,
"details_path": "/root/detached-merge-request-pipelines/pipelines/49",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png"
},
"duration": 0,
"finished_at": "2019-02-28T07:01:10.061Z"
},
"merge_request": {
"iid": 1,
"path": "/root/detached-merge-request-pipelines/merge_requests/1",
"title": "Update README.md",
"source_branch": "feature-1",
"source_branch_path": "/root/detached-merge-request-pipelines/branches/feature-1",
"target_branch": "master",
"target_branch_path": "/root/detached-merge-request-pipelines/branches/master"
},
"ref": {
"name": "refs/merge-requests/1/head",
"path": "/root/detached-merge-request-pipelines/commits/refs/merge-requests/1/head",
"tag": false,
"branch": false,
"merge_request": true
},
"commit": {
"id": "4315968cb4a3137eab5c517892d06ad379b6010b",
"short_id": "4315968c",
"created_at": "2019-02-28T05:34:30.000Z",
"parent_ids": [
"941c1a011d85ab52ee9c04bfc9d474f8c8d0e3fd"
],
"title": "Update README.md",
"message": "Update README.md",
"author_name": "Administrator",
"author_email": "admin@example.com",
"authored_date": "2019-02-28T05:34:30.000Z",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2019-02-28T05:34:30.000Z",
"author": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"web_url": "http://localhost:8181/root",
"status_tooltip_html": null,
"path": "/root"
},
"author_gravatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"commit_url": "http://localhost:8181/root/detached-merge-request-pipelines/commit/4315968cb4a3137eab5c517892d06ad379b6010b",
"commit_path": "/root/detached-merge-request-pipelines/commit/4315968cb4a3137eab5c517892d06ad379b6010b"
}
},
"metadata": {
"timeout_human_readable": "1h",
"timeout_source": "project"
},
"artifact": {},
"erase_path": "/root/detached-merge-request-pipelines/-/jobs/995/erase",
"raw_path": "/root/detached-merge-request-pipelines/-/jobs/995/raw",
"runners": {
"online": false,
"available": true,
"settings_path": "/root/detached-merge-request-pipelines/runners"
}
}
What are the relevant issue numbers?
Related gitlab-ee#7380 #58454 (moved)
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 Kamil Trzciński