gitlab-api - gitlab rest-api 如何将作业/管道链接到项目时间表
问题描述
大多数项目都有许多管道计划,我可以将作业链接到管道和项目,但不能链接到启动作业的管道计划。我正在尝试创建一个简单的状态墙,其中包含红色/绿色的作业,如果您按下它,您将重新运行计划。深受启发:https ://github.com/jan-molak/jenkins-build-monitor-plugin 。
以下是项目的管道时间表:
{
"project_id": "1518",
"schedules": [
{
"id": 411,
"description": "qa-04 provision users for demo",
"ref": "test1-20210318",
"cron": "6 18 * * *",
"cron_timezone": "Europe/Copenhagen",
"next_run_at": "2021-06-22T16:10:00.000Z",
"active": true,
"created_at": "2020-10-28T08:06:49.012Z",
"updated_at": "2021-06-21T16:10:10.107Z",
"owner": {..}
},
{
"id": 410,
"description": "test12 Demo fido2 solution fullstack test",
"ref": "master",
"cron": "40 06 * * *",
"cron_timezone": "Europe/Copenhagen",
"next_run_at": "2021-06-23T04:45:00.000Z",
"active": true,
"created_at": "2020-10-27T14:32:07.156Z",
"updated_at": "2021-06-22T04:45:29.164Z",
"owner": {..}
},
{
"id": 409,
"description": "test1 Demo fido2 solution fullstack test",
"ref": "master",
"cron": "05 04 * * *",
"cron_timezone": "Europe/Copenhagen",
"next_run_at": "2021-06-23T02:10:00.000Z",
"active": true,
"created_at": "2020-10-27T13:36:09.062Z",
"updated_at": "2021-06-22T02:10:34.070Z",
"owner": {..}
}
]
}
这是一个由管道执行的作业,但不是由哪个 schedule_id 执行的:
"project_id": "1518",
"jobs": [
{
"id": 3549568,
"status": "failed",
"stage": "test",
"name": "test12",
"ref": "master",
"tag": false,
"coverage": null,
"allow_failure": false,
"created_at": "2021-06-22T04:45:31.465Z",
"started_at": "2021-06-22T04:45:33.354Z",
"finished_at": "2021-06-22T05:00:03.734Z",
"duration": 870.37944,
"queued_duration": 1.029369,
"user": {..},
"commit": {..},
"pipeline": {
"id": 489545,
"project_id": 1518,
"sha": "673073d3987fea3bb30a9433e15612712795c2cb",
"ref": "master",
"status": "failed",
"created_at": "2021-06-22T04:45:31.360Z",
"updated_at": "2021-06-22T05:00:03.874Z",
"web_url": "<url>/demo/demo-fullstack-test/-/pipelines/489545"
},
"web_url": "..",
"artifacts_file": {..},
"artifacts": [..],
"runner": {..},
"artifacts_expire_at": "2021-06-29T05:00:02.126Z",
"tag_list": [ ]
},
我可以尝试将调度程序描述与作业中的名称进行匹配,或者尝试使用可以匹配 crontab 的内容来检查作业 started_at。是否有任何其他 gitlab api 可以显示我可能监督过的这个映射。
解决方案
推荐阅读
- java - Jackson/Gson 将 JavaFX 属性序列化和反序列化为 json
- windows - 如何启用虚拟化?
- vb.net - DataGridView 不透明度
- python - 控制互动。netcat 与 Python 的连接(子进程或类似的)
- docker - 如何在 MacOS 上的 docker swarm 中正确运行 nginx?
- php - 将复杂数组从 dql 查询转换为仅返回选定条目的简单数组
- react-native - 获取错误:包 react-native-gesture-handler 已被忽略,因为它包含无效的配置
- c# - Plivo - 有没有办法在语音通话中的循环之间设置延迟?
- python - 你能在 Lambda Python 3.6 中有一个异步处理程序吗?
- python - 如何使用 pcolor 将向量设置为 y 轴