Check if there are changes in git from pipeline

Jai*_*ela 2 git jenkins jenkins-pipeline

I'm working on a multibranch (A) job that is being triggered from another one (B). I want to do the deploy of my project only if there are changes in this project (A). By changes I mean from the last build of this job (I've seen the jenkins pannel gives you this info when you build, so I thought it would be possible to read it somewhere).

在此处输入图片说明)

So, is there any way of checking it in a pipeline?

Jai*_*ela 5

终于我找到了答案。如果您只想知道该版本中是否有更改,可以执行以下操作:

if(currentBuild.changeSets.size() > 0) {
    //There are changes
}
else {
    //No changes
}
Run Code Online (Sandbox Code Playgroud)