Hi Vitaly,

Not sure if it helps but this is a Groovy script that I use to obtain the 
change details.  Change details are not always available as it depends on 
pulling in a Git commit to obtain and sometimes (for instance rebuilding) 
it may not have those changes.  I think what you are referring to is that 
Jenkins has the information in the object currentBuild.changeSets which is 
a collection of the changes.  It took me a while to find out some of the 
details to display here but I think this script kind of mimics what Jenkins 
shows on the change summary.

def call() {
def changeText = StringBuilder.newInstance()
for (changeSet in currentBuild.changeSets) {
for (item in changeSet.items) {
def shortCommitId = item.commitId.substring(0,12)
changeText.append("Commit ${shortCommitId} by *${item.author}*, 
${item.msg}\n")
}
}
if (changeText.length() == 0) {
changeText.append("No Changes Identified.")
}
return changeText.toString()
}

Sample output:
Commit {partial_commit_string_1} by *{author_1}*, {message_from_commit_1}
Commit {partial_commit_string_2} by *{author_2}*, {message_from_commit_2}

Hopefully this helps.

Bruce

On Tuesday, June 9, 2020 at 3:55:42 AM UTC-4, Vitaly Karasik wrote:
>
> For each build in jenkins there is a page with a "Changes  Summary" of 
> what happened in that build. I guess the same is available in 'when' 
> condition as 'changelog'.
> How I get the same text into my declarative pipeline? I found many 
> examples using some plugins and scripts, but Jenkins core definitely knows 
> this info.
> What I'm missing?
>
> TIA, Vitaly
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" 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-users/6abae292-475c-49f5-bc95-3445d8d4990eo%40googlegroups.com.

Reply via email to