19 Custom module
Software Factory Engineer · beyond this factoryAcademy CRM Factory: two modules the course project does not have.
I want to add a module that no stack template fits, with its own commands and dev image.
Custom module
Concepts
A module is one buildable part of the code, in its own repository.
- Module type — what the module is. Documentation holds documents. Generic is any stack: it declares no Framework and no Package manager.
- Template — the starting code of a module in the new-project wizard: For documents, Any stack, or a stack such as React.
- Commands — the shell lines Swifter and the agent run in a module, such as install or test. A generic module runs only the ones you add.
- Image — the Dockerfile of the project's Dev environment. Every session runs in it, with the tools of all modules.
What a custom module needs
- Moduleone buildable part in its own repository
- Module typeDocumentation, or Generic: no framework, no package manager
- Commandthe shell lines run in the module
- Imagethe Dockerfile every session runs in
Figure 19.1 · What a custom module needs
Scenario
You add two modules to the factory, give the generic one a test command and its tools in the image, approve, and let the agent build the importer.
From a new module to its first merge
- Add two modules
- Command and image
- Approve
- Work item
Figure 19.2 · From a new module to its first merge
Interface
The Commands page of the project settings, with the importer module open and its new test command.
Commands page
Figure 19.3 · The Commands page and its numbered places
- 1Modules: the modules of the project; + adds one.
- 2Dev environment: the image and the commands.
- 3Review & approve: a draft becomes a new version.
- 4Image / Commands: the two pages of Dev environment.
- 5Module tabs: one set of commands per module.
- 6Command row: key, command line, description, timeout.
- 7Add command: a new row; the key comes from a list.
- 8Back to project: the work items, the chat and the Logs tab.
Walkthrough
Scene 1 of 8 · 0:22
Add the docs module
Where: Modules page: ① Modules · ② + · ③ web, docs, importer
The gear → Modules → + at the top right. Module name docs, Module type Documentation → Create new module. The list says one module is not saved yet: Save changes. A module is saved at once, with no draft to approve.
Terms
- Checkout — what a run gets of the module: the whole repository, or only the artifacts its work item resolved to.
- Timeout — how long a command may run before the dev environment stops it; empty means 10 minutes.
- Build & publish — builds the Dockerfile into the image the next sessions start from.
- $SWIFTER_MODULE_DIR — the module's folder, set for every command.