Constantly getting 0% master coverage on non PR branches
spbkelt opened this issue · 1 comments
spbkelt commented
Hi,
Here is my scripted pipeline code:
def executeChecks() {
if (params.SKIP_TESTS) {
echo('Skipping Test stage')
return
}
stage('Test') {
executeCompatibilityChecks()
executeUnitTests()
}
stage('Record Coverage') {
if ( env.DEFAULT_BRANCH == env.GIT_LOCAL_BRANCH ) {
currentBuild.result = 'SUCCESS'
step([$class: 'MasterCoverageAction', scmVars: [GIT_URL: env.GIT_URL]])
}
}
stage('PR Coverage to Github') {
if ( GH.isOnPullRequest() && env.CHANGE_ID != null) {
currentBuild.result = 'SUCCESS'
step([$class: 'CompareCoverageAction', scmVars: [GIT_URL: env.GIT_URL]])
}
}
}
Branch is release/*
Build logs:
[Pipeline] jacoco
21:17:33 [JaCoCo plugin] Collecting JaCoCo coverage data...
21:17:33 [JaCoCo plugin] **/build/jacoco/**.exec;**/build/classes/java/main;**/src/main/java, **/src/java; locations are configured
21:17:34 [JaCoCo plugin] Number of found exec files for pattern **/build/jacoco/**.exec: 1
21:17:34 [JaCoCo plugin] Saving matched execfiles: /home/jenkins/agent/workspace/ci_app-tcb-api_release_9.13-U24S2KQQ5AFJ2IBZKZG6SAD7MRNMKAGI2YZRCUB7N5KTTGC2QFSA/build/jacoco/test.exec
21:17:34 [JaCoCo plugin] Saving matched class directories for class-pattern: **/build/classes/java/main:
21:17:34 [JaCoCo plugin] - /home/jenkins/agent/workspace/ci_app-tcb-api_release_9.13-U24S2KQQ5AFJ2IBZKZG6SAD7MRNMKAGI2YZRCUB7N5KTTGC2QFSA/build/classes/java/main 314 files
21:17:35 [JaCoCo plugin] Saving matched source directories for source-pattern: **/src/main/java, **/src/java:
21:17:35 [JaCoCo plugin] - /home/jenkins/agent/workspace/ci_app-tcb-api_release_9.13-U24S2KQQ5AFJ2IBZKZG6SAD7MRNMKAGI2YZRCUB7N5KTTGC2QFSA/src/java 259 files
21:17:35 [JaCoCo plugin] Loading inclusions files..
21:17:35 [JaCoCo plugin] inclusions: [**/*.class]
21:17:35 [JaCoCo plugin] exclusions: []
21:17:35 [JaCoCo plugin] Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=80, minMethod=0, maxMethod=80, minLine=0, maxLine=80, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]
21:17:35 [JaCoCo plugin] Publishing the results..
21:17:35 [JaCoCo plugin] Loading packages..
21:17:35 [JaCoCo plugin] Done.
21:17:35 [JaCoCo plugin] Overall coverage: class: 20, method: 22, line: 23, branch: 18, instruction: 24
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Record Coverage)
[Pipeline] step
21:17:36 Master coverage 0%
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (PR Coverage to Github)
[Pipeline] }
[Pipeline] // stage
spbkelt commented
PR build failed:
We use multi-branch pipeline
11:05:10 Dumping environment vars:
11:05:10 CHANGE_URL=https://github.com/***/pull/100
11:05:10 CHANGE_ID=100
[Pipeline] stage
[Pipeline] { (Record Coverage)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (PR Coverage to Github)
[Pipeline] step
11:28:53 [GitHub PR Status] start
11:28:53 [GitHub PR Status] getting master coverage...
11:28:53 use default coverage repo
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.FileNotFoundException: https://api.github.com/repos/***/UnifiedDS-TCB-AppTcbApi
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
at org.kohsuke.github.Requester.parse(Requester.java:609)
Caused: java.io.FileNotFoundException: https://api.github.com/repos/***/UnifiedDS-TCB-AppTcbApi
at sun.reflect.GeneratedConstructorAccessor662.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1944)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1939)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1938)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1508)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at org.kohsuke.github.Requester.parse(Requester.java:619)
at org.kohsuke.github.Requester.parse(Requester.java:601)
at org.kohsuke.github.Requester._to(Requester.java:276)
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:693)
at org.kohsuke.github.Requester._to(Requester.java:297)
at org.kohsuke.github.Requester.to(Requester.java:239)
at org.kohsuke.github.GitHub.getRepository(GitHub.java:474)
at com.github.terma.jenkins.githubprcoveragestatus.GitHubPullRequestRepository.getGitHubRepository(GitHubPullRequestRepository.java:57)
Caused: java.io.IOException: Could not retrieve GitHub repository named ***/UnifiedDS-TCB-AppTcbApi (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:110)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
What do we need to setup in order to be able to record code coverage and compare with already stored master coverage? What is the comparison workflow?