首页 > 解决方案 > Gitlab API未在提交的构建状态中显示所有属性

问题描述

我正在使用curlgitlab 文档中给出的简单命令,将构建状态发布到提交

但在 gitlab build status 它只显示:

“abc 的管道 #20 失败.....”

即使我传递“描述”、“target_url”属性。

我努力了,

curl --request POST --header "PRIVATE-TOKEN: 9ko..." " https://gitlab.example.com/api/v4/projects/17/statuses/18f3...?state=failed&description=my_decsription&target_url= http://example.org/link "

curl终端的输出中,它成功地传递了所有属性。但在 gitlab build status 它只显示,

“abc 的管道 #20 失败.....”。

我希望输出像,

“ abc 的管道 #20 失败..... my_description http://example.org/link ”。

任何其他支持“description”和“target_url”属性的格式。

我在互联网上搜索但没有成功。我正在使用 gitlab 8.16。
我需要在 gitlab 中添加/配置什么吗?

更新: 实际上,我指定的“target_url”显示为构建选项卡的特定内部版本号的超链接。但没有出现在我想要的地方。
“描述”没有出现在任何地方。

标签: apicurlgitlabgitlab-cigitlab-api

解决方案


当您单击构建状态标签时,参数似乎target_url只会影响您发送到的链接(见下图)。要显示它,您还需要手动将其添加到description

curl --request POST --header "PRIVATE-TOKEN: XXXXXX" "https://gitlab.com/api/v4/projects/XXXXXX/statuses/67814f7489214e91738680b433679224993dc1c4?state=failed&name=some_label&description=some%20useful%20description_of_failure%20http://www.google.com&target_url=http://www.google.com"

如果您想查看描述,您必须进入提交详细信息并将鼠标悬停在构建状态标签上:

在此处输入图像描述


推荐阅读