Pipeline: Get SCM changes for build

19 views
Skip to first unread message

Sverre Moe

unread,
Sep 26, 2016, 4:42:32 AM9/26/16
to Jenkins Users
The following will get me the top most git commit hash:
def gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()

The following will get me the top most git commit message:
def gitCommitMessage = sh(returnStdout: true, script: 'git log -n 1 --format=%s').trim()

However within one single build there is n number of commits. I need all commits listed on Changes.
Is there an environment parameter that would get me all the changes, or at least the number of changes to use in git log?
Reply all
Reply to author
Forward
0 new messages