1. 27 au 29 mars 2013Vincent Massol, Nov 2017
Creating your own project’s
Quality Dashboard
2. Agenda
• Why XWiki?
• Quality metrics to monitor
• Storing data in the wiki
• Caching to improve performance
• Send email on conditions
• Custom skin
• Q&A
Let’s do this live!
3. Why XWiki?
• A wiki but more importantly a web dev platform
• Reusing existing building blocks instead of starting from scratch
• Live site and thus easy to test
• Will use the following features of XWiki
• Scripting (especially Groovy)
• Graph Macro
• Dashboard Macro
• Scheduler feature
• JIRA Macro
• GitHub Stats Application
• L&F customisation
• And more (authentication,
permissions, etc)
4. Quality metrics to monitor
• Context: Java development project
• Goal: Create a dashboard to monitor the following metrics
• Number of tests (from Jenkins)
• Number of code bugs (from SonarQube)
• Open Blocker issues from the issue tracker (from JIRA)
• (for fun) Committer stats (from GitHub)
5. 27 au 29 mars 2013
Number of Tests
Jenkins Integration
6. Number of tests - Retrieval
• Using Jenkins REST API
{{groovy}}
def url = 'http://ci.xwiki.org/job/xwiki-commons/
lastSuccessfulBuild/testReport/api/xml?
pretty=true&depth=-1'.toURL().text
def root = new XmlSlurper().parseText(url)
println "Tests for XWiki Commons: ${root.totalCount}"
{{/groovy}}
Demo
7. Storing Data locally
• Why?
• Performance reasons for viewing collected data
• Ability to graph evolution of metrics
• How?
• Create data structure (XClass)
• Script to import data from remote sites and store them in wiki pages
(XObjects = instances of XClass)
• Scheduler job to run it every day (for example)
20. Send mail on condition
• Example: Send mail when # bugs > 10
• Using a Scheduler job for example or when fetching data
{{groovy}}
[…]
if (root.issues.size() >= 10) {
def message = services.mailsender.createMessage(
"vincent@massol.net", "Alert: too many bugs!")
message.addPart("text/plain", "text content")
services.mailsender.send([message], 'database')
}
{{/groovy}}
21. 27 au 29 mars 2013
Tracker Issues
JIRA Integration
22. Tracker Issues - JIRA Macro
• Using XWiki’s JIRA Macro
{{jira id="xwikiorg" style="table" source="jql"}}
category = 10000 AND priority = blocker AND resolution = open
{{/jira}}