使用python-gitlab检索项目覆盖率



我使用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也没有成功

如何获得这个值?

这在pipeline对象中:

pipeline = project.pipelines.get(commit.last_pipeline['id'])
print(pipeline.status, pipeline.coverage)

最新更新