Skip to content

feat: add preflight hook to run commands before dip compose - #1

Merged
LeipeLeon merged 2 commits into
mainfrom
feature/add-preflight-checks
May 26, 2026
Merged

LeipeLeon merged 2 commits into
mainfrom
feature/add-preflight-checks

Conversation

@LeipeLeon

Copy link
Copy Markdown
Owner

Summary

  • Adds a new top-level preflight: key to dip.yml — an array of shell commands run before any dip compose ... subcommand (including dip up). Non-zero exit aborts before Docker Compose runs.
  • Mirrors the existing provision pattern: sequential exec_subprocess calls with panic: true, env interpolation, default [].
  • Drive-by: stubs $HOME in two ssh_spec contexts so they pass on developer machines (were assuming /root).

Example

preflight:
  - ./bin/check-credentials
  - test -f .env

Test plan

  • New specs: spec/lib/dip/commands/preflight_spec.rb covers no-op, sequential execution, and env interpolation
  • config_spec.rb now asserts the preflight accessor exists and defaults sanely
  • Full suite green locally: 162 examples, 0 failures
  • Smoke test in a real project: preflight: ["false"] aborts dip up; preflight: ["true"] proceeds; key absent → unchanged behavior

🤖 Generated with Claude Code

New top-level `preflight:` key in dip.yml — an array of shell commands run before any `dip compose ...` subcommand (including `dip up`). A non-zero exit aborts before docker ompose is invoked, making it suitable for verifying credentials, required files, env vars, etc.

Mirrors the existing `provision` pattern: sequential execution via `exec_subprocess` with `panic: true`, env interpolation, and `[]` as the default.
@LeipeLeon
LeipeLeon force-pushed the feature/add-preflight-checks branch from b096da1 to 647be30 Compare May 21, 2026 13:18
- Move the preflight call from `Commands::Compose#execute` to `Dip::CLI#compose`
  covers `dip compose`, `dip up`, `dip build`, `dip stop`, `dip down`
- Add to `Dip::CLI#ktl`
  covers `dip ktl`
- Add to Dip::Commands::Run#execute
  covers all runners `dip run ...`
@LeipeLeon
LeipeLeon force-pushed the feature/add-preflight-checks branch from f5bee18 to 88cf98e Compare May 22, 2026 08:54
@LeipeLeon
LeipeLeon merged commit 6fb50ca into main May 26, 2026
9 checks passed
@LeipeLeon
LeipeLeon deleted the feature/add-preflight-checks branch May 26, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant