IF Commons GitHub

logical/containerfile

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-lab-machine FR-002, 0002-lab-machine FR-003

A machine description read, and the Containerfile made from it: a release of Ubuntu with systemd as the first process, sshd as a service (not socket-activated, so that its port is the one it is given), the users with their home folders, the time zone, and the packages from the release's own archive. No key and no secret is in the file: keys are made for each run and put in when the machine starts.

import { containerfile, readMachineSpec } from "./containerfile.ts";
const spec = readMachineSpec({ name: "athens", image: "ubuntu:24.04", users: [{ name: "admin", sudo: true }], packages: [] });
spec.kind === "ok" && containerfile(spec.value).startsWith("FROM ubuntu:24.04"); // true

Source: commons/lab/src/logical/containerfile.ts

Mutation score of this file: 74.6% (50 of 197 changes to its code were not noticed by a test).

2 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.readMachineSpecfunctionno test imports it
function readMachineSpec(input: unknown): Result<MachineSpec, readonly string[]>

A machine description from data, or every reason it is not one: names that are lower case words, a base image there is, users that are account names, packages that are names of the archive, a time zone of the form area/location.

logical.containerfilefunctionno test imports it
function containerfile(spec: MachineSpec): string

The Containerfile of a machine: the same text for the same description, so that an image is made once and found again by the hash of its text. The RHEL family installs through a build secret ca where the builder has one (a network that inspects TLS: the certificate is read for the install and is in no layer). The lines differ by the family of the image (apt and ssh on Debian and Ubuntu, dnf and sshd on the RHEL family); the rest is the same.

readMachineSpecfunction
function readMachineSpec(input: unknown): Result<MachineSpec, readonly string[]>

A machine description from data, or every reason it is not one: names that are lower case words, a base image there is, users that are account names, packages that are names of the archive, a time zone of the form area/location.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

containerfilefunction
function containerfile(spec: MachineSpec): string

The Containerfile of a machine: the same text for the same description, so that an image is made once and found again by the hash of its text. The RHEL family installs through a build secret ca where the builder has one (a network that inspects TLS: the certificate is read for the install and is in no layer). The lines differ by the family of the image (apt and ssh on Debian and Ubuntu, dnf and sshd on the RHEL family); the rest is the same.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.