Add scheduled flag to job entity
What does this MR do?
As @ayufan pointed out at https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22382#note_113216417
Should this be explicit logic, send as part of detailed status?
BE should return the boolean value if it's scheduled or not. Ideally, the computation should NOT be done in FE.
This MR adds "scheduled": true
to JobEntity
and BuildActionEntity
. FYI, DetailedStatuasEntity
is not used for action buttons.
Sample payload
Partial payload
"playable": true,
"scheduled": true,
"scheduled_at": "2018-10-31T00:10:02.106Z",
Full payload
{
"id": 45,
"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:3000/root",
"status_tooltip_html": null,
"path": "/root"
},
"active": false,
"coverage": null,
"source": "push",
"created_at": "2018-10-31T00:05:01.852Z",
"updated_at": "2018-10-31T00:05:02.231Z",
"path": "/root/scheduled-flag/pipelines/45",
"flags": {
"latest": true,
"stuck": false,
"auto_devops": false,
"yaml_errors": false,
"retryable": false,
"cancelable": true,
"failure_reason": false
},
"details": {
"status": {
"icon": "status_scheduled",
"text": "delayed",
"label": "waiting for delayed job",
"group": "scheduled",
"tooltip": "delayed",
"has_details": true,
"details_path": "/root/scheduled-flag/pipelines/45",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_scheduled-2349748ddbcc7b5e7bd112ed374ffa754a2d3f9c937fa1c709890734475b2f8f.png"
},
"duration": null,
"finished_at": null,
"stages": [
{
"name": "test",
"title": "test: delayed",
"groups": [
{
"name": "job",
"size": 1,
"status": {
"icon": "status_scheduled",
"text": "delayed",
"label": "unschedule action",
"group": "scheduled",
"tooltip": "delayed manual action (00:04:24)",
"has_details": true,
"details_path": "/root/scheduled-flag/-/jobs/907",
"illustration": {
"image": "/assets/illustrations/illustrations_scheduled-job_countdown-a81d771aaf0c8beb9005b6e421d2f27fa0d1dfc69ed700a6375d7c3efb8fbacd.svg",
"size": "svg-394",
"title": "This is a delayed to run in 00:04:24",
"content": "This job will automatically run after it's timer finishes. Often they are used for incremental roll-out deploys to production environments. When unscheduled it converts into a manual action."
},
"favicon": "/assets/ci_favicons/favicon_status_scheduled-2349748ddbcc7b5e7bd112ed374ffa754a2d3f9c937fa1c709890734475b2f8f.png",
"action": {
"icon": "time-out",
"title": "Unschedule",
"path": "/root/scheduled-flag/-/jobs/907/unschedule",
"method": "post",
"button_title": "Unschedule job"
}
},
"jobs": [
{
"id": 907,
"name": "job",
"started": null,
"build_path": "/root/scheduled-flag/-/jobs/907",
"play_path": "/root/scheduled-flag/-/jobs/907/play",
"unschedule_path": "/root/scheduled-flag/-/jobs/907/unschedule",
"playable": true,
"scheduled": true,
"scheduled_at": "2018-10-31T00:10:02.106Z",
"created_at": "2018-10-31T00:05:01.861Z",
"updated_at": "2018-10-31T00:05:02.126Z",
"status": {
"icon": "status_scheduled",
"text": "delayed",
"label": "unschedule action",
"group": "scheduled",
"tooltip": "delayed manual action (00:04:24)",
"has_details": true,
"details_path": "/root/scheduled-flag/-/jobs/907",
"illustration": {
"image": "/assets/illustrations/illustrations_scheduled-job_countdown-a81d771aaf0c8beb9005b6e421d2f27fa0d1dfc69ed700a6375d7c3efb8fbacd.svg",
"size": "svg-394",
"title": "This is a delayed to run in 00:04:24",
"content": "This job will automatically run after it's timer finishes. Often they are used for incremental roll-out deploys to production environments. When unscheduled it converts into a manual action."
},
"favicon": "/assets/ci_favicons/favicon_status_scheduled-2349748ddbcc7b5e7bd112ed374ffa754a2d3f9c937fa1c709890734475b2f8f.png",
"action": {
"icon": "time-out",
"title": "Unschedule",
"path": "/root/scheduled-flag/-/jobs/907/unschedule",
"method": "post",
"button_title": "Unschedule job"
}
}
}
]
}
],
"status": {
"icon": "status_scheduled",
"text": "delayed",
"label": "delayed",
"group": "scheduled",
"tooltip": "delayed",
"has_details": true,
"details_path": "/root/scheduled-flag/pipelines/45#test",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_scheduled-2349748ddbcc7b5e7bd112ed374ffa754a2d3f9c937fa1c709890734475b2f8f.png"
},
"path": "/root/scheduled-flag/pipelines/45#test",
"dropdown_path": "/root/scheduled-flag/pipelines/45/stage.json?stage=test"
}
],
"artifacts": [],
"manual_actions": [],
"scheduled_actions": [
{
"name": "job",
"path": "/root/scheduled-flag/-/jobs/907/play",
"playable": true,
"scheduled": true,
"scheduled_at": "2018-10-31T00:10:02.106Z",
"unschedule_path": "/root/scheduled-flag/-/jobs/907/unschedule"
}
]
},
"ref": {
"name": "master",
"path": "/root/scheduled-flag/commits/master",
"tag": false,
"branch": true
},
"commit": {
"id": "f732239cdfb3a231ef580561e3f3ba2165dbabbb",
"short_id": "f732239c",
"title": "Add .gitlab-ci.yml",
"created_at": "2018-10-31T00:05:01.000Z",
"parent_ids": ["07ff9e4ce447385fa3ca4e379935e578afc9d788"],
"message": "Add .gitlab-ci.yml",
"author_name": "Administrator",
"author_email": "admin@example.com",
"authored_date": "2018-10-31T00:05:01.000Z",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2018-10-31T00:05:01.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:3000/root",
"status_tooltip_html": null,
"path": "/root"
},
"author_gravatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"commit_url": "http://localhost:3000/root/scheduled-flag/commit/f732239cdfb3a231ef580561e3f3ba2165dbabbb",
"commit_path": "/root/scheduled-flag/commit/f732239cdfb3a231ef580561e3f3ba2165dbabbb"
},
"cancel_path": "/root/scheduled-flag/pipelines/45/cancel"
}
What are the relevant issue numbers?
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary - [-] Documentation created/updated
-
Tests added for this feature/bug -
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.
Edited by Shinya Maeda