feat(compose): add podman compose detection path#274
Conversation
NewComposeHelper now detects podman compose as a third option between Docker Compose V2 and V1. This enables compose workflows on systems where only Podman is installed.
✅ Deploy Preview for devsydev canceled.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR extends the compose helper to detect and use Podman Compose as an alternative to Docker Compose. A new ChangesPodman Compose Support
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Use parsed semver string for ComposeHelper.Version instead of raw stdout that may contain Podman warning prefixes. Fix broken path assertion in TestComposeHelperBuildCmdPodman to use HasSuffix check.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pkg/compose/helper_test.go (1)
152-158: ⚡ Quick winAssert command arg order, not only presence.
Containscan pass even if ordering regresses. For command construction contracts, an exact ordered assertion is more robust.Suggested test tightening
cmd := helper.buildCmd(context.TODO(), "--project-name", "test", "up", "-d") s.True(strings.HasSuffix(cmd.Path, "podman")) - s.Contains(cmd.Args, "compose") - s.Contains(cmd.Args, "--project-name") - s.Contains(cmd.Args, "test") - s.Contains(cmd.Args, "up") - s.Contains(cmd.Args, "-d") + s.Equal([]string{ + cmd.Path, "compose", "--project-name", "test", "up", "-d", + }, cmd.Args)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/compose/helper_test.go` around lines 152 - 158, The test currently only checks presence of args using s.Contains which doesn't enforce ordering; update the assertion for helper.buildCmd (the cmd returned by helper.buildCmd) to assert the exact ordered arguments instead of membership—e.g., build the expected slice of args (including "compose", "--project-name", "test", "up", "-d") and use an equality/assert-equal on cmd.Args (or compare strings.Join(cmd.Args, " ") to an expected string) so the test fails if the argument order regresses.pkg/compose/helper.go (1)
134-136: ⚡ Quick winRemove redundant
podman composeprecheck in favor of theversioncheck below.This initial validation is unnecessary since the
version --shortcheck that follows already confirmspodman composeavailability. Consolidating to a single, explicit probe simplifies the code.Suggested change
- if exec.Command("podman", "compose").Run() != nil { - return nil, fmt.Errorf("podman compose not available") - } - cmd := exec.Command("podman", "compose", "version", "--short") out, stderr, err := runCmdCapture(cmd)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/compose/helper.go` around lines 134 - 136, Remove the redundant precheck that runs exec.Command("podman", "compose").Run() and returns an error; instead rely on the existing "podman compose version --short" probe later in the same helper so availability is checked only once. Locate and delete the if block containing exec.Command("podman", "compose").Run() (the conditional that returns fmt.Errorf("podman compose not available")), leaving the subsequent version check intact and ensuring no other logic depends on that early return.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/compose/helper_test.go`:
- Around line 152-158: The test currently only checks presence of args using
s.Contains which doesn't enforce ordering; update the assertion for
helper.buildCmd (the cmd returned by helper.buildCmd) to assert the exact
ordered arguments instead of membership—e.g., build the expected slice of args
(including "compose", "--project-name", "test", "up", "-d") and use an
equality/assert-equal on cmd.Args (or compare strings.Join(cmd.Args, " ") to an
expected string) so the test fails if the argument order regresses.
In `@pkg/compose/helper.go`:
- Around line 134-136: Remove the redundant precheck that runs
exec.Command("podman", "compose").Run() and returns an error; instead rely on
the existing "podman compose version --short" probe later in the same helper so
availability is checked only once. Locate and delete the if block containing
exec.Command("podman", "compose").Run() (the conditional that returns
fmt.Errorf("podman compose not available")), leaving the subsequent version
check intact and ensuring no other logic depends on that early return.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1be4b796-a231-4602-9907-5cbc4c848c1c
📒 Files selected for processing (2)
pkg/compose/helper.gopkg/compose/helper_test.go
Add podmanCmd and composeArg constants in helper.go, and test-scoped constants in helper_test.go to eliminate repeated string literals flagged by golangci-lint.
Summary
tryPodmanCompose()detection path toNewComposeHelper()so Podman's built-in compose subcommand is discovered alongside Docker Compose V2 and V1Summary by CodeRabbit
New Features
Bug Fixes