SlideShare a Scribd company logo
1 of 42
Download to read offline
27 au 29 mars 2013Vincent Massol,April 2019
Building XWiki
Vincent Massol
• CTO XWiki SAS
• Open source developer
• My Projects
• XWiki (community-driven open source project)
• Past: Maven,Apache Cargo,Apache Cactus, Pattern Testing
• Other Credentials:
• LesCastCodeurs podcast about Java news
• Creator of OSSGTP open source group in Paris
• 3 books: JUnit in Action, Maven:A Developer’s Notebook, BBWM
Agenda
• Part 0: XWiki
• The project
• Part 1:The XWiki Build
• Automated quality checks
• Different types of tests
• Part 2:The CI (Jenkins)
• The various XWiki pipelines
• Part 3: Release Process
• Putting it all together
• Future
Agenda
• Part 0: XWiki
• The project
• Part 1:The XWiki Build
• Automated quality checks
• Different types of tests
• Part 2:The CI (Jenkins)
• The various XWiki pipelines
• Part 3: Release Process
• Putting it all together
• Future
What is XWiki? (1/2)
• A structured open source enterprise wiki
What is XWiki? (2/2)
• A platform for developing content-based web applications
Project Stats
Source: http://dev.xwiki.org/xwiki/bin/view/Community/ProjectHealth
Motivation
• Change the world!
• Needs impact
• Needs max number of users
• Open source
• Needs to show progress
• Release often
• Needs developers / contributors
• Community-driven
• Requires Time-boxing
• XWiki releases every month (3
weeks for RC1, 1w for final)
• Requires integration between all
parts
• Requires CI tool
• Requires quality-control
• Requires automated Tests
• Requires releases as automated as
possible
• Requires automated Build
• Requires good communication
Global Development Workflow
Governance
• Complete separation from
XWiki SAS and XWiki.org
• Only individuals working on the
open source project
• Rules similar to the ASF
• Committership, voting (0, +1, -1),
lazy consensus
• xwiki.org governance and
company advertising:
sponsoring companies
Source: http://dev.xwiki.org/xwiki/bin/view/Community/Governance
Agenda
• Part 0: XWiki
• The project
• Part 1: The XWiki Build
• Automated quality checks
• Different types of tests
• Part 2:The CI (Jenkins)
• The various XWiki pipelines
• Part 3: Release Process
• Putting it all together
• Future
Build
• Maven-based with several custom
plugins
• Active Quality vs Passive Quality.
• Strategy: if it’s not in the build it
doesn’t exist!
• Common to everyone
• If something is important it must fail
the build, otherwise it’s not important
• Try to reduce CI code to the
maximum for local reproducibility and
to be less tied to the CI
Source: http://dev.xwiki.org/xwiki/bin/view/Community/Building
Build = implement quality
Automated Checks
• Standard ones: compilation, tests, javadoc linter, etc
• Test execution: unit, functional, configuration,WCAG, HTML
validation
• Backward compatibility checks
• Code quality checks
• Best practices checks
• Test coverage checks
• Test quality checks
Tests (1/3)
• Unit tests with JUnit5 & Mockito
• XWiki is Component-based and we have some JUnit5 Extensions to
make it easy to test/mock dependent components
@ComponentTest
public class DefaultVelocityConfigurationTest
{
@InjectMockComponents
private DefaultVelocityConfiguration configuration;
@Test
public void getToolsReturnsDefaultTools()
{
assertEquals(ListTool.class.getName(), this.configuration.getTools().get("listtool"));
}
}
Tests (2/3)
• Functional tests with Selenium/WebDriver
• Using a PageObjects strategy
Tests (3/3)
• Configuration tests, based on Docker
• Based on TestContainers
• Supported Browsers, Servlet Engines & Databases
• Usable on dev machine, in the IDE!
• Various other more exotic configurations: LibreOffice
server, Clustering, External SOLR server
• Supports Docker Out Of Docker (DOOD)
@UITest(database = Database.MYSQL, databaseTag = "5", servletEngine = ServletEngine.TOMCAT,
servletEngineTag = “8", browser = Browser.CHROME)
public class MenuIT
...
Backward Compatibility Strategy
• Check in the build with Revapi
• When wanted failure, add to
ignore list in pom.xml
• @Deprecated then move to
Legacy module using AspectJ
• Use @Unstable + @Since for
young APIs
• Custom checkstyle check in build to prevent @Unstable from staying more
than 1 cycle
• {{backwardCompatibility}} xwiki macro in release notes
Source: http://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices#HBackwardCompatibility
Code Quality Checks
• Checkstyle with custom rules. For example
• Verify that Script Services are not located in the internal package
• Verify that @since javadoc tags have the correct format
• Verify that @Unstable annotation don't stay too long
• Verify that components.txt contains all Components
• Verify that JUnit tests don't output content to stdout or stderr. 
• Verify header licenses
• And more…
Best Practices Checks
• Spoon checks
• Verify none of the listed methods are called in our Java code
• File#deleteOnExit() - Causes memory leaks since not
guaranteed to be called. Not good with server software.
• URL#equals() -Very slow, access the host with HTTP calls
• Verify that we don't use Commons Lang < 3 (i.e. that commons-
lang:commons-lang artifact is forbidden)
• Verify we don't use Commons Logging or Log4j (since we use SLF4J)
• And a lot more…
Test Coverage Checks - Local
• Using Jacoco and Clover
• Strategy - “Ratchet effect”:
• Each Maven module has a threshold
• Jacoco Maven plugin fails if new code has less
coverage than before in %
• Dev is allowed to increase threshold
• Global Coverage addressed in CI (see later)
Test Quality Checks
• Using PIT/Descartes Maven plugin
• Concepts of PIT
• Modify code under test (mutants) and run tests
• Good tests kill mutants
• Generates a mutation score similar to the coverage %
• Descartes = extreme mutations that execute fast and have high values
Mutation - Example
result =
   (getId() == macroId.getId() || (getId() != null && getId().equals(macroId.getId())))
   && (getSyntax() == macroId.getSyntax() || (getSyntax() != null && getSyntax().equals(
    macroId.getSyntax())));
Mutation Example
@Test
public void testEquality()
{
    MacroId id1 = new MacroId("id", Syntax.XWIKI_2_0);
    MacroId id2 = new MacroId("id", Syntax.XWIKI_2_0);
    MacroId id3 = new MacroId("otherid", Syntax.XWIKI_2_0);
    MacroId id4 = new MacroId("id", Syntax.XHTML_1_0);
    MacroId id5 = new MacroId("otherid", Syntax.XHTML_1_0);
    MacroId id6 = new MacroId("id");
    MacroId id7 = new MacroId("id");
    Assert.assertEquals(id2, id1);
   // Equal objects must have equal hashcode
   Assert.assertTrue(id1.hashCode() == id2.hashCode());
    Assert.assertFalse(id3 == id1);
    Assert.assertFalse(id4 == id1);
    Assert.assertFalse(id5 == id3);
    Assert.assertFalse(id6 == id1);
    Assert.assertEquals(id7, id6);
   // Equal objects must have equal hashcode
   Assert.assertTrue(id6.hashCode() == id7.hashCode());
}
Not testing
for inequality!
Improved thanks to Descartes!
Mutation Limitations
• Takes time to find interesting things to look at and decide if
that’s an issue to handle or not. Need better categorisation in
report (now reported by Descartes):
• Strong pseudo-tested methods:The worst! No matter what the return
values are the tests always fail
• Pseudo-tested methods: Grey area.The tests pass with at least one
modified value.
• Multi module support - PITmp
• But slow on large projects (e.g. 7+ hours just for xwiki-rendering)
Test Quality Checks - Strategy
• Fail the build when the mutation score of a given module is below a
defined threshold in the pom.xml
• The idea is that new tests should, in average, be of quality equal or better
General goal with coverage + mutation: maintain qualitythan past tests.
• Other idea: hook on CI to run it only on modified code/tests.
• Still some hiccups regarding the mutation score stability!
General goal with coverage + mutation: maintain quality
Agenda
• Part 0: XWiki
• The project
• Part 1:The XWiki Build
• Automated quality checks
• Different types of tests
• Part 2: The CI (Jenkins)
• The various XWiki pipelines
• Part 3: Release Process
• Putting it all together
• Future
XWiki’s CI - Jenkins
• XWiki Jobs are Pipeline jobs
• Using “GitHub Organization” type of jobs
• Autodiscovering of all Jenkinsfile in a GitHub organization
• Automatic handling of branches (job creation/deletion)
• Shared Pipeline library for all jobs
• Clover Pipeline job to compute global TPC
• Docker Pipeline jobs for running Docker-based tests on all
configurations
• Moving to Docker agent and DOOD (Docker Out of Docker)
Shared Pipeline Library
• Features
• Maven build
• Check for flickers both environment flickers and test flickers and don’t
send false positives emails in this case. Examples of environment
flickers:
• JVM crash
• GitHub connection issue
• X Display not ready for UI tests
• Uses JIRA to log test flickers
• Display screenshot of failing test in job report
Standard Pipeline Jobs
• 1 job = several builds (13+ in our case)
• Validates different things:
• “Main”: compile and test execution including functional tests
• “Quality”: Revapi checks, checkstyle, Descartes, Jacoco
• “TestRelease”: Simulate a release.Verifies Maven Central
requirements (javadoc, etc)
• “Flavor*”:Various types of functional tests
• Parallel execution for some jobs
Clover Pipeline
• Issue: Local coverage can increase
and global decrease
• Removed code with high TPC
• Code tested indirectly by
functional tests and code
refactoring led to different paths
used
• New module with lower TPC
than average
• Strategy: Fail the CI build if Global
TPC decreases for the current
version
Docker Pipeline Jobs
• Currently a separate pipeline from the main one
• Two issues
• Requires Jenkins Docker agent to be used (Docker
doesn’t work inside vServer that we use). Migration in
progress.
• Long to execute since it tests all configurations and thus
should only be executed once per day.
• Finds all Docker test modules and run Maven on
each of them, passing the configuration as system
properties.
DOOD
• Jenkins agent running as a Docker container
• Pipeline (and thus Maven) executing inside Docker
• Thus Functional tests based on Docker executing inside Docker
• To make it work:
• Mount Docker socket (only Docker client inside Docker)
• Don’t mount volumes: copy data (in and out)
• Requires special care when writing the JUnit5 Test Container
extension
Jenkins Docker Cloud Configuration
• 3 volumes:
• Docker socket
• Maven settings.xml since it
contains passwords
• SSH keys (private data)
Copying with TestContainers
Agenda
• Part 0: XWiki
• The project
• Part 1:The XWiki Build
• Automated quality checks
• Different types of tests
• Part 2:The CI (Jenkins)
• The various XWiki pipelines
• Part 3: Release Process
• Putting it all together
• Future
Release Process
• Ongoing Release Notes and
reference documentation
• Marked in JIRA with 2 custom
fields
• Rolling Release Managers
Source: http://dev.xwiki.org/xwiki/bin/view/ReleasePlans/
• Create Release Plan for the release
Release Plans (1/2)
Source: http://dev.xwiki.org/xwiki/bin/view/ReleasePlans/
Release Plans (2/2)
• Release in JIRA
• Check that all issues are
documented
• Check Release Notes
• Import translations
• Build the Release
• Create mail
announcement
• Push to Maven Central
• Update Docker official
image
• etc
Source: http://dev.xwiki.org/xwiki/bin/view/ReleasePlans/ReleasePlan845
Agenda
• Part 0: XWiki
• The project
• Part 1:The XWiki Build
• Automated quality checks
• Different types of tests
• Part 2:The CI (Jenkins)
• The various XWiki pipelines
• Part 3: Release Process
• Putting it all together
• Future
Future - Build Level
• Move Test configurations to the build
• Fix UI flickerings which are a plague
• Idea: Change our DSL so that all calls always wait on something
Future - CI Level
• Docker pipeline integrated into main Pipeline library
• To handle branches (a pain right now)
• Needs Parametrized Scheduler Plugin
• Move to CD, i.e. implement the release steps in the CI
• Need to resolve Maven versions and put on staging & promote when
we want
• Auto deploy on myxwiki.org
• STAMP: DSpot on diffs, Evocrash (JIRA -> CI)
Q&A
Me

More Related Content

What's hot

Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)
Gopi Raghavendra
 
Quickly Testing Legacy C++ Code with Approval Tests
Quickly Testing Legacy C++ Code with Approval TestsQuickly Testing Legacy C++ Code with Approval Tests
Quickly Testing Legacy C++ Code with Approval Tests
Clare Macrae
 
Quickly and Effectively Testing Legacy C++ Code with Approval Tests
Quickly and Effectively Testing Legacy C++ Code with Approval TestsQuickly and Effectively Testing Legacy C++ Code with Approval Tests
Quickly and Effectively Testing Legacy C++ Code with Approval Tests
Clare Macrae
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Christian Schneider
 
A Taste of Pharo 7.0
A Taste of Pharo 7.0A Taste of Pharo 7.0
A Taste of Pharo 7.0
ESUG
 

What's hot (20)

(COSCUP 2015) A Beginner's Journey to Mozilla SpiderMonkey JS Engine
(COSCUP 2015) A Beginner's Journey to Mozilla SpiderMonkey JS Engine(COSCUP 2015) A Beginner's Journey to Mozilla SpiderMonkey JS Engine
(COSCUP 2015) A Beginner's Journey to Mozilla SpiderMonkey JS Engine
 
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
 
Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)
 
Testing basics for developers
Testing basics for developersTesting basics for developers
Testing basics for developers
 
基於 Flow & Path 的 MVP 架構
基於 Flow & Path 的 MVP 架構基於 Flow & Path 的 MVP 架構
基於 Flow & Path 的 MVP 架構
 
Quickly Testing Legacy C++ Code with Approval Tests
Quickly Testing Legacy C++ Code with Approval TestsQuickly Testing Legacy C++ Code with Approval Tests
Quickly Testing Legacy C++ Code with Approval Tests
 
First adoption hackathon at BGJUG
First adoption hackathon at BGJUGFirst adoption hackathon at BGJUG
First adoption hackathon at BGJUG
 
Quickly and Effectively Testing Legacy C++ Code with Approval Tests
Quickly and Effectively Testing Legacy C++ Code with Approval TestsQuickly and Effectively Testing Legacy C++ Code with Approval Tests
Quickly and Effectively Testing Legacy C++ Code with Approval Tests
 
Finding Needles in Haystacks
Finding Needles in HaystacksFinding Needles in Haystacks
Finding Needles in Haystacks
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
A Taste of Pharo 7.0
A Taste of Pharo 7.0A Taste of Pharo 7.0
A Taste of Pharo 7.0
 
Introduction to Eclipse Microprofile
Introduction to Eclipse MicroprofileIntroduction to Eclipse Microprofile
Introduction to Eclipse Microprofile
 
Bug zillatestopiajenkins
Bug zillatestopiajenkinsBug zillatestopiajenkins
Bug zillatestopiajenkins
 
Ln monitoring repositories
Ln monitoring repositoriesLn monitoring repositories
Ln monitoring repositories
 
Jwt == insecurity?
Jwt == insecurity?Jwt == insecurity?
Jwt == insecurity?
 
Deserialization vulnerabilities
Deserialization vulnerabilitiesDeserialization vulnerabilities
Deserialization vulnerabilities
 
Testing JSF with Arquillian and Selenium
Testing JSF with Arquillian and SeleniumTesting JSF with Arquillian and Selenium
Testing JSF with Arquillian and Selenium
 
Real Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrapReal Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrap
 
Arquillian - Integration Testing Made Easy
Arquillian - Integration Testing Made EasyArquillian - Integration Testing Made Easy
Arquillian - Integration Testing Made Easy
 

Similar to Building XWiki

Similar to Building XWiki (20)

New types of tests for Java projects
New types of tests for Java projectsNew types of tests for Java projects
New types of tests for Java projects
 
Advanced Java Testing @ POSS 2019
Advanced Java Testing @ POSS 2019Advanced Java Testing @ POSS 2019
Advanced Java Testing @ POSS 2019
 
Developing XWiki
Developing XWikiDeveloping XWiki
Developing XWiki
 
New types of tests for Java projects
New types of tests for Java projectsNew types of tests for Java projects
New types of tests for Java projects
 
Building Top-Notch Androids SDKs
Building Top-Notch Androids SDKsBuilding Top-Notch Androids SDKs
Building Top-Notch Androids SDKs
 
XWiki SAS development practices
XWiki SAS development practicesXWiki SAS development practices
XWiki SAS development practices
 
Qt test framework
Qt test frameworkQt test framework
Qt test framework
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!
 
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan KuštInfinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
33rd degree
33rd degree33rd degree
33rd degree
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
 
Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
 
Implementing Quality on a Java Project
Implementing Quality on a Java ProjectImplementing Quality on a Java Project
Implementing Quality on a Java Project
 
MyHeritage - QA Automations in a Continuous Deployment environment
MyHeritage -  QA Automations in a Continuous Deployment environmentMyHeritage -  QA Automations in a Continuous Deployment environment
MyHeritage - QA Automations in a Continuous Deployment environment
 
Test box bdd
Test box bddTest box bdd
Test box bdd
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Unit Testing and Tools
Unit Testing and ToolsUnit Testing and Tools
Unit Testing and Tools
 

More from Vincent Massol

XWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and SharepointXWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and Sharepoint
Vincent Massol
 
Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013
Vincent Massol
 

More from Vincent Massol (20)

XWiki Testing with TestContainers
XWiki Testing with TestContainersXWiki Testing with TestContainers
XWiki Testing with TestContainers
 
XWiki: The best wiki for developers
XWiki: The best wiki for developersXWiki: The best wiki for developers
XWiki: The best wiki for developers
 
Configuration Testing with Docker & TestContainers
Configuration Testing with Docker & TestContainersConfiguration Testing with Docker & TestContainers
Configuration Testing with Docker & TestContainers
 
What's new in XWiki 9.x and 10.x
What's new in XWiki 9.x and 10.xWhat's new in XWiki 9.x and 10.x
What's new in XWiki 9.x and 10.x
 
QDashboard 1.2
QDashboard 1.2QDashboard 1.2
QDashboard 1.2
 
Advanced Java Testing
Advanced Java TestingAdvanced Java Testing
Advanced Java Testing
 
Creating your own project's Quality Dashboard
Creating your own project's Quality DashboardCreating your own project's Quality Dashboard
Creating your own project's Quality Dashboard
 
XWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and SharepointXWiki: wiki collaboration as an alternative to Confluence and Sharepoint
XWiki: wiki collaboration as an alternative to Confluence and Sharepoint
 
Creating your own project's Quality Dashboard
Creating your own project's Quality DashboardCreating your own project's Quality Dashboard
Creating your own project's Quality Dashboard
 
XWiki: The web's Swiss Army Knife
XWiki: The web's Swiss Army KnifeXWiki: The web's Swiss Army Knife
XWiki: The web's Swiss Army Knife
 
Leading a Community-Driven Open Source Project
Leading a Community-Driven Open Source ProjectLeading a Community-Driven Open Source Project
Leading a Community-Driven Open Source Project
 
XWiki Status - July 2015
XWiki Status - July 2015XWiki Status - July 2015
XWiki Status - July 2015
 
XWiki SAS: An open source company
XWiki SAS: An open source companyXWiki SAS: An open source company
XWiki SAS: An open source company
 
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
XWiki: A web dev runtime for writing web apps @ FOSDEM 2014
 
XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014XWiki Rendering @ FOSDEM 2014
XWiki Rendering @ FOSDEM 2014
 
Implementing Quality on Java projects (Short version)
Implementing Quality on Java projects (Short version)Implementing Quality on Java projects (Short version)
Implementing Quality on Java projects (Short version)
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
 
Combining open source ethics with private interests
Combining open source ethics with private interestsCombining open source ethics with private interests
Combining open source ethics with private interests
 
Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013Evolutions XWiki 2012/2013
Evolutions XWiki 2012/2013
 
Developing XWiki
Developing XWikiDeveloping XWiki
Developing XWiki
 

Recently uploaded

Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 

Recently uploaded (20)

Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 

Building XWiki

  • 1. 27 au 29 mars 2013Vincent Massol,April 2019 Building XWiki
  • 2. Vincent Massol • CTO XWiki SAS • Open source developer • My Projects • XWiki (community-driven open source project) • Past: Maven,Apache Cargo,Apache Cactus, Pattern Testing • Other Credentials: • LesCastCodeurs podcast about Java news • Creator of OSSGTP open source group in Paris • 3 books: JUnit in Action, Maven:A Developer’s Notebook, BBWM
  • 3. Agenda • Part 0: XWiki • The project • Part 1:The XWiki Build • Automated quality checks • Different types of tests • Part 2:The CI (Jenkins) • The various XWiki pipelines • Part 3: Release Process • Putting it all together • Future
  • 4. Agenda • Part 0: XWiki • The project • Part 1:The XWiki Build • Automated quality checks • Different types of tests • Part 2:The CI (Jenkins) • The various XWiki pipelines • Part 3: Release Process • Putting it all together • Future
  • 5. What is XWiki? (1/2) • A structured open source enterprise wiki
  • 6. What is XWiki? (2/2) • A platform for developing content-based web applications
  • 8. Motivation • Change the world! • Needs impact • Needs max number of users • Open source • Needs to show progress • Release often • Needs developers / contributors • Community-driven • Requires Time-boxing • XWiki releases every month (3 weeks for RC1, 1w for final) • Requires integration between all parts • Requires CI tool • Requires quality-control • Requires automated Tests • Requires releases as automated as possible • Requires automated Build • Requires good communication
  • 10. Governance • Complete separation from XWiki SAS and XWiki.org • Only individuals working on the open source project • Rules similar to the ASF • Committership, voting (0, +1, -1), lazy consensus • xwiki.org governance and company advertising: sponsoring companies Source: http://dev.xwiki.org/xwiki/bin/view/Community/Governance
  • 11. Agenda • Part 0: XWiki • The project • Part 1: The XWiki Build • Automated quality checks • Different types of tests • Part 2:The CI (Jenkins) • The various XWiki pipelines • Part 3: Release Process • Putting it all together • Future
  • 12. Build • Maven-based with several custom plugins • Active Quality vs Passive Quality. • Strategy: if it’s not in the build it doesn’t exist! • Common to everyone • If something is important it must fail the build, otherwise it’s not important • Try to reduce CI code to the maximum for local reproducibility and to be less tied to the CI Source: http://dev.xwiki.org/xwiki/bin/view/Community/Building Build = implement quality
  • 13. Automated Checks • Standard ones: compilation, tests, javadoc linter, etc • Test execution: unit, functional, configuration,WCAG, HTML validation • Backward compatibility checks • Code quality checks • Best practices checks • Test coverage checks • Test quality checks
  • 14. Tests (1/3) • Unit tests with JUnit5 & Mockito • XWiki is Component-based and we have some JUnit5 Extensions to make it easy to test/mock dependent components @ComponentTest public class DefaultVelocityConfigurationTest { @InjectMockComponents private DefaultVelocityConfiguration configuration; @Test public void getToolsReturnsDefaultTools() { assertEquals(ListTool.class.getName(), this.configuration.getTools().get("listtool")); } }
  • 15. Tests (2/3) • Functional tests with Selenium/WebDriver • Using a PageObjects strategy
  • 16. Tests (3/3) • Configuration tests, based on Docker • Based on TestContainers • Supported Browsers, Servlet Engines & Databases • Usable on dev machine, in the IDE! • Various other more exotic configurations: LibreOffice server, Clustering, External SOLR server • Supports Docker Out Of Docker (DOOD) @UITest(database = Database.MYSQL, databaseTag = "5", servletEngine = ServletEngine.TOMCAT, servletEngineTag = “8", browser = Browser.CHROME) public class MenuIT ...
  • 17. Backward Compatibility Strategy • Check in the build with Revapi • When wanted failure, add to ignore list in pom.xml • @Deprecated then move to Legacy module using AspectJ • Use @Unstable + @Since for young APIs • Custom checkstyle check in build to prevent @Unstable from staying more than 1 cycle • {{backwardCompatibility}} xwiki macro in release notes Source: http://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices#HBackwardCompatibility
  • 18. Code Quality Checks • Checkstyle with custom rules. For example • Verify that Script Services are not located in the internal package • Verify that @since javadoc tags have the correct format • Verify that @Unstable annotation don't stay too long • Verify that components.txt contains all Components • Verify that JUnit tests don't output content to stdout or stderr.  • Verify header licenses • And more…
  • 19. Best Practices Checks • Spoon checks • Verify none of the listed methods are called in our Java code • File#deleteOnExit() - Causes memory leaks since not guaranteed to be called. Not good with server software. • URL#equals() -Very slow, access the host with HTTP calls • Verify that we don't use Commons Lang < 3 (i.e. that commons- lang:commons-lang artifact is forbidden) • Verify we don't use Commons Logging or Log4j (since we use SLF4J) • And a lot more…
  • 20. Test Coverage Checks - Local • Using Jacoco and Clover • Strategy - “Ratchet effect”: • Each Maven module has a threshold • Jacoco Maven plugin fails if new code has less coverage than before in % • Dev is allowed to increase threshold • Global Coverage addressed in CI (see later)
  • 21. Test Quality Checks • Using PIT/Descartes Maven plugin • Concepts of PIT • Modify code under test (mutants) and run tests • Good tests kill mutants • Generates a mutation score similar to the coverage % • Descartes = extreme mutations that execute fast and have high values
  • 22. Mutation - Example result =    (getId() == macroId.getId() || (getId() != null && getId().equals(macroId.getId())))    && (getSyntax() == macroId.getSyntax() || (getSyntax() != null && getSyntax().equals(     macroId.getSyntax())));
  • 23. Mutation Example @Test public void testEquality() {     MacroId id1 = new MacroId("id", Syntax.XWIKI_2_0);     MacroId id2 = new MacroId("id", Syntax.XWIKI_2_0);     MacroId id3 = new MacroId("otherid", Syntax.XWIKI_2_0);     MacroId id4 = new MacroId("id", Syntax.XHTML_1_0);     MacroId id5 = new MacroId("otherid", Syntax.XHTML_1_0);     MacroId id6 = new MacroId("id");     MacroId id7 = new MacroId("id");     Assert.assertEquals(id2, id1);    // Equal objects must have equal hashcode    Assert.assertTrue(id1.hashCode() == id2.hashCode());     Assert.assertFalse(id3 == id1);     Assert.assertFalse(id4 == id1);     Assert.assertFalse(id5 == id3);     Assert.assertFalse(id6 == id1);     Assert.assertEquals(id7, id6);    // Equal objects must have equal hashcode    Assert.assertTrue(id6.hashCode() == id7.hashCode()); } Not testing for inequality! Improved thanks to Descartes!
  • 24. Mutation Limitations • Takes time to find interesting things to look at and decide if that’s an issue to handle or not. Need better categorisation in report (now reported by Descartes): • Strong pseudo-tested methods:The worst! No matter what the return values are the tests always fail • Pseudo-tested methods: Grey area.The tests pass with at least one modified value. • Multi module support - PITmp • But slow on large projects (e.g. 7+ hours just for xwiki-rendering)
  • 25. Test Quality Checks - Strategy • Fail the build when the mutation score of a given module is below a defined threshold in the pom.xml • The idea is that new tests should, in average, be of quality equal or better General goal with coverage + mutation: maintain qualitythan past tests. • Other idea: hook on CI to run it only on modified code/tests. • Still some hiccups regarding the mutation score stability! General goal with coverage + mutation: maintain quality
  • 26. Agenda • Part 0: XWiki • The project • Part 1:The XWiki Build • Automated quality checks • Different types of tests • Part 2: The CI (Jenkins) • The various XWiki pipelines • Part 3: Release Process • Putting it all together • Future
  • 27. XWiki’s CI - Jenkins • XWiki Jobs are Pipeline jobs • Using “GitHub Organization” type of jobs • Autodiscovering of all Jenkinsfile in a GitHub organization • Automatic handling of branches (job creation/deletion) • Shared Pipeline library for all jobs • Clover Pipeline job to compute global TPC • Docker Pipeline jobs for running Docker-based tests on all configurations • Moving to Docker agent and DOOD (Docker Out of Docker)
  • 28. Shared Pipeline Library • Features • Maven build • Check for flickers both environment flickers and test flickers and don’t send false positives emails in this case. Examples of environment flickers: • JVM crash • GitHub connection issue • X Display not ready for UI tests • Uses JIRA to log test flickers • Display screenshot of failing test in job report
  • 29. Standard Pipeline Jobs • 1 job = several builds (13+ in our case) • Validates different things: • “Main”: compile and test execution including functional tests • “Quality”: Revapi checks, checkstyle, Descartes, Jacoco • “TestRelease”: Simulate a release.Verifies Maven Central requirements (javadoc, etc) • “Flavor*”:Various types of functional tests • Parallel execution for some jobs
  • 30. Clover Pipeline • Issue: Local coverage can increase and global decrease • Removed code with high TPC • Code tested indirectly by functional tests and code refactoring led to different paths used • New module with lower TPC than average • Strategy: Fail the CI build if Global TPC decreases for the current version
  • 31. Docker Pipeline Jobs • Currently a separate pipeline from the main one • Two issues • Requires Jenkins Docker agent to be used (Docker doesn’t work inside vServer that we use). Migration in progress. • Long to execute since it tests all configurations and thus should only be executed once per day. • Finds all Docker test modules and run Maven on each of them, passing the configuration as system properties.
  • 32. DOOD • Jenkins agent running as a Docker container • Pipeline (and thus Maven) executing inside Docker • Thus Functional tests based on Docker executing inside Docker • To make it work: • Mount Docker socket (only Docker client inside Docker) • Don’t mount volumes: copy data (in and out) • Requires special care when writing the JUnit5 Test Container extension
  • 33. Jenkins Docker Cloud Configuration • 3 volumes: • Docker socket • Maven settings.xml since it contains passwords • SSH keys (private data)
  • 35. Agenda • Part 0: XWiki • The project • Part 1:The XWiki Build • Automated quality checks • Different types of tests • Part 2:The CI (Jenkins) • The various XWiki pipelines • Part 3: Release Process • Putting it all together • Future
  • 36. Release Process • Ongoing Release Notes and reference documentation • Marked in JIRA with 2 custom fields • Rolling Release Managers Source: http://dev.xwiki.org/xwiki/bin/view/ReleasePlans/ • Create Release Plan for the release
  • 37. Release Plans (1/2) Source: http://dev.xwiki.org/xwiki/bin/view/ReleasePlans/
  • 38. Release Plans (2/2) • Release in JIRA • Check that all issues are documented • Check Release Notes • Import translations • Build the Release • Create mail announcement • Push to Maven Central • Update Docker official image • etc Source: http://dev.xwiki.org/xwiki/bin/view/ReleasePlans/ReleasePlan845
  • 39. Agenda • Part 0: XWiki • The project • Part 1:The XWiki Build • Automated quality checks • Different types of tests • Part 2:The CI (Jenkins) • The various XWiki pipelines • Part 3: Release Process • Putting it all together • Future
  • 40. Future - Build Level • Move Test configurations to the build • Fix UI flickerings which are a plague • Idea: Change our DSL so that all calls always wait on something
  • 41. Future - CI Level • Docker pipeline integrated into main Pipeline library • To handle branches (a pain right now) • Needs Parametrized Scheduler Plugin • Move to CD, i.e. implement the release steps in the CI • Need to resolve Maven versions and put on staging & promote when we want • Auto deploy on myxwiki.org • STAMP: DSpot on diffs, Evocrash (JIRA -> CI)