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

Git Status Notification Fails With Folders

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: github-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.190.3
      Github 1.29.5
      Folders 6.10.1
    • Similar Issues:

      Description

      When using the GitHubCommitStatusSetter  class in a pipeline like so:

       

      void setBuildStatus(String repo, String message, String state) {
       step([
       $class: "GitHubCommitStatusSetter",
       reposSource: [$class: "ManuallyEnteredRepositorySource", url: repo],
       contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"],
       errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
       statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
       ]);
      }

      The plugin will report:
      ERROR: [GitHub Commit Status Setter] - Cannot retrieve Git metadata for the build, setting build result to UNSTABLE
      When used in conjunction with the Folders plugin, and the parent folder has a different name than the git repo has.

      So for instance, a folder structure like this correctly sets the status:

       

      my-project
      
      --- build (checks out my-project)
      
      --- release (checks out my-project)
      

      But one like this will fail:

       

      My Project Builds
      
      --- build (checks out my-project)
      
      --- release (checks out my-project)
      

      I believe this is due to the logic here: https://github.com/jenkinsci/github-plugin/blob/1f5b40a8169516b58f4c715373836dba6ff96216/src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java#L55

      The logic is checking the parent "build" to see that it matches the checked out project URL.  There are perhaps other cases where this logic works, but when using the Folder plugin, it presumably is using the folder as the parent build, so naming your folder something different than what is contained in the git url causes it to find nothing valid.

       

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              lanwen Kirill Merkushev
              Reporter:
              timorme Tim Orme
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: