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

GitHubCommitStatusSetter is not reading proper commit id from a shared library

      GitHubCommitStatusSetter is not able to get a proper commitId to update the status on Github, because the commitId that is passed is the head commit for the shared library, instead of the project being built.

       

      Besides that, in the same scenario, I have this code in a shared library:

      String getGitAuthor() {
          def commit = sh(returnStdout: true, script: 'git rev-parse HEAD'); 
          return sh(returnStdout: true, script: "git --no-pager show -s --format='%an' ${commit}").trim();
      } 
      
      String getLastCommitMessage() {
          return sh(returnStdout: true, script: 'git log -1 --pretty=%B').trim();
      }
      

      When running a build consuming the library, then those methods return values for the shared library project, instead of the project that is actually being built. Maybe I'm doing it wrong and I'm not locating the code in the proper place, so please correct me if I'm wrong.

          [JENKINS-53149] GitHubCommitStatusSetter is not reading proper commit id from a shared library

          Manuel de la Peña created issue -
          Manuel de la Peña made changes -
          Description Original: I have this code in a shared library:
          {code:java}
          String getGitAuthor() {
              def commit = sh(returnStdout: true, script: 'git rev-parse HEAD');
              return sh(returnStdout: true, script: "git --no-pager show -s --format='%an' ${commit}").trim();
          }

          String getLastCommitMessage() {
              return sh(returnStdout: true, script: 'git log -1 --pretty=%B').trim();
          }
          {code}
          When running a build consuming the library, then those methods return values for the shared library project, instead of the project that is actually being built. Maybe I'm doing it wrong and I'm not locating the code in the proper place, so please correct me if I'm wrong.

          Besides that, in the same scenario, GitHubCommitStatusSetter is not able to get a proper commitId to update the status on Github, because the commitId that is passed is the head commit for the shared library, instead of the project being built.
          New: GitHubCommitStatusSetter is not able to get a proper commitId to update the status on Github, because the commitId that is passed is the head commit for the shared library, instead of the project being built.

           

          Besides that, in the same scenario, I have this code in a shared library:
          {code:java}
          String getGitAuthor() {
              def commit = sh(returnStdout: true, script: 'git rev-parse HEAD');
              return sh(returnStdout: true, script: "git --no-pager show -s --format='%an' ${commit}").trim();
          }

          String getLastCommitMessage() {
              return sh(returnStdout: true, script: 'git log -1 --pretty=%B').trim();
          }
          {code}
          When running a build consuming the library, then those methods return values for the shared library project, instead of the project that is actually being built. Maybe I'm doing it wrong and I'm not locating the code in the proper place, so please correct me if I'm wrong.
          Manuel de la Peña made changes -
          Released As New: https://github.com/jenkinsci/github-plugin/releases/tag/v1.29.3
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            lanwen Kirill Merkushev
            mdelapenya Manuel de la Peña
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: