From 6a1cf4757e3f110b5325dbd53d5b64c038155b59 Mon Sep 17 00:00:00 2001 From: mikkeldamsgaard Date: Thu, 26 Feb 2026 19:18:12 +0100 Subject: [PATCH 1/2] fix: correct image size claims from ~1.8 MB to ~5 MB Measured from ghcr.io/kitstream/initium:latest (5,347,402 bytes). The binary has grown since the initial rewrite due to added features (database seeding, template filters, multi-driver support). Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d9343..2d2cebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,7 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Unit tests for seed schema parsing, database operations, executor logic, references, idempotency, reset, and edge cases ### Changed -- Complete rewrite from Go to Rust for ~76% smaller Docker images (7.4MB → 1.8MB) +- Complete rewrite from Go to Rust for smaller Docker images (7.4MB → ~5MB) - CLI framework changed from cobra to clap - Template engine changed from Go text/template to minijinja (Jinja2-style); access env vars via `{{ env.VAR }}` - CI/CD workflows updated for Rust toolchain (cargo test, clippy, rustfmt) diff --git a/README.md b/README.md index 4874ffb..5a0722c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Initium replaces fragile bash scripts in your initContainers with a single, secu ## Features - **Single static binary** — zero runtime dependencies, built `FROM scratch` -- **Tiny image** — ~1.8 MB multi-arch container (amd64 + arm64) +- **Tiny image** — ~5 MB multi-arch container (amd64 + arm64) - **Zero CVEs** — no OS packages, no shell, no attack surface - **PSA `restricted` compatible** — runs as non-root (UID 65534), read-only filesystem, all capabilities dropped - **Sidecar mode** — `--sidecar` flag keeps the process alive for use as a Kubernetes sidecar container @@ -332,7 +332,7 @@ Initium was built to address limitations in existing init container tools: | Tool | Language | Image size | Multi-tool | Database seeding | Security posture | | --------------------------------------------------------------------------- | -------- | ----------- | ---------- | ---------------- | ----------------------- | -| **Initium** | Rust | ~1.8 MB | Yes | Yes | PSA `restricted`, no OS | +| **Initium** | Rust | ~5 MB | Yes | Yes | PSA `restricted`, no OS | | [wait-for-it](https://github.com/vishnubob/wait-for-it) | Bash | Needs shell | No | No | Requires shell + netcat | | [dockerize](https://github.com/jwilder/dockerize) | Go | ~17 MB | Partial | No | Full OS image | | [k8s-wait-for](https://github.com/groundnuty/k8s-wait-for) | Bash | Needs shell | No | No | Requires shell + kubectl| From 8dafaeb043ec4ed7f3f9b2c9a16f3c0f601a9232 Mon Sep 17 00:00:00 2001 From: mikkeldamsgaard Date: Thu, 26 Feb 2026 19:27:02 +0100 Subject: [PATCH 2/2] docs: align all markdown table columns across documentation files Ensure all | characters in markdown tables are at consistent column offsets for improved source readability. Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 2 +- FAQ.md | 16 +++--- README.md | 22 ++++----- docs/seeding.md | 118 ++++++++++++++++++++++----------------------- docs/templating.md | 14 +++--- docs/usage.md | 94 ++++++++++++++++++------------------ tests/README.md | 38 +++++++-------- 7 files changed, 152 insertions(+), 152 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d2cebc..8f63292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,7 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Updated Dockerfiles (`Dockerfile`, `jyq.Dockerfile`) from `rust:1.85-alpine` to `rust:1.88-alpine` to fix release workflow failure caused by `time@0.3.47` requiring rustc 1.88.0 -- Aligned all markdown table columns across documentation files (`FAQ.md`, `README.md`, `docs/security.md`, `docs/seeding.md`, `docs/usage.md`) +- Aligned all markdown table columns across documentation files (`FAQ.md`, `README.md`, `docs/seeding.md`, `docs/templating.md`, `docs/usage.md`, `tests/README.md`) - Fixed clippy `collapsible_if` lint in seed executor's unique key check - Removed dead code: unused `src/cmd/seed.rs` module (replaced by `src/seed/`) - Suppressed unused field warning on `AutoIdConfig.id_type` (reserved for future use) diff --git a/FAQ.md b/FAQ.md index f98cf03..e31abc7 100644 --- a/FAQ.md +++ b/FAQ.md @@ -147,14 +147,14 @@ This is useful when you're shipping logs to a centralized system like Loki, Data All retry parameters are flags on the `wait-for` subcommand: -| Flag | Default | What it does | -| ------------------ | --------- | ------------------------------------------------------------------------ | -| `--max-attempts` | `60` | Total number of attempts before giving up | -| `--initial-delay` | `1s` | Delay after the first failure | -| `--max-delay` | `30s` | Upper bound on delay between retries | -| `--backoff-factor` | `2.0` | Multiplier applied to the delay after each attempt | -| `--jitter` | `0.1` | Random fraction (0.0–1.0) added to each delay to prevent thundering herd | -| `--timeout` | `5m` | Hard deadline across all targets | +| Flag | Default | What it does | +| ------------------ | ------- | ------------------------------------------------------------------------ | +| `--max-attempts` | `60` | Total number of attempts before giving up | +| `--initial-delay` | `1s` | Delay after the first failure | +| `--max-delay` | `30s` | Upper bound on delay between retries | +| `--backoff-factor` | `2.0` | Multiplier applied to the delay after each attempt | +| `--jitter` | `0.1` | Random fraction (0.0–1.0) added to each delay to prevent thundering herd | +| `--timeout` | `5m` | Hard deadline across all targets | Example — fast retries with low jitter: diff --git a/README.md b/README.md index 5a0722c..dad9161 100644 --- a/README.md +++ b/README.md @@ -106,10 +106,10 @@ cargo build --release --no-default-features --features postgres,sqlite cargo build --release --no-default-features --features sqlite ``` -| Feature | Default | Description | -| ---------- | ------- | ------------------ | -| `sqlite` | ✅ | SQLite driver | -| `postgres` | ✅ | PostgreSQL driver | +| Feature | Default | Description | +| ---------- | ------- | -------------------- | +| `sqlite` | ✅ | SQLite driver | +| `postgres` | ✅ | PostgreSQL driver | | `mysql` | ✅ | MySQL/MariaDB driver | ## Helm Chart @@ -330,13 +330,13 @@ helm install my-app charts/initium \ Initium was built to address limitations in existing init container tools: -| Tool | Language | Image size | Multi-tool | Database seeding | Security posture | -| --------------------------------------------------------------------------- | -------- | ----------- | ---------- | ---------------- | ----------------------- | -| **Initium** | Rust | ~5 MB | Yes | Yes | PSA `restricted`, no OS | -| [wait-for-it](https://github.com/vishnubob/wait-for-it) | Bash | Needs shell | No | No | Requires shell + netcat | -| [dockerize](https://github.com/jwilder/dockerize) | Go | ~17 MB | Partial | No | Full OS image | -| [k8s-wait-for](https://github.com/groundnuty/k8s-wait-for) | Bash | Needs shell | No | No | Requires shell + kubectl| -| [wait4x](https://github.com/atkrad/wait4x) | Go | ~12 MB | No | No | Minimal OS | +| Tool | Language | Image size | Multi-tool | Database seeding | Security posture | +| ---------------------------------------------------------- | -------- | ----------- | ---------- | ---------------- | ------------------------ | +| **Initium** | Rust | ~5 MB | Yes | Yes | PSA `restricted`, no OS | +| [wait-for-it](https://github.com/vishnubob/wait-for-it) | Bash | Needs shell | No | No | Requires shell + netcat | +| [dockerize](https://github.com/jwilder/dockerize) | Go | ~17 MB | Partial | No | Full OS image | +| [k8s-wait-for](https://github.com/groundnuty/k8s-wait-for) | Bash | Needs shell | No | No | Requires shell + kubectl | +| [wait4x](https://github.com/atkrad/wait4x) | Go | ~12 MB | No | No | Minimal OS | If you only need TCP/HTTP readiness checks, any of these tools work. Initium is designed for teams that also need migrations, seeding, config rendering, and secret fetching in a single security-hardened binary. diff --git a/docs/seeding.md b/docs/seeding.md index 881d34e..ed8f703 100644 --- a/docs/seeding.md +++ b/docs/seeding.md @@ -6,11 +6,11 @@ Seed spec files are MiniJinja templates: they are rendered with environment vari ## Supported Databases -| Driver | Connection URL format | -| ------------ | ------------------------------------------------ | -| `postgres` | `postgres://user:pass@host:5432/dbname` | -| `mysql` | `mysql://user:pass@host:3306/dbname` | -| `sqlite` | `/path/to/database.db` or `:memory:` for tests | +| Driver | Connection URL format | +| ---------- | ---------------------------------------------- | +| `postgres` | `postgres://user:pass@host:5432/dbname` | +| `mysql` | `mysql://user:pass@host:3306/dbname` | +| `sqlite` | `/path/to/database.db` or `:memory:` for tests | ## Quick Start @@ -65,47 +65,47 @@ phases: ### Field reference -| Field | Type | Required | Description | -| -------------------------------------------------- | ---------- | ---------- | ---------------------------------------------------------------- | -| `database.driver` | string | Yes | Database driver: `postgres`, `mysql`, or `sqlite` | -| `database.url` | string | No | Direct database connection URL | -| `database.url_env` | string | No | Environment variable containing the database URL | -| `database.tracking_table` | string | No | Name of the seed tracking table (default: `initium_seed`) | -| `phases[].name` | string | Yes | Unique phase name | -| `phases[].order` | integer | No | Execution order (lower first, default: 0) | -| `phases[].database` | string | No | Target database name (for create/switch) | -| `phases[].schema` | string | No | Target schema name (for create/switch) | -| `phases[].create_if_missing` | boolean | No | Create the database/schema if it does not exist (default: false) | -| `phases[].timeout` | string | No | Default wait timeout (e.g. `30s`, `1m`, `1m30s`; default: `30s`) | -| `phases[].wait_for[].type` | string | Yes | Object type: `table`, `view`, `schema`, or `database` | -| `phases[].wait_for[].name` | string | Yes | Object name to wait for | -| `phases[].wait_for[].timeout` | string | No | Per-object timeout override (e.g. `60s`, `2m`, `1m30s`) | -| `phases[].seed_sets[].name` | string | Yes | Unique name for the seed set (used in tracking) | -| `phases[].seed_sets[].order` | integer | No | Execution order (lower values first, default: 0) | -| `phases[].seed_sets[].tables[].table` | string | Yes | Target database table name | -| `phases[].seed_sets[].tables[].order` | integer | No | Execution order within the seed set (default: 0) | -| `phases[].seed_sets[].tables[].unique_key` | string[] | No | Columns for duplicate detection | -| `phases[].seed_sets[].tables[].auto_id.column` | string | No | Auto-generated ID column name | -| `phases[].seed_sets[].tables[].auto_id.id_type` | string | No | ID type (default: `integer`) | -| `phases[].seed_sets[].tables[].rows[]._ref` | string | No | Internal reference name for cross-table references | +| Field | Type | Required | Description | +| ----------------------------------------------- | -------- | -------- | ---------------------------------------------------------------- | +| `database.driver` | string | Yes | Database driver: `postgres`, `mysql`, or `sqlite` | +| `database.url` | string | No | Direct database connection URL | +| `database.url_env` | string | No | Environment variable containing the database URL | +| `database.tracking_table` | string | No | Name of the seed tracking table (default: `initium_seed`) | +| `phases[].name` | string | Yes | Unique phase name | +| `phases[].order` | integer | No | Execution order (lower first, default: 0) | +| `phases[].database` | string | No | Target database name (for create/switch) | +| `phases[].schema` | string | No | Target schema name (for create/switch) | +| `phases[].create_if_missing` | boolean | No | Create the database/schema if it does not exist (default: false) | +| `phases[].timeout` | string | No | Default wait timeout (e.g. `30s`, `1m`, `1m30s`; default: `30s`) | +| `phases[].wait_for[].type` | string | Yes | Object type: `table`, `view`, `schema`, or `database` | +| `phases[].wait_for[].name` | string | Yes | Object name to wait for | +| `phases[].wait_for[].timeout` | string | No | Per-object timeout override (e.g. `60s`, `2m`, `1m30s`) | +| `phases[].seed_sets[].name` | string | Yes | Unique name for the seed set (used in tracking) | +| `phases[].seed_sets[].order` | integer | No | Execution order (lower values first, default: 0) | +| `phases[].seed_sets[].tables[].table` | string | Yes | Target database table name | +| `phases[].seed_sets[].tables[].order` | integer | No | Execution order within the seed set (default: 0) | +| `phases[].seed_sets[].tables[].unique_key` | string[] | No | Columns for duplicate detection | +| `phases[].seed_sets[].tables[].auto_id.column` | string | No | Auto-generated ID column name | +| `phases[].seed_sets[].tables[].auto_id.id_type` | string | No | ID type (default: `integer`) | +| `phases[].seed_sets[].tables[].rows[]._ref` | string | No | Internal reference name for cross-table references | ### Wait-for object support by driver -| Object type | SQLite | PostgreSQL | MySQL | -| ------------- | -------- | ------------ | ------- | -| `table` | ✅ | ✅ | ✅ | -| `view` | ✅ | ✅ | ✅ | -| `schema` | ❌ | ✅ | ✅* | -| `database` | ❌ | ✅ | ✅* | +| Object type | SQLite | PostgreSQL | MySQL | +| ----------- | ------ | ---------- | ----- | +| `table` | ✅ | ✅ | ✅ | +| `view` | ✅ | ✅ | ✅ | +| `schema` | ❌ | ✅ | ✅* | +| `database` | ❌ | ✅ | ✅* | \* In MySQL, `schema` and `database` are synonymous. ### Create-if-missing support by driver -| Operation | SQLite | PostgreSQL | MySQL | -| ------------------- | -------- | ------------ | ------- | -| `CREATE DATABASE` | ❌ | ✅ | ✅ | -| `CREATE SCHEMA` | ❌ | ✅ | ✅* | +| Operation | SQLite | PostgreSQL | MySQL | +| ----------------- | ------ | ---------- | ----- | +| `CREATE DATABASE` | ❌ | ✅ | ✅ | +| `CREATE SCHEMA` | ❌ | ✅ | ✅* | \* In MySQL, `CREATE SCHEMA` maps to `CREATE DATABASE`. @@ -276,30 +276,30 @@ spec: ## CLI Reference -| Flag | Default | Description | -| ----------- | ------------ | --------------------------------------- | -| `--spec` | (required) | Path to seed spec file (YAML or JSON) | -| `--reset` | `false` | Delete existing data and re-apply seeds | -| `--json` | `false` | Enable JSON log output | +| Flag | Default | Description | +| --------- | ---------- | --------------------------------------- | +| `--spec` | (required) | Path to seed spec file (YAML or JSON) | +| `--reset` | `false` | Delete existing data and re-apply seeds | +| `--json` | `false` | Enable JSON log output | ## Failure Modes -| Scenario | Behavior | -| --------------------------------------- | -------------------------------------------------------- | -| Invalid spec file | Fails with parse error before connecting to database | -| Invalid MiniJinja template | Fails with template syntax error before parsing YAML | -| Database unreachable | Fails with connection error | -| Unsupported driver | Fails with descriptive error listing supported drivers | -| Missing env var for URL | Fails with error naming the missing variable | -| Missing env var in `$env:` | Fails with error naming the missing variable | -| Unresolved `@ref:` | Fails with error naming the missing reference | -| Row insertion failure | Entire seed set rolled back via transaction | -| Duplicate row (with unique_key) | Row silently skipped | -| Already-applied seed set | Seed set silently skipped | -| Wait-for object timeout | Fails with structured timeout error naming the object | -| Unsupported object type for driver | Fails immediately with driver-specific error | -| CREATE DATABASE on SQLite | Fails with "not supported" error | -| CREATE SCHEMA on SQLite | Fails with "not supported" error | +| Scenario | Behavior | +| ---------------------------------- | ------------------------------------------------------ | +| Invalid spec file | Fails with parse error before connecting to database | +| Invalid MiniJinja template | Fails with template syntax error before parsing YAML | +| Database unreachable | Fails with connection error | +| Unsupported driver | Fails with descriptive error listing supported drivers | +| Missing env var for URL | Fails with error naming the missing variable | +| Missing env var in `$env:` | Fails with error naming the missing variable | +| Unresolved `@ref:` | Fails with error naming the missing reference | +| Row insertion failure | Entire seed set rolled back via transaction | +| Duplicate row (with unique_key) | Row silently skipped | +| Already-applied seed set | Seed set silently skipped | +| Wait-for object timeout | Fails with structured timeout error naming the object | +| Unsupported object type for driver | Fails immediately with driver-specific error | +| CREATE DATABASE on SQLite | Fails with "not supported" error | +| CREATE SCHEMA on SQLite | Fails with "not supported" error | ## Examples diff --git a/docs/templating.md b/docs/templating.md index 607e38f..f67e682 100644 --- a/docs/templating.md +++ b/docs/templating.md @@ -15,8 +15,8 @@ Compute the SHA-256 hash of a string. **Parameters:** -| Parameter | Type | Default | Description | -| --------- | ------ | ------- | ---------------------------------------- | +| Parameter | Type | Default | Description | +| --------- | ------ | ------- | ----------------------------------- | | `mode` | string | `"hex"` | Output format: `"hex"` or `"bytes"` | **Modes:** @@ -94,8 +94,8 @@ decoded_cert: {{ env.B64_CERT | base64_decode }} ## Error Handling -| Error | Cause | -| -------------------------------- | --------------------------------------------------------- | -| `sha256: unsupported mode '…'` | Mode parameter is not `"hex"` or `"bytes"` | -| `base64_decode: invalid input` | Input string is not valid Base64 | -| `base64_decode: not valid UTF-8` | Decoded bytes are not a valid UTF-8 string | +| Error | Cause | +| -------------------------------- | ------------------------------------------ | +| `sha256: unsupported mode '…'` | Mode parameter is not `"hex"` or `"bytes"` | +| `base64_decode: invalid input` | Input string is not valid Base64 | +| `base64_decode: not valid UTF-8` | Decoded bytes are not a valid UTF-8 string | diff --git a/docs/usage.md b/docs/usage.md index 8b98028..55c8073 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -88,11 +88,11 @@ initium migrate --lock-file .migrated --workdir /work -- /app/migrate up **Flags:** -| Flag | Default | Env Var | Description | -| ------------- | --------- | -------------------- | ----------------------------------------------------------- | -| `--workdir` | `/work` | `INITIUM_WORKDIR` | Working directory for file operations | -| `--lock-file` | _(none)_ | `INITIUM_LOCK_FILE` | Skip migration if this file exists in workdir (idempotency) | -| `--json` | `false` | `INITIUM_JSON` | Enable JSON log output | +| Flag | Default | Env Var | Description | +| ------------- | -------- | ------------------- | ----------------------------------------------------------- | +| `--workdir` | `/work` | `INITIUM_WORKDIR` | Working directory for file operations | +| `--lock-file` | _(none)_ | `INITIUM_LOCK_FILE` | Skip migration if this file exists in workdir (idempotency) | +| `--json` | `false` | `INITIUM_JSON` | Enable JSON log output | **Behavior:** @@ -107,11 +107,11 @@ initium migrate --lock-file .migrated --workdir /work -- /app/migrate up **Exit codes:** -| Code | Meaning | -| ------ | ---------------------------------------------- | -| `0` | Migration succeeded (or skipped via lock file) | -| `1` | Migration command failed, or invalid arguments | -| _N_ | Forwarded from the migration command | +| Code | Meaning | +| ---- | ---------------------------------------------- | +| `0` | Migration succeeded (or skipped via lock file) | +| `1` | Migration command failed, or invalid arguments | +| _N_ | Forwarded from the migration command | ### seed @@ -134,11 +134,11 @@ initium seed --spec /seeds/seed.yaml --json **Flags:** -| Flag | Default | Env Var | Description | -| --------- | ------------ | ------------------ | --------------------------------------- | -| `--spec` | _(required)_ | `INITIUM_SPEC` | Path to seed spec file (YAML or JSON) | -| `--reset` | `false` | `INITIUM_RESET` | Delete existing data and re-apply seeds | -| `--json` | `false` | `INITIUM_JSON` | Enable JSON log output | +| Flag | Default | Env Var | Description | +| --------- | ------------ | --------------- | --------------------------------------- | +| `--spec` | _(required)_ | `INITIUM_SPEC` | Path to seed spec file (YAML or JSON) | +| `--reset` | `false` | `INITIUM_RESET` | Delete existing data and re-apply seeds | +| `--json` | `false` | `INITIUM_JSON` | Enable JSON log output | **Behavior:** @@ -156,10 +156,10 @@ initium seed --spec /seeds/seed.yaml --json **Exit codes:** -| Code | Meaning | -| ------ | --------------------------------------------------- | -| `0` | Seed plan applied successfully | -| `1` | Invalid spec, database error, or missing references | +| Code | Meaning | +| ---- | --------------------------------------------------- | +| `0` | Seed plan applied successfully | +| `1` | Invalid spec, database error, or missing references | See [seeding.md](seeding.md) for the full schema reference, features, and Kubernetes examples. @@ -190,20 +190,20 @@ initium render --template /tpl/db.conf.tmpl --output config/db.conf --workdir /w **Flags:** -| Flag | Default | Env Var | Description | -| ------------ | ------------ | ------------------- | ----------------------------------------- | -| `--template` | _(required)_ | `INITIUM_TEMPLATE` | Path to template file | -| `--output` | _(required)_ | `INITIUM_OUTPUT` | Output file path relative to workdir | -| `--workdir` | `/work` | `INITIUM_WORKDIR` | Working directory for output files | -| `--mode` | `envsubst` | `INITIUM_MODE` | Template mode: `envsubst` or `gotemplate` | -| `--json` | `false` | `INITIUM_JSON` | Enable JSON log output | +| Flag | Default | Env Var | Description | +| ------------ | ------------ | ------------------ | ----------------------------------------- | +| `--template` | _(required)_ | `INITIUM_TEMPLATE` | Path to template file | +| `--output` | _(required)_ | `INITIUM_OUTPUT` | Output file path relative to workdir | +| `--workdir` | `/work` | `INITIUM_WORKDIR` | Working directory for output files | +| `--mode` | `envsubst` | `INITIUM_MODE` | Template mode: `envsubst` or `gotemplate` | +| `--json` | `false` | `INITIUM_JSON` | Enable JSON log output | **Exit codes:** -| Code | Meaning | -| ------ | ----------------------------------------------------------------------------- | -| `0` | Render succeeded | -| `1` | Invalid arguments, missing template, template syntax error, or path traversal | +| Code | Meaning | +| ---- | ----------------------------------------------------------------------------- | +| `0` | Render succeeded | +| `1` | Invalid arguments, missing template, template syntax error, or path traversal | ### fetch @@ -260,10 +260,10 @@ initium fetch --url http://cdn/config --output config.json \ **Exit codes:** -| Code | Meaning | -| ------ | --------------------------------------------------------- | -| `0` | Fetch succeeded | -| `1` | Invalid arguments, HTTP error, timeout, or path traversal | +| Code | Meaning | +| ---- | --------------------------------------------------------- | +| `0` | Fetch succeeded | +| `1` | Invalid arguments, HTTP error, timeout, or path traversal | ### exec @@ -306,11 +306,11 @@ initium exec --workdir /certs -- openssl genrsa -out key.pem 4096 **Exit codes:** -| Code | Meaning | -| ------ | ------------------------------------ | -| `0` | Command succeeded | -| `1` | Command failed, or invalid arguments | -| _N_ | Forwarded from the command | +| Code | Meaning | +| ---- | ------------------------------------ | +| `0` | Command succeeded | +| `1` | Command failed, or invalid arguments | +| _N_ | Forwarded from the command | ## Building Custom Images with Initium @@ -364,10 +364,10 @@ initContainers: ## Global Flags -| Flag | Default | Env Var | Description | -| ----------- | ------- | ------------------ | ------------------------------------------------------------ | -| `--json` | `false` | `INITIUM_JSON` | Enable JSON-formatted log output | -| `--sidecar` | `false` | `INITIUM_SIDECAR` | Keep process alive after task completion (sidecar containers) | +| Flag | Default | Env Var | Description | +| ----------- | ------- | ----------------- | ------------------------------------------------------------- | +| `--json` | `false` | `INITIUM_JSON` | Enable JSON-formatted log output | +| `--sidecar` | `false` | `INITIUM_SIDECAR` | Keep process alive after task completion (sidecar containers) | All flags can be set via environment variables. Flag values take precedence over environment variables. Boolean env vars accept `true`/`false`, `1`/`0`, `yes`/`no`. The `INITIUM_TARGET` env var accepts comma-separated values for multiple targets. @@ -401,10 +401,10 @@ containers: ## Exit Codes -| Code | Meaning | -| ------ | --------------------------------------------------------- | -| `0` | Success | -| `1` | General error (invalid args, timeout, unreachable target) | +| Code | Meaning | +| ---- | --------------------------------------------------------- | +| `0` | Success | +| `1` | General error (invalid args, timeout, unreachable target) | ## Security Defaults diff --git a/tests/README.md b/tests/README.md index e94d32a..a66b6aa 100644 --- a/tests/README.md +++ b/tests/README.md @@ -25,25 +25,25 @@ docker compose -f tests/docker-compose.yml down ### Test scenarios -| Test | Description | -| ------------------------------------- | -------------------------------------------------------- | -| `test_waitfor_tcp_postgres` | wait-for TCP against Postgres succeeds | -| `test_waitfor_tcp_mysql` | wait-for TCP against MySQL succeeds | -| `test_waitfor_http_server` | wait-for HTTP against nginx returns 200 | -| `test_waitfor_nonexistent_service_timeout` | wait-for against closed port fails with exit code 1 | -| `test_waitfor_multiple_targets` | wait-for with Postgres + MySQL + HTTP all reachable | -| `test_render_template` | render envsubst template produces correct output | -| `test_fetch_from_http_server` | fetch from nginx writes HTML to file | -| `test_exec_command` | exec echo captures output in logs | -| `test_exec_failing_command` | exec false returns exit code 1 | -| `test_seed_postgres` | seed PostgreSQL with refs, idempotency, and reset | -| `test_seed_mysql` | seed MySQL with refs and idempotency | -| `test_seed_postgres_create_database` | seed creates a PostgreSQL database via create_if_missing | -| `test_seed_postgres_create_schema` | seed creates a PostgreSQL schema via create_if_missing | -| `test_seed_mysql_create_database` | seed creates a MySQL database via create_if_missing | -| `test_seed_postgres_create_nonexistent_db_alpha` | create-if-missing with known non-existing PG database | -| `test_seed_postgres_create_nonexistent_db_beta` | create-if-missing with second non-existing PG database + idempotency | -| `test_seed_mysql_create_nonexistent_db_alpha` | create-if-missing with known non-existing MySQL database | +| Test | Description | +| ------------------------------------------------ | ----------------------------------------------------------------------- | +| `test_waitfor_tcp_postgres` | wait-for TCP against Postgres succeeds | +| `test_waitfor_tcp_mysql` | wait-for TCP against MySQL succeeds | +| `test_waitfor_http_server` | wait-for HTTP against nginx returns 200 | +| `test_waitfor_nonexistent_service_timeout` | wait-for against closed port fails with exit code 1 | +| `test_waitfor_multiple_targets` | wait-for with Postgres + MySQL + HTTP all reachable | +| `test_render_template` | render envsubst template produces correct output | +| `test_fetch_from_http_server` | fetch from nginx writes HTML to file | +| `test_exec_command` | exec echo captures output in logs | +| `test_exec_failing_command` | exec false returns exit code 1 | +| `test_seed_postgres` | seed PostgreSQL with refs, idempotency, and reset | +| `test_seed_mysql` | seed MySQL with refs and idempotency | +| `test_seed_postgres_create_database` | seed creates a PostgreSQL database via create_if_missing | +| `test_seed_postgres_create_schema` | seed creates a PostgreSQL schema via create_if_missing | +| `test_seed_mysql_create_database` | seed creates a MySQL database via create_if_missing | +| `test_seed_postgres_create_nonexistent_db_alpha` | create-if-missing with known non-existing PG database | +| `test_seed_postgres_create_nonexistent_db_beta` | create-if-missing with second non-existing PG database + idempotency | +| `test_seed_mysql_create_nonexistent_db_alpha` | create-if-missing with known non-existing MySQL database | | `test_seed_mysql_create_nonexistent_db_beta` | create-if-missing with second non-existing MySQL database + idempotency | ### CI