gCubeDepsWalker/Jenkinsfile

46 lines
1.5 KiB
Groovy

def counts = 0
def projects2artifacts=[:]
def modules2deps=[:]
pipeline {
agent {
label 'CD'
}
stages {
stage('walking projects') {
steps {
script {
Jenkins.getInstance().getAllItems(TopLevelItem.class).each { p ->
projects2artifacts[p.name] = []
p.getAllJobs().each { j -> projects2artifacts[p.name] << j.name }
}
println "FOUND ${projects2artifacts.size()} projects"
projects2artifacts.each { k,v -> println ("PROJECT ${k} BUILDS ${v}") }
}
}
}
stage('walking maven modules') {
steps {
script {
// get all the maven modules and their dependencies
Jenkins.getInstance().getAllItems(hudson.maven.MavenModule.class).each { m ->
modules2deps[m.name] = []
m.getDependencies().each { d -> modules2deps[m.name] << d.toString() }
}
println "FOUND ${modules2deps.size()} modules"
modules2deps.each { k,v -> println ("MODULE ${k} DEPENDS on ${v}") }
}
}
}
}
}
/*
def printJob(job) {
println("fullname ${job.fullName}")
println("name ${job.name}")
println("display name ${job.displayName}")
job.getAllJobs().each {j -> println ("dep: ${j.name}")}
}
*/