New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to include changelog information on pipeline script #397
Comments
Found workaround there - https://support.cloudbees.com/hc/en-us/articles/217630098-How-to-access-Changelogs-in-a-Pipeline-Job-.
|
This should be part of the basic options for the pipeline method. // vars/getTriggerCause.groovy
@NonCPS
def call() {
def triggerCause = ""
echo "Get triggering Cause"
// Get triggering information
def causes = currentBuild.rawBuild.getCauses()
for(cause in causes) {
if (cause.class.toString().contains("UpstreamCause")) {
triggerCause += "Triggered by job: " + cause.upstreamProject + "\n"
} else {
// This method already add "Started by " in the description
triggerCause += cause.getShortDescription() + "\n"
}
}
return triggerCause
} |
That code can be written in a more groovy way: def getChanges) {
MAX_MSG_LEN = 100
def changes = ""
echo "Gathering SCM changes"
def changeLogSets = currentBuild.rawBuild.changeSets
changeLogSets.each { def changeLogSet ->
def entries = changeLogSet.items
entries.each { def entry ->
truncated_msg = entry.msg.take(MAX_MSG_LEN)
changes += " - $truncated_msg [$entry.author]\n"
}
}
if (!changes) {
changes = " - No new changes"
}
return changes
} |
Currently there is not opportunity to include changes (github changelog) in messages from pipeline script, but this option is available in freestyle projects (Post-build Actions -> Slack Notifications -> Advanced -> Notification message includes).
The text was updated successfully, but these errors were encountered: