0

我使用python-gitlab模块通过其 API 检索 Gitlab 中多个项目的项目统计信息。我想要获得的值之一是 CI 状态和代码覆盖率。虽然状态很简单:

from gitlab import Gitlab
gl = Gitlab('http://gitlab.example.com')
project = gl.projects.get('olebole/myproject')
branch = project.branches.get(project.default_branch)
commit = project.commits.get((branch.commit['id'])
print(commit.last_pipeline['status'])

我没有找到检索覆盖范围的方法;也添加with_stats=True到提交检索没有成功。

如何获得这个值?

4

1 回答 1

0

这是在pipeline对象中:

pipeline = project.pipelines.get(commit.last_pipeline['id'])
print(pipeline.status, pipeline.coverage)
于 2021-06-07T08:48:27.940 回答