MantisBT

@webship.co/workspace-mantisbt 1.0.0 · github.com/webship/workspace-mantisbt · npm

MantisBT, the open-source issue tracker, for the Webship Workspace, a container-based workspace (DDEV by default). The plugin brings:

  • a builder, cmd-mantisbt-project.sh: a real MantisBT site from its release tarball on the Workspace's php stack (Apache, PHP 8.3) and the project's own MariaDB, installed by MantisBT's own installer, with the workspace account in the place of the administrator that installer starts with, the default accounts on MantisBT's access levels in a sample project, and its issues at points of the workflow, with notes, a file, a relationship and tags;
  • a tool, cmd-tools-mantisbt-cli.sh: what a site is, its counts and its accounts, the default accounts, the sample content, a clean-up after a stopped test run, and the dashboard's connection;
  • the step pack @webship-js/mantisbt-steps wired into the workspace's testing setup, with a first feature for a site;
  • the issues as work items of the tracker family (@webship.co/workspace-tracker): the MANTISBT menu on a project row lists them, reads one, analyzes it, and lets the workspace's AI CLI work it on a branch, with a person in charge;
  • AI items in their folders: three agents, a skill, a command and two prompts.

MantisBT's core only: the plugin installs none of its own plugins.

Install

From the workspace's root, the same four steps as Settings → Plugins:

bash core/scripts/plugins.sh --require @webship.co/workspace-mantisbt
bash core/scripts/plugins.sh --activate mantisbt --with-needs
bash core/scripts/plugins.sh --install mantisbt --with-needs
bash core/scripts/plugins.sh --configure mantisbt

What it needs

  • A sites folder: one of the dev, test, sandboxes or demos plugins. The commands are placed there.
  • The AI folders ai-agents, ai-skills, ai-commands and ai-prompts, where its AI items land.
  • A container runtime: DDEV (the default), Docker Compose, Podman or Kubernetes (--runtime). Lando and Docksal are not proven for it yet: asked for one, the builder says so and changes nothing.
  • A download of about 30 MB for MantisBT's release tarball with each build, and memory: the builder asks for 768 MB free before it starts (free -m).

Build a site

cd ~/workspace/sandboxes                      # or dev, test, demos
bash cmd-mantisbt-project.sh mysite --install --add-users --sample-content
Flag What it does
--install Puts the workspace account (account of core/config/settings.yml) in the place of the administrator MantisBT's installer starts with (administrator, password root), so no default password is left, and makes the project Webship site with its categories and versions
--add-users With --install: the default accounts, on their access levels in the project Webship site
--sample-content With --install --add-users: five issues of Webship site at points of the workflow, with notes, a file, a relationship and tags
--release <X.Y.Z> The release of MantisBT: 2.29.0 by default
--runtime <runtime> ddev (the default, or container.runtime of settings.yml), docker (Docker Compose), podman or kubernetes
--launch Open the site when it is ready

A project of the same name is deleted first, with its database and its files. On DDEV the site is a php project (Apache and PHP 8.3) on the project's own MariaDB 11.4, with MantisBT in web/, at https://mysite.ddev.site; the project's mail catcher, at https://mysite.ddev.site:8026, takes the site's mail. MantisBT's sign-up is turned off: an administrator makes the accounts.

Where MantisBT comes from. The builder downloads MantisBT's release tarball from MantisBT's own downloads on SourceForge, https://sourceforge.net/projects/mantisbt/files/mantis-stable/ (<release>/mantisbt-<release>.tar.gz), with curl --retry 5 --retry-all-errors, and checks its SHA-256 before anything is unpacked: the default release's is in the plugin, and another release's comes from the .digests file MantisBT publishes beside its tarball. A tarball that is not the one its digest says is removed, and nothing is unpacked.

Download What it is Source and licence
mantis-stable/2.29.0/mantisbt-2.29.0.tar.gz MantisBT 2.29.0: its PHP code and the libraries it ships (--release picks another) mantisbt/mantisbt, GPL-2.0

How it is installed. MantisBT's own installer, the way MantisBT's own CI runs it: a POST to admin/install.php in the web container makes the schema in the project's database and writes web/config/config_inc.php. The builder then adds the site's address (MantisBT builds its links from it), turns sign-up off and gives the site's mail example addresses. Then the admin/ folder is removed: an installed site needs it no more, and MantisBT warns while it is there. Nothing of the plugin unpacks MantisBT again or writes admin/ back, and a build from nothing removes it again.

The database is MariaDB. MantisBT speaks MySQL, MariaDB and PostgreSQL; the Workspace uses MariaDB 11.4, so a site's database is the same on every runtime the Workspace has.

The files of issues live in the database. MantisBT keeps the files of issues in its database (its default): the database holds the whole site, so the row's Backup and Import carry the files with everything else, and there is no files folder to copy.

How the accounts are made. The builder's site script runs in the web container on MantisBT's own code (its commands and APIs: mantisbt/mantisbt-site.php of the project) and makes the accounts as MantisBT's own forms would, a password hashed by MantisBT. The passwords come on the script's input, never on a command line, never in a log. MantisBT refuses an account an address of its list of disposable domains, which has example.com: the default accounts are @example.org.

The site's own values (its release and its address) are kept in mantisbt/env of the project, which only you can read, and MantisBT's (its database and its secret) in web/config/config_inc.php. The builder never prints them.

Failed logins. MantisBT locks an account after 5 wrong passwords in a row, and a new password alone does not unlock it. --add-users gives the default accounts back their values, unlocked. A test suite tries one wrong password at a time.

On Docker Compose, Podman and Kubernetes

bash cmd-mantisbt-project.sh mysite --install --add-users --sample-content --runtime docker   # or podman, kubernetes

The builder works through the Workspace's runtime layer there, and the site is the same: MantisBT 2.29.0 on the php stack (Apache and PHP 8.3) and the project's own MariaDB 11.4, the same accounts and the same sample content, at the address the runtime gives it (http://127.0.0.1:<port>, or the node's address and a NodePort on Kubernetes). The stack's Mailpit catches its mail. MantisBT's installer, the site script and its checks run in the web container, which answers on its own port inside too, so MantisBT's links work from there as they do from the browser.

The default accounts

Account Real name Its access level, on the site and in Webship site
manager Manager Test Manager: the project, its people and its versions
developer Developer Test Developer: is given issues, changes their status, resolves and closes them
updater Updater Test Updater: edits an issue and relates it to others
reporter Reporter Test Reporter: reports issues, adds notes, tags and files, and monitors
viewer Viewer Test Viewer: reads, and changes nothing

Each has the password of the workspace's other default lists, dD.123123ddd, and logs in with its username; the site shows the username unless it is set to show real names. They are configuration: a test suite never creates or deletes one. bash cmd-tools-add-users.sh mysite mantisbt and bash cmd-tools-cancel-users.sh mysite mantisbt (the row's Tests menu) add them and keep them from logging in.

The sample content

Webship site, with the categories Interface and Back end (and MantisBT's General), the version 1.0 (released) and 1.1: "The login page does not keep the username" (#1, by reporter, in Interface, tagged login, assigned to developer, with developer's note, targeting 1.1), "Exported reports have no date" (#2, by updater, in Back end, tagged export, acknowledged), "Attachments larger than 2 MB fail" (#3, by reporter, in Back end, with the file upload-error.txt and notes of developer and reporter, resolved as fixed in 1.0), "The upload error page has no way back" (#4, by manager, related to #3, closed as fixed in 1.0) and "A typo in the welcome mail" (#5, by reporter, in General, new). The builder makes them with MantisBT's own commands, as their reporters.

The tool

bash cmd-tools-mantisbt-cli.sh mysite                                 # what the site is: release, address, counts, accounts
bash cmd-tools-mantisbt-cli.sh mysite --sample-content                # the sample issues, when the project has none
bash cmd-tools-mantisbt-cli.sh mysite --tidy                          # what a stopped test run left
bash cmd-tools-mantisbt-cli.sh mysite --add-users                     # the default accounts, their values back, unlocked
bash cmd-tools-mantisbt-cli.sh mysite --cancel-users                  # keep them from logging in
bash cmd-tools-mantisbt-cli.sh mysite --connect developer             # the dashboard reads this site as developer

--connect <login> makes a new API token of the account with MantisBT's own code (named "Webship Workspace", in the place of its earlier one of that name, as My Account → API Tokens does), and writes it, with the account's username and the site's address, into core/config/plugin.mantisbt.settings.yml, and the sample project as the default one when none was set. The token is never shown. The dashboard then acts as that person.

--tidy deletes for good, with no way back. It removes the issues a stopped test run left, titled "Webship test …", by MantisBT's own removal, with their notes, files, relationships and history, and the tags titled "webship-test…" or "Webship test…" that no issue has (MantisBT keeps a tag a test made). An issue with another summary ("Webship testing plan") stays, and so does everything else.

The issues as work items

The plugin is a provider of the tracker family. With a MantisBT address and an API token in its settings (--connect writes them for a site the workspace built; for your own MantisBT, My Account → API Tokens), the project rows of sites and code folders carry the MANTISBT menu, once they have a MantisBT project to work against (default_scope as the project's name, Webship site, or one remembered from the list):

  • The list: the open issues (neither resolved nor closed), mine, assigned to someone, and a search in the summary and the description. An issue's state is its status (new, feedback, acknowledged, confirmed, assigned, resolved, closed by default). MantisBT has no sprint: there is no iteration view.
  • One issue (#12, 12 or 0000012: a number the whole site shares): its description with its steps to reproduce and additional information, its reporter with their standing, its tags and its notes.
  • Analyze: the AI CLI reads it and proposes a plan, with reading tools only.
  • Do the work: the AI CLI works it on a new branch of the project (or a worktree), made from the default branch of the project's remote, in a screen session you watch. The issue is saved as data, never as instructions; MantisBT keeps the text as it was written, and raw HTML in it stays as it was written.
  • Result: the branch, its commits and the notes, the reviewer role, and the note to post.
  • With writes on (allow_writes: true): a note, a status (resolved and closed with the resolution fixed), tags (MantisBT makes a tag that is not there yet), an assignee (me, or one of the project's developers and above, by username or real name) and a new issue (in the category General), each your click after a preview. MantisBT keeps a resolved or closed issue read-only below a manager (its own rule): a write to one is refused by MantisBT, and the dashboard says so as MantisBT gave it.

Who is inside. Each person's standing is their access level in the project: its managers and administrators are owners of it, its developers and updaters members. A reporter or a viewer, who may be anyone who reports, is outside. An issue reported, or last noted, by someone outside is analyze only unless you confirm it by its author's name (outsider_items: refuse refuses it), and each note's author counts on their own.

The last editor is the author of the issue's newest note who is not its reporter.

Credentials. The token travels in a file only you can read, never on a command line. Before anything is posted, the text is checked for credentials: the ones the tracker family knows, the token of the settings, and anything shaped like a MantisBT API token (32 letters, digits, "-" and "_").

MantisBT opens no pull request: push the branch and open its pull request from the project's forge menu (GITHUB, GITLAB) when its remote is on a forge.

Settings

core/config/plugin.mantisbt.settings.yml (Settings → Plugins → MantisBT):

Key What it is
url The MantisBT address, without a trailing slash
username The username of the account the dashboard reads (and, with writes on, writes) as
token The API token of that account. Never printed
allow_writes Notes, statuses, tags, assignees and new issues to MantisBT; false by default
max_agents Author sessions at once
default_scope The MantisBT project a workspace project works against when it remembers none: its name, Webship site
scopes The MantisBT projects (their names) the list may be switched to; empty is any project the account can open
work_in branch (a new branch in the project) or worktree (outside the workspace folders)
sandbox required (the AI CLI's sandbox, and no session without it) or off (a person's choice)
network_domains The domains the sandbox allows (the project's package registries)
allow_web Web fetch and web search in the author session
comments_from The notes a saved issue keeps: members (the project's managers, developers and updaters), all, none
outsider_items An issue from outside the project: analyze (work it only after a confirmation by name) or refuse

Testing a site

bash cmd-tools-testing.sh mysite                       # webship-js, the step pack, the users registry, a first feature
bash cmd-tools-testing.sh mysite --run

The testing setup adds @webship-js/mantisbt-steps to the project, its step definitions to cucumber.js, the managing account (manager, which makes and removes the test content through the site's own REST API), the project of the steps (Webship site), the users registry (manager, developer, updater, reporter, viewer, each logging in with its username), and tests/features/site.feature, whose first scenario checks the site opens on its login page. The suite leaves the site as it found it.

AI items

Kind Item What it is for
Agent mantisbt-site-builder Build, look after and remove MantisBT sites
Agent mantisbt-tester Test a site with the step pack: look at the screens first, write scenarios, run, read
Agent mantisbt-issue-worker Work an issue on a branch, the writes left to a person
Skill mantisbt-scenarios The pack's phrases by area, the traps found on real sites, whole features
Command /mantisbt-test <site> Set the testing stack up, run the suite, report
Prompt mantisbt-build-and-test Build a site and prove it with its first feature
Prompt mantisbt-issue-to-branch Work an issue on a branch

License

ISC (see LICENSE). MantisBT itself is GPL-2.0: the plugin downloads MantisBT's own release and carries none of its code. MantisBT's repository's tests were read for their flows only.