-
Improvement
-
Resolution: Fixed
-
Minor
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
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. |
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 ] |
It is weird: the commitId used to update the github status is properly captured in pull requests, but not on master branch, where the commitId used is the head commit of the shared library.