We want to access build job properties changeSets item in Jenkins pipeline. To generate this scenario please follow below steps:
On jenkins pipeline, call a job of freestyle project.
Under that job we have used TFS source control and MSBuild plugin to build .csproj.
On jenkins pipeline set code as below, to access build job properties:
def eJob= build job: "DotNetAppProj", wait: true
Now we want to access eJob.changeSets
and its all methods/propeties.
Kindly suggest solution for this. Thanks in advance.
Are you wanting an example of how to use the changeSets member variable?
If so, the following will get the first commit in the "DotNetAppProj" and display the username and commmit message.
node {
def eJob= build job: "DotNetAppProj", wait: true
if(eJob.changeSets.size() > 0 && eJob.changeSets.items.size() > 0) {
echo eJob.changeSets[0].items[0].author.fullName
echo eJob.changeSets[0].items[0].msg
}
}
For a complete list of member variables other than msg and author, see the ChangeLogSet.Entry.