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

Jenkins cannot stat for Jenkinsfile in directory which is a submodule on some branches

XMLWordPrintable

      I noticed this issue after merging a git submodule into a parent repository. e.g., previously the repo had a submodule with name "libA" and now there is a directory with name "libA" which has identical contents to the submodule.

      A jenkins job used to point at a Jenkinsfile in the submodule root, and I reconfigured it to point to the parent repository with path "libA/Jenkinsfile".

      The branch indexing succeeds for branches where the submodule was merged, but hard fails if it scans a branch where the submodule is still present.

      I don't expect Jenkins to recursively scan into the submodule, but I think it should return SCMFile.Type.NONEXISTENT and skip the branch as though the file was not found. Hard failing and cancelling the rest of the branch indexing task seems like a bug.

      I can't easily identify where to contribute this myself, otherwise I would.

      Checking branch BRANCH_WITH_SUBMODULE
      ERROR: [Tue Jun 22 20:32:47 UTC 2021] Could not fetch branches from source JOBNAME
      [Tue Jun 22 20:32:47 UTC 2021] Finished branch indexing. Indexing took 4.8 sec
      FATAL: Failed to recompute children of JOBNAME
      org.kohsuke.github.HttpException: Server returned HTTP response code: 200, message: 'null' for URL: https://GITHUB/api/v3/repos/ORG/REPO/contents/libA?ref=refs%2Fheads%2FBRANCH_WITH_SUBMODULE
      	at org.kohsuke.github.GitHubClient.interpretApiError(GitHubClient.java:494)
      	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:414)
      	at org.kohsuke.github.GitHubPageIterator.fetch(GitHubPageIterator.java:144)
      	at org.kohsuke.github.GitHubPageIterator.hasNext(GitHubPageIterator.java:91)
      	at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:106)
      	at org.kohsuke.github.PagedIterator.nextPageArray(PagedIterator.java:134)
      	at org.kohsuke.github.PagedIterable.toArray(PagedIterable.java:78)
      	at org.kohsuke.github.PagedIterable.toArray(PagedIterable.java:106)
      	at org.kohsuke.github.PagedIterable.toList(PagedIterable.java:118)
      	at org.kohsuke.github.GHRepository.getDirectoryContent(GHRepository.java:2449)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMProbe.stat(GitHubSCMProbe.java:145)
      	at org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory$1.isHead(WorkflowBranchProjectFactory.java:74)
      	at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:342)
      	at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:249)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1050)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:642)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1033)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `[Lorg.kohsuke.github.GHContent;` from Object value (token `JsonToken.START_OBJECT`)
       at [Source: (String)"{"name":"libA","path":"libA","sha":"f6592df2ca60c13d2ada75eceed3ee45168ff714","size":0,"url":"https://GITHUB/api/v3/repos/ORG/REPO/contents/libA?ref=refs%2Fheads%2FBRANCH_WITH_SUBMODULE","html_url":"https://GITHUB/ORG/OLD_SUBMODULE_REPO/tree/SHA","git_url":"https://GITHUB/api/v3/repos/ORG/OLD_SUBMODULE_REPO/git/trees/SHA","download_url":null,"type":"submodule""[truncated 450 chars]; line: 1, column: 1]
      	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
      	at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1601)
      	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1375)
      	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1322)
      	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.handleNonArray(ObjectArrayDeserializer.java:343)
      	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:194)
      	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:24)
      	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
      	at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2033)
      	at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1491)
      	at org.kohsuke.github.GitHubResponse.parseBody(GitHubResponse.java:97)
      	at org.kohsuke.github.GitHubPageIterator.lambda$fetch$0(GitHubPageIterator.java:145)
      	at org.kohsuke.github.GitHubClient.createResponse(GitHubClient.java:455)
      	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:406)
      	... 21 more
      Finished: FAILURE
      

            Unassigned Unassigned
            stevenfoster Steven Foster
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: