fixed email body and subject; try to enhance the attached file
This commit is contained in:
parent
bd23fde2d1
commit
5d67b4355e
|
@ -75,6 +75,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
printReport(report)
|
printReport(report)
|
||||||
|
saveReport(report)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,14 +97,14 @@ pipeline {
|
||||||
body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
|
body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
|
||||||
emailext attachmentsPattern: "**/walker_notes.${PIPELINE_BUILD_NUMBER}.md",
|
emailext attachmentsPattern: "**/walker_notes.${PIPELINE_BUILD_NUMBER}.md",
|
||||||
to: 'jenkinsreleases@d4science.org',
|
to: 'jenkinsreleases@d4science.org',
|
||||||
subject: "Walker Dependencies for gCube component ${inputProject} (build #${PIPELINE_BUILD_NUMBER})",
|
subject: "Dependency Report for gCube component ${inputProject} (build #${PIPELINE_BUILD_NUMBER})",
|
||||||
body: "Release notes extracted from the CHANGELOG.md(s) of the released components. See ${env.BUILD_URL}"
|
body: "Downstream dependencies of ${inputProject}. See ${env.BUILD_URL}"
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
echo 'The dependencies walker pipeline has failed'
|
echo 'The dependencies walker pipeline has failed'
|
||||||
emailext attachLog: true,
|
emailext attachLog: true,
|
||||||
to: 'jenkinsbuilds@d4science.org',
|
to: 'jenkinsbuilds@d4science.org',
|
||||||
subject: "[JenkinsDependenciesWalker D4S] build ${currentBuild.fullDisplayName} failed",
|
subject: "[JenkinsDependenciesWalker D4S] build ${currentBuild.fullDisplayName} failed for component ${inputProject}",
|
||||||
body: "Something is wrong with ${env.BUILD_URL}"
|
body: "Something is wrong with ${env.BUILD_URL}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,16 +183,59 @@ def printReport(report) {
|
||||||
text += "\n"
|
text += "\n"
|
||||||
}
|
}
|
||||||
println text
|
println text
|
||||||
appendNotes(text)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def appendNotes(report) {
|
// print the final report
|
||||||
sh("""
|
def saveReport(report) {
|
||||||
echo "${report}" >> $WALKER_NOTES
|
def text = ''
|
||||||
""")
|
def indent = '\t'
|
||||||
|
sh("""
|
||||||
|
echo "Dependency Report for ${report['project']}" > $WALKER_NOTES
|
||||||
|
echo "\n\n" >> $WALKER_NOTES
|
||||||
|
echo "|--Project Maven Modules " >> $WALKER_NOTES
|
||||||
|
""")
|
||||||
|
report['downstream_modules'].each { depth, artifacts ->
|
||||||
|
artifacts.each { name, data ->
|
||||||
|
sh("""
|
||||||
|
echo "${indent}|--Module: ${name}\n" >> $WALKER_NOTES
|
||||||
|
echo "${indent * 2}|--Deepest Dependency Level: ${depth}\n" >> $WALKER_NOTES
|
||||||
|
echo "${indent * 2}|--Used by (Maven Modules)\n" >> $WALKER_NOTES
|
||||||
|
""")
|
||||||
|
data['dependencies'].each { d ->
|
||||||
|
sh("""
|
||||||
|
echo "${indent * 3}|--${d}" >> $WALKER_NOTES
|
||||||
|
echo "\n" >> $WALKER_NOTES
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
sh("""
|
||||||
|
echo "${indent * 2}|--Referred by (Jenkins Projects)\n" >> $WALKER_NOTES
|
||||||
|
""")
|
||||||
|
data['projects'].each { p ->
|
||||||
|
sh("""
|
||||||
|
echo "${indent * 3}|--${p}" >> $WALKER_NOTES
|
||||||
|
echo "\n" >> $WALKER_NOTES
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sh("""
|
||||||
|
echo "\n\n" >> $WALKER_NOTES
|
||||||
|
echo "|--All Downstream Projects\n" >> $WALKER_NOTES
|
||||||
|
""")
|
||||||
|
report['downstream_projects'].unique().sort()
|
||||||
|
report['downstream_projects'].each { p ->
|
||||||
|
sh("""
|
||||||
|
echo "${indent}|--${p}" >> $WALKER_NOTES
|
||||||
|
echo "\n" >> $WALKER_NOTES
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// debug job
|
// debug job
|
||||||
def printJob(job) {
|
def printJob(job) {
|
||||||
println("fullname ${job.fullName}")
|
println("fullname ${job.fullName}")
|
||||||
|
|
Loading…
Reference in New Issue