Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72322

Coverage check for PRs

XMLWordPrintable

      I'm trying to publish a check in my GitHub PRs with the coverage results, showing the difference between PR branch and master branch.

      My code, after executing mvn verify, is:

      discoverGitReferenceBuild()              
      recordCoverage(tools: [[parser: 'JACOCO', pattern: 'target/site/jacoco/jacoco.xml']], sourceCodeRetention: 'NEVER') 

      The complete log of PR execution is this:

      [Pipeline] discoverGitReferenceBuild
      [ReferenceFinder] Found a `MultiBranchProject`, trying to resolve the target branch from the configuration
      [ReferenceFinder] -> no target branch configured in step
      [ReferenceFinder] -> detected a pull or merge request for target branch 'master'
      [ReferenceFinder] -> inferred job for target branch: 'master'
      [ReferenceFinder] -> detected 203 commits in current branch (last one: '4174ca0')
      [ReferenceFinder] -> adding 1 commits from build '#17' of reference job (last one: '4174ca0')
      [ReferenceFinder] -> found a matching commit in current branch and target branch: '4174ca0'
      [ReferenceFinder] -> found build '#17' in reference job with matching commits
      [ReferenceFinder] Found reference build '#17' for target branch
      [Pipeline] recordCoverage
      [JaCoCo] Recording coverage results
      [JaCoCo] Searching for all files in '/home/jenkins/agent/workspace/java_simple-java-app_PR-31' that match the pattern 'target/site/jacoco/jacoco.xml'
      [JaCoCo] Traversing of symbolic links: disabled
      [JaCoCo] -> found 1 file
      [JaCoCo] Successfully parsed file '/home/jenkins/agent/workspace/java_simple-java-app_PR-31/target/site/jacoco/jacoco.xml'
      [JaCoCo] MODULE: 100.00% (1/1)
      [JaCoCo] PACKAGE: 100.00% (1/1)
      [JaCoCo] FILE: 100.00% (1/1)
      [JaCoCo] CLASS: 100.00% (1/1)
      [JaCoCo] METHOD: 33.33% (1/3)
      [JaCoCo] LINE: 40.00% (2/5)
      [JaCoCo] INSTRUCTION: 40.00% (6/15)
      [JaCoCo] COMPLEXITY: 3
      [JaCoCo] COMPLEXITY_MAXIMUM: 1
      [JaCoCo] COMPLEXITY_DENSITY: 3/5
      [JaCoCo] LOC: 5
      [JaCoCo] Successfully processed file 'target/site/jacoco/jacoco.xml'
      [Coverage] Recording coverage results
      [Coverage] Searching for all files in '/home/jenkins/agent/workspace/java_simple-java-app_PR-31' that match the pattern 'target/site/jacoco/jacoco.xml'
      [Coverage] Traversing of symbolic links: disabled
      [Coverage] -> found 1 file
      [Coverage] Successfully parsed file '/home/jenkins/agent/workspace/java_simple-java-app_PR-31/target/site/jacoco/jacoco.xml'
      [Coverage] MODULE: 100.00% (1/1)
      [Coverage] PACKAGE: 100.00% (1/1)
      [Coverage] FILE: 100.00% (1/1)
      [Coverage] CLASS: 100.00% (1/1)
      [Coverage] METHOD: 33.33% (1/3)
      [Coverage] LINE: 40.00% (2/5)
      [Coverage] INSTRUCTION: 40.00% (6/15)
      [Coverage] COMPLEXITY: 3
      [Coverage] COMPLEXITY_MAXIMUM: 1
      [Coverage] COMPLEXITY_DENSITY: 3/5
      [Coverage] LOC: 5
      [Coverage] Successfully processed file 'target/site/jacoco/jacoco.xml'
      [Coverage] Resolving source code files...
      [Coverage] Searching for source code files in '/home/jenkins/agent/workspace/java_simple-java-app_PR-31/src/main/java'
      [Coverage] -> resolved absolute paths for all 1 source files
      [Coverage] Making paths of 1 source code files relative to workspace root...
      The recommended git tool is: NONE
      using credential xxx-xxx-xxxx
      [Coverage] Obtaining action of reference build
      [Coverage] Obtaining reference build from reference recorder
      [Coverage] -> Found 'java » simple-java-app » master #17'
      [Coverage] -> Using reference build 'java/simple-java-app/master #17'
      [Coverage] -> Found reference result in build '#17'
      [Coverage] Calculating the code delta...
      [Coverage] Exception while creating a GitClient instance for work tree '/home/jenkins/agent/workspace/java_simple-java-app_PR-31'
      [Coverage] -> Git Delta Calculator could not be created for SCM 'hudson.plugins.git.GitSCM@273cbc42' in working tree '/home/jenkins/agent/workspace/java_simple-java-app_PR-31'
      [Coverage] -> No suitable delta calculator found.
      [Coverage] Calculating coverage deltas...
      [Coverage] No quality gates have been set - skipping
      [Coverage] Executing source code painting...
      [Coverage] Finished coverage processing - adding the action to the build...
      [Checks API] No suitable checks publisher found.
       

      I don't understand why there is no comments in the PR, all configuration is ok, can you help me please?

      Thanks in advance.

            drulli Ulli Hafner
            segues Sergio Gutiérrez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: