Skip to content

feat(compose): add podman compose detection path#274

Merged
skevetter merged 3 commits into
mainfrom
2a7d-20db-podman-compose-detect
May 13, 2026
Merged

feat(compose): add podman compose detection path#274
skevetter merged 3 commits into
mainfrom
2a7d-20db-podman-compose-detect

Conversation

@skevetter

@skevetter skevetter commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add tryPodmanCompose() detection path to NewComposeHelper() so Podman's built-in compose subcommand is discovered alongside Docker Compose V2 and V1
  • Detection order: Docker Compose V2 → Podman Compose → Docker Compose V1, preserving backward compatibility
  • Handles Podman's external compose provider warnings in version parsing
  • Adds unit tests covering version parsing (standard, v-prefix, python variant, trailing newline, external provider warning), field validation, and command building for Podman compose

Summary by CodeRabbit

  • New Features

    • Added support for Podman Compose with automatic detection and configuration
  • Bug Fixes

    • Updated error messages to include references to both Docker and Podman Compose options

Review Change Stack

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.
@netlify

netlify Bot commented May 13, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 5aee806
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a04d81550b7a20008a1d689

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@skevetter has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 28 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05490832-c241-4f49-b77a-86a1e388df63

📥 Commits

Reviewing files that changed from the base of the PR and between 839736b and 5aee806.

📒 Files selected for processing (2)
  • pkg/compose/helper.go
  • pkg/compose/helper_test.go
📝 Walkthrough

Walkthrough

This PR extends the compose helper to detect and use Podman Compose as an alternative to Docker Compose. A new tryPodmanCompose() function validates podman availability, verifies the compose subcommand works, and parses version output. Detection now tries Podman Compose between Docker Compose V2 and V1, with updated error messaging. Test coverage validates version parsing across multiple output formats and confirms correct field/command construction.

Changes

Podman Compose Support

Layer / File(s) Summary
Podman Compose detection implementation
pkg/compose/helper.go
NewComposeHelper adds tryPodmanCompose() invocation between Docker Compose V2 and V1 detection checks. New tryPodmanCompose() validates podman in PATH, runs podman compose --version, captures and logs output, parses version, and returns ComposeHelper configured for podman command with ["compose"] args. Error message expanded to mention both Docker Compose and Podman Compose.
Podman Compose test coverage
pkg/compose/helper_test.go
Tests added for parseVersion with multiple Podman Compose output formats (standard, v-prefixed, python-variant, trailing newlines, external provider warnings), ComposeHelper podman field assignment (Command, Version, Args), and buildCmd command construction (verify podman executable, compose subcommand, --project-name with project name, up, and -d flags).

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding Podman Compose detection to the compose helper, which is the central objective of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.
@skevetter
skevetter enabled auto-merge (squash) May 13, 2026 19:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
pkg/compose/helper_test.go (1)

152-158: ⚡ Quick win

Assert command arg order, not only presence.

Contains can 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 win

Remove redundant podman compose precheck in favor of the version check below.

This initial validation is unnecessary since the version --short check that follows already confirms podman compose availability. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 61d741d and 839736b.

📒 Files selected for processing (2)
  • pkg/compose/helper.go
  • pkg/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.
@skevetter
skevetter merged commit 774ab5d into main May 13, 2026
52 of 56 checks passed
@skevetter
skevetter deleted the 2a7d-20db-podman-compose-detect branch May 13, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant