Separate stage for the report.

This commit is contained in:
Manuele Simi 2020-03-11 12:08:55 -04:00
parent e8b96ded7a
commit 1cc6915394
1 changed files with 14 additions and 2 deletions

16
Jenkinsfile vendored
View File

@ -43,7 +43,7 @@ pipeline {
} }
} }
stage('find downstream projects') { stage('analyze downstream projects') {
steps { steps {
script { script {
// println "PROJECT ${inputProject} BUILDS ${projects2artifacts[inputProject]} artifacts" // println "PROJECT ${inputProject} BUILDS ${projects2artifacts[inputProject]} artifacts"
@ -59,7 +59,17 @@ pipeline {
} }
} }
} }
stage('print report') {
steps {
script {
printReport(report)
}
}
}
}
} }
// look for modules that use this artifact
def findDownstreamDependencies(modules2deps, artifact) { def findDownstreamDependencies(modules2deps, artifact) {
def downdeps = [] def downdeps = []
//println "Looking for users of ${artifact}" //println "Looking for users of ${artifact}"
@ -67,6 +77,7 @@ def findDownstreamDependencies(modules2deps, artifact) {
downdeps downdeps
} }
//build the report of the given dependency, go recursive on its dependencies
def analyzeDependency(modules2deps, artifacts2projects, report, artifact, deep) { def analyzeDependency(modules2deps, artifacts2projects, report, artifact, deep) {
def level = "L${deep}" def level = "L${deep}"
report['downstream_modules'][level][artifact] = [ 'dependencies':[], 'projects':[] ] report['downstream_modules'][level][artifact] = [ 'dependencies':[], 'projects':[] ]
@ -93,6 +104,7 @@ def analyzeDependency(modules2deps, artifacts2projects, report, artifact, deep)
report report
} }
// print the final report
def printReport(report) { def printReport(report) {
def text = '' def text = ''
def indent = '\t' def indent = '\t'
@ -125,7 +137,7 @@ def printReport(report) {
} }
println text println text
} }
// debug job
def printJob(job) { def printJob(job) {
println("fullname ${job.fullName}") println("fullname ${job.fullName}")
println("name ${job.name}") println("name ${job.name}")