Jenkins github pull request builder picks wrong commit
The problem was the branch
specification and refspec
. Changing the scm.git
section of job to this solved the problem of Jenkins checking out the wrong commit:
scm {
git {
remote {
name("origin")
url("[email protected]:org/${repo}.git")
credentials("jenkins-ssh-keyid")
refspec('+refs/pull/*:refs/remotes/origin/pr/*')
}
branch('${ghprbActualCommit}')
}
}
}