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

Git Status Notification Fails With Folders


    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • github-plugin
    • None
    • Jenkins 2.190.3
      Github 1.29.5
      Folders 6.10.1

      When using the GitHubCommitStatusSetter  class in a pipeline like so:


      void setBuildStatus(String repo, String message, String state) {
       $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:


      --- 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.


            lanwen Kirill Merkushev
            timorme Tim Orme
            0 Vote for this issue
            2 Start watching this issue