Skip to main content
The ladder · Lesson 19

19 Custom module

Software Factory Engineer

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

Module
Module type
Command
Image
one buildable part in its own repository
Documentation, or Generic: no framework, no package manager
the shell lines run in the module
the Dockerfile every session runs in
  1. Module
    one buildable part in its own repository
  2. Module type
    Documentation, or Generic: no framework, no package manager
  3. Command
    the shell lines run in the module
  4. Image
    the 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
  1. Add two modules
  2. Command and image
  3. Approve
  4. 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.

Walkthrough​

Scene 1 of 8 · Add the docs moduleWatched 0%

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.