However, when I try to create it, the doubly-nested listViews created using the 'projects' and 'jobTypes' lists are created at the top level, and not as doubly-nested views inside docs / Builds, as I expect. The structure I get instead is like this:
Here is my code as it stands now. Do you think I should be using a for loop instead of the .each lambda? And can anyone explain why this might b e?
// 'docs' view has all jobs that start with docs-
nestedView("docs") {
println "Creating or updating nested views for docs"
description('''All documentation-related Jenkins jobs.<br />
Several views are provided. See the Views menu below.
filterBuildQueue()
filterExecutors()
views {
println "Creating All view"
listView('All') {
jobs {
regex("docs-.*")
}
recurse()
}
// Builds have a format like docs-cloudera-master-d4p or docs-kudu-0.9.1-suitehelp
println "Creating Builds view"
nestedView('Builds') {
description('''All doc jobs that create D4P, Suitehelp, PDF, or QA artifacts.<br />
views {
println "Creating Builds / All view"
listView('All') {
description('''All doc jobs that create D4P, Suitehelp, PDF, or QA artifacts.<br />
jobs {
regex('docs-.*-[d4p|suitehelp|pdf2|qa]$')
}
statusFilter(StatusFilter.ALL)
}
// Easy way to have one view for each rough type of jobs
def jobTypes = ["d4p", "suitehelp", "pdf2", "qa"]
jobTypes.each {
println "Creating Builds / ${it} view."
listView("${it}") {
description("""All doc jobs of type ${it}.<br />
jobs {
regex("docs-${it}.*")
}
}
} // end jobTypes
// Easy way to make some project-specific dashboards
// Matches things like docs-cloudera or docs-connectors
def projects = ["cdh", "cloudera", "cm", "connectors", "director", "doc_smokes", "hadoop", "hue", "impala", "kafka", "kudu", "legal", "navigator", "rel-notes", "security-bulletins", "sense", "spark"]
projects.each {
println "Creating Builds / ${it} view."
listView("${it}") {
description("""All doc jobs for project ${it}.<br />
jobs {
regex("docs-${it}.*")
}
}
} // end projects
} // end views inside Builds
} // end Builds nestedView
// In Progress
println "Creating In Progress view."
listView('In Progress') {
description("""All doc currently building.<br />
jobs {
regex('docs-.*')
}
jobFilters {
buildTrend {
matchType(MatchType.INCLUDE_MATCHED)
status(BuildStatusType.STARTED)
}
}
recurse()
} // end In Progress view
// Failed
println "Creating Failed view."
listView('Failed') {
description("""All doc jobs that failed the last build.<br />
jobs {
regex('docs-.*')
}
jobFilters {
status {
matchType(MatchType.INCLUDE_MATCHED)
status(Status.FAILED)
status(Status.UNSTABLE)
}
}
recurse()
} // end Failed view
// Generated view (for jobs that generate content) matches a regex
println "Creating Generated view."
listView('Generated') {
description('Doc jobs that create content from source or a running CM instance.')
jobs {
regex('docs-[Convert|Get].*')
}
jobFilters {
status {
matchType(MatchType.INCLUDE_MATCHED)
status(Status.FAILED)
status(Status.UNSTABLE)
}
}
recurse()
} // end Generated view
// Maintenance view only has specific jobs added to it
println "Creating Maintenance view."
listView('Maintenance') {
description('Doc jobs that are run periodically, such as link checkers or Git reports.')
jobs {
regex('docs-[linklint|report].*')
}
recurse()
} // end Maintenance view
} // end views inside Docs
} // end docs nestedView