It is a little odd but this function makes the trick, so now I can use a
new environment variable GIT_BASE_COMMIT to reference the real commit
```
def getBaseCommit(){
def baseCommit = ''
def latestCommit = sh(label: 'Get previous commit', script: "git
rev-parse HEAD", returnStdout: true)?.trim()
def previousCommit = sh(label: 'Get previous commit', script: "git
rev-parse HEAD^", returnStdout: true)?.trim()
if(env?.CHANGE_ID == null){
baseCommit = env.GIT_COMMIT
} else if("${env.GIT_COMMIT}".equals("${latestCommit}")){
baseCommit = env.GIT_COMMIT
} else {
baseCommit = previousCommit
}
env.GIT_BASE_COMMIT = baseCommit
return baseCommit
}
```
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/ca060a72-eeb8-46d6-b148-e7258fb310d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.