GitLab API:按名称从管道中筛选作业



我在GitLab API上有一个URL,它有下一个结构:gitlab.com/api/v4/projects/:proj_id/pipelines/:pipeline_id/jobs

现在我只想得到一份下一个名字的工作:";rpm:构建";。

gitlab.com/.../jobs/?name="rpm:build"这样的请求会将整批作业返回给我。

那么我该怎么做才能只得到一份工作呢?

您能通过管道连接到JQ吗?如食谱中所述:

https://github.com/stedolan/jq/wiki/Cookbook#filter-基于密钥内容的对象

像这样的东西:

curl -L gitlab.com/api/v4/projects/:proj_id/pipelines/:pipeline_id/jobs 
| jq -c '.[] | select(.name | contains("rpm:build"))'

最新更新