-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: forensics-api-plugin, git-forensics-plugin
-
None
Getting error when coverage plugin trying to get the delta coverage
[Coverage] [-ERROR-] Errors while recording code coverage: [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] Errors from Git Delta: [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] Could not find the specified commit - is the SCM parameter correctly set? [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] org.eclipse.jgit.errors.MissingObjectException: Missing unknown d17aeef565d735a61e9e30a2b901d9fb9b850b81 [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-client//org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:136) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-client//org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:216) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-client//org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1144) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-client//org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:1055) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-forensics//io.jenkins.plugins.forensics.git.delta.DeltaRepositoryCallback.calculateDelta(DeltaRepositoryCallback.java:90) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-forensics//io.jenkins.plugins.forensics.git.delta.DeltaRepositoryCallback.invoke(DeltaRepositoryCallback.java:72) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-forensics//io.jenkins.plugins.forensics.git.delta.DeltaRepositoryCallback.invoke(DeltaRepositoryCallback.java:42) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:28) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:83) [2025-03-14T01:19:38.051Z] [Coverage] [-ERROR-] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] at java.base/java.lang.reflect.Method.invoke(Unknown Source) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:986) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:961) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:907) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] at hudson.remoting.UserRequest.perform(UserRequest.java:225) [2025-03-14T01:19:38.052Z] [Coverage] [-ERROR-] ... skipped logging of 8 additional errors ...
We do pass the value to the function likeÂ
gitOrgRepo : 'ABC/Test-service' recordCoverage(scm: $gitOrgRepo) // Our repo name is 'ABC/Test-service'
We are using function call likeÂ
void recordCoverage() {
    String buildResultBeforeRecordCoverage = steps.currentBuild.result
    String gitOrgRepo = getGitOrgRepo()
    steps.echo("Discovering Git reference build (scm=${gitOrgRepo}) before calling recordCoverage")
    steps.discoverGitReferenceBuild scm: gitOrgRepo
    Map recordCoverageArgs = [
        checksAnnotationScope: getChecksAnnotationScope(),
        checksName: getChecksName(),
        enabledForFailure: false,
        failOnError: false,
        ignoreParsingErrors: false,
        qualityGates: getQualityGates(),
        scm: gitOrgRepo,
        skipPublishingChecks: false,
        skipSymbolicLinks: false,
        sourceCodeEncoding: getSourceCodeEncoding(),
        sourceCodeRetention: 'EVERY_BUILD',
        sourceDirectories: getSourceDirectories(),
        useAutoSourceDetect: getSourceAutoDetect(),
        tools: getTools(),
        id: getId(),
        name: getReportName()
    ]
    steps.echo("recording coverage with args=" + recordCoverageArgs)
    //Soring the build status prior to recordCoverage execution
    steps.recordCoverage(recordCoverageArgs)
    setBuildStatus(buildResultBeforeRecordCoverage, true)
  }
Internal call to get the scm value isÂ
def getGitOrgRepo() {
    String gitOrgRepo = getArgument('gitOrgRepo')
    return gitOrgRepo
  }