feat: add preflight hook to run commands before dip compose#188
Merged
Conversation
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.
Owner
|
Thanks for the PR! The feature is well implemented — clean code, good tests, and the One architectural concern: Preflight currently only runs in
I'd suggest moving preflight up to three entry points instead:
This avoids double execution while covering every code path cleanly. What do you think? |
- 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 ...`
f5bee18 to
88cf98e
Compare
Contributor
Author
|
addressed your feedback, good call! entry point for checking is a lot cleaner now. btw: thnx for this great tool! |
Owner
|
Looks good to me! Thank you! |
bibendi
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
preflight:key todip.yml— an array of shell commands run before anydip compose ...subcommand (includingdip up). A non-zero exit aborts before Docker Compose runs.provisionpattern: sequentialexec_subprocesscalls withpanic: true, env interpolation, default[].Example
Test plan
spec/lib/dip/commands/preflight_spec.rbcover no-op, sequential execution, and env interpolationconfig_spec.rbasserts thepreflightaccessor exists and defaults sanelypreflightis a typed array of strings inschema.json🤖 Generated with Claude Code