We've identified that there are a lot of nplicated effort on each of the addons n'Apps team is owning.
The big picture is more or less the same: a project that contributes to Nuxeo Platform (backend) and to Nuxeo Web UI (frontend).
Currently we maintain the same code on each repository which will soon become a nightmare for maintainability and scalability.
Given that, we did some brain storming to identify which are the common steps, some improvements that can be done and how to tackle them.
The pipeline draft image explains in a little bit of detail what we would like to achieve. Generically:
- Load / Setting up stuff needed for the pipeline run (e.g. load common library scripts, define environment variables)
- Validate code by compiling, linting and running unit tests
- Package the addon
- Preview environment and functional validations (can be automated with functional tests or manual by developers, PO, QA)
- Publish (i.e. git commits, tags, connect, etc.)
We've also identified some points that can be polished for consistency and performance purposes. Some examples:
- Compile: can literally run mvn compile since it is the step purpose and will already include the UI contribution dependencies installation
- Linting: could be done as part of the Compile step but, for having more control and since it is specific to the UI contribution, it can leave outside
- Test: unit tests, both backend and frontend. (i.e. mvn test && npm run test)
Ideally on the backend we would tests against different databases (in memory, SQL, NoSQL). On the frontend we intent to use Playwright (already in place) to tests against Chromium, Firefox and Webkit.
- Packaging: literally mvn package, there is no need for cleaning or use other maven lifecycle for achieving the goal
- Publish: we need this to be configurable so we can have the possibility to publish to different instances (e.g. connect pre prod and/or connect prod)
How to do It
we can create a new file https://github.com/nuxeo/jx-napps-env/tree/master/ci/Jenkinsfiles/common-lib.groovy ( it will host all the shared code)
the content of https://github.com/nuxeo/nuxeo-retention/blob/master/ci/jenkinsfiles/common-lib.groovy for example will be: