Skip to content

run.sh: run playbooks in the seed container#596

Open
ideaship wants to merge 4 commits into
mainfrom
run-sh-seed-container
Open

run.sh: run playbooks in the seed container#596
ideaship wants to merge 4 commits into
mainfrom
run-sh-seed-container

Conversation

@ideaship

@ideaship ideaship commented Jun 18, 2026

Copy link
Copy Markdown

What

Add an optional seed-container execution path to the manager
environments/manager/run.sh, so playbooks can run inside the
osism/seed container instead of the local venv. Behaviour is selected
by a SEED_CONTAINER tri-state flag:

  • auto (default) — run in the container when a container engine is up,
    otherwise fall back to the existing local venv path
  • true — force the container (fail fast if the engine is missing)
  • false — force the local venv path

The container branch assembles the engine command from
SEED_CONTAINER_REGISTRY/IMAGE:TAG (an empty registry drops the leading
segment), honours SEED_CONTAINER_PULL and SEED_CONTAINER_MOUNT_OPTS,
forwards selected ANSIBLE_* / MANAGER_VERSION variables only when
set, and defaults ANSIBLE_VAULT_PASSWORD_FILE to the repo's
.vault_pass when the caller did not set it.

Tests & CI

  • src/test-seed.sh — a command-assembly test harness that points
    CONTAINER_ENGINE at a recording stub and asserts the exact argv
    run.sh would have executed. No container engine or image required.
    Covers mode decision, image-reference assembly, env forwarding, vault
    defaulting, and the pull/mount knobs (45 cases).
  • A new tox -e seed environment runs the harness.
  • A new cfg-generics-tox-seed Zuul job runs it in the check and
    periodic-daily pipelines.

Related

🤖 Generated with Claude Code

ideaship added 3 commits June 18, 2026 21:07
Add a seed-container execution path to run.sh, selected by a
SEED_CONTAINER tri-state flag. By default (auto) the playbook runs
inside the osism/seed container whenever a container engine is up,
falling back to the existing local venv path otherwise; true forces
the container (failing fast if the engine command is missing) and
false forces the local path. An invalid value fails fast.

The container branch assembles the engine command from
SEED_CONTAINER_REGISTRY/IMAGE:TAG (an empty registry drops the leading
segment), honours SEED_CONTAINER_PULL and SEED_CONTAINER_MOUNT_OPTS,
forwards the selected ANSIBLE_* and MANAGER_VERSION variables only when
set, and defaults ANSIBLE_VAULT_PASSWORD_FILE to the repo's .vault_pass
when the caller did not set it. It then execs the engine, never reaching
the local preamble.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Roger Luethi <luethi@osism.tech>
Add src/test-seed.sh, a command-assembly test harness for the
seed-container path of run.sh. No container engine or image is needed:
CONTAINER_ENGINE is pointed at a recording stub that prints its run argv
so each test can assert exactly what run.sh would have executed. The stub
answers an info subcommand with ${STUB_INFO_RC:-0} so the auto-mode
engine probe is testable, and stdin is redirected from /dev/null so the
interactive-TTY check is reliably false in CI.

Cases cover the mode decision (auto/true/false and invalid values),
image-reference assembly, environment forwarding, vault defaulting, and
the pull and mount-option knobs.

Wire the harness into tox as a new seed environment that runs
bash src/test-seed.sh.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Roger Luethi <luethi@osism.tech>
Add a cfg-generics-tox-seed job that runs the tox seed environment, and
add it to the check and periodic-daily pipelines so the seed-container
command-assembly tests gate every change alongside the existing tox jobs.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Roger Luethi <luethi@osism.tech>
The check-shell-syntax Zuul job failed on src/test-seed.sh: shellcheck
flagged twelve SC2015 findings ("Note that A && B || C is not
if-then-else. C may run when A is true.") and exits non-zero on any
finding, failing the job.

Every flagged line uses the `cond && ok || ko "..."` assertion idiom.
This is safe here: `ok` is a plain arithmetic assignment that always
returns 0, so the `ko` branch runs only when `cond` is false. The
failure mode SC2015 warns about -- C running because B failed while A
was true -- cannot occur, making the findings false positives.

Add a file-level `# shellcheck disable=SC2015` directive, preceded by a
comment explaining why the idiom is correct, rather than rewriting the
concise one-line assertions as if/then/else blocks. shellcheck now exits
0 and the suite still reports PASS=45 FAIL=0.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Roger Luethi <luethi@osism.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

2 participants