Jenkins的GitHub Pull Request Coverage状态插件

时间:2017-11-07 09:53:13

标签: github jenkins jenkins-plugins code-coverage

我正在使用GitHub Pull Request Builder插件触发PR的构建,我目前设法发布测试结果,我也试图发布代码覆盖率。

我正在生成一个coverage.xml报告,大约66% - Lines,我已经将记录主覆盖率和发布覆盖率添加到GitHub的构建后操作,但我最终得到以下错误。它是否试图在github中访问该覆盖率报告?

我已阅读文档,但也许我遗漏了一些东西。有人可以帮我这个吗?

C:\Program Files (x86)\Jenkins\jobs\File Management - PR\workspace>exit 0 
[Cobertura] Publishing Cobertura coverage report...
Publishing Cobertura coverage results...
Cobertura coverage report found.
Recording NUnit tests results
Master coverage 0%
[GitHub PR Status] start
[GitHub PR Status] getting master coverage...
use default coverage repo
ERROR: Step ‘Publish coverage to GitHub’ aborted due to exception: 
java.io.FileNotFoundException: https://api.github.com/repos/xxxxx/file-management
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    at org.kohsuke.github.Requester.parse(Requester.java:602)
Caused: java.io.FileNotFoundException: https://api.github.com/repos/xxxxx/file-management
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at org.kohsuke.github.Requester.parse(Requester.java:612)
    at org.kohsuke.github.Requester.parse(Requester.java:594)
    at org.kohsuke.github.Requester._to(Requester.java:272)
Caused: org.kohsuke.github.GHFileNotFoundException: {"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/#get"}
    at org.kohsuke.github.Requester.handleApiError(Requester.java:686)
    at org.kohsuke.github.Requester._to(Requester.java:293)
    at org.kohsuke.github.Requester.to(Requester.java:234)
    at org.kohsuke.github.GitHub.getRepository(GitHub.java:443)
    at com.github.terma.jenkins.githubprcoveragestatus.GitHubPullRequestRepository.getGitHubRepository(GitHubPullRequestRepository.java:57)
Caused: java.io.IOException: Could not retrieve GitHub repository named OneFileLtd/file-management (Do you have properly set 'GitHub project' field in job configuration?)
    at com.github.terma.jenkins.githubprcoveragestatus.GitHubPullRequestRepository.getGitHubRepository(GitHubPullRequestRepository.java:59)
    at com.github.terma.jenkins.githubprcoveragestatus.CompareCoverageAction.perform(CompareCoverageAction.java:98)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
    at hudson.model.Build$BuildExecution.post2(Build.java:186)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
    at hudson.model.Run.execute(Run.java:1749)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:421)

1 个答案:

答案 0 :(得分:0)

检查您的GitHub个人访问令牌,范围' repo'此插件必须使用: enter image description here