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

GitHubCommitStatusSetter is not reading proper commit id from a shared library

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: