From 1cc6915394d66acdf13e91f480ec98f6c01b882d Mon Sep 17 00:00:00 2001 From: Manuele Simi Date: Wed, 11 Mar 2020 12:08:55 -0400 Subject: [PATCH] Separate stage for the report. --- Jenkinsfile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4e8bb09..bd2b1dc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,7 +43,7 @@ pipeline { } } - stage('find downstream projects') { + stage('analyze downstream projects') { steps { script { // 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 downdeps = [] //println "Looking for users of ${artifact}" @@ -67,6 +77,7 @@ def findDownstreamDependencies(modules2deps, artifact) { downdeps } +//build the report of the given dependency, go recursive on its dependencies def analyzeDependency(modules2deps, artifacts2projects, report, artifact, deep) { def level = "L${deep}" report['downstream_modules'][level][artifact] = [ 'dependencies':[], 'projects':[] ] @@ -93,6 +104,7 @@ def analyzeDependency(modules2deps, artifacts2projects, report, artifact, deep) report } +// print the final report def printReport(report) { def text = '' def indent = '\t' @@ -125,7 +137,7 @@ def printReport(report) { } println text } - +// debug job def printJob(job) { println("fullname ${job.fullName}") println("name ${job.name}")