Skip to content

Conversation

@gocanto
Copy link
Collaborator

@gocanto gocanto commented Oct 14, 2025

Summary

  • allow make run-cli to fall back to the legacy docker-compose binary when the Docker Compose plugin is unavailable
  • add a clear error message when no Compose command exists so the CLI can be run manually

Testing

  • make format
  • make test-all (fails: command hangs while waiting for database, interrupted)

https://chatgpt.com/codex/tasks/task_e_68edcd7fbea083339891ec4031100ae9

Summary by CodeRabbit

  • New Features
    • Automatically detects and uses either “docker compose” or “docker-compose” for improved compatibility across environments.
  • Bug Fixes
    • Ensures non-zero exit statuses propagate correctly after runs.
    • Preserves environment variable propagation (e.g., secrets) during execution.
    • Provides clearer failure messages and a helpful hint when no Compose CLI is available.

@gocanto gocanto marked this pull request as draft October 14, 2025 04:26
@gemini-code-assist
Copy link

Summary of Changes

Hello @gocanto, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the make run-cli command by introducing a compatibility layer for Docker Compose. It ensures that users can execute the CLI regardless of whether they have the newer docker compose plugin or the older docker-compose standalone binary installed, thereby improving developer experience and reducing setup friction. Additionally, it provides explicit guidance when no suitable Compose command is detected.

Highlights

  • Fallback Mechanism: The make run-cli command now includes a fallback mechanism. It first attempts to use the docker compose plugin (the newer syntax) and, if that's not available, it falls back to the legacy docker-compose binary.
  • Improved Error Handling: A clear and informative error message is now displayed if neither the docker compose plugin nor the docker-compose legacy binary is found, guiding the user to install Docker Compose or run the CLI locally.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Switches Makefile run logic from direct docker run to conditional docker compose/docker-compose invocation. Adds CLI availability checks, selects the appropriate command, preserves env var propagation, and exits with guidance when neither CLI exists. Maintains non-zero status propagation and failure messaging.

Changes

Cohort / File(s) Summary
Docker CLI selection in Makefile
metal/makefile/app.mk
Replace direct docker run with guarded detection of docker compose vs docker-compose; choose corresponding run command. Preserve env var pass-through and error handling, including non-zero status propagation and hint when no compose CLI is found.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as make run-cli
  participant Sh as Shell
  participant DC as docker compose
  participant DCo as docker-compose

  Dev->>Sh: Invoke run target
  Sh->>Sh: Check for `docker compose`
  alt docker compose available
    Sh->>DC: run <service> <cmd> with env
    DC-->>Sh: exit code
  else docker-compose available
    Sh->>DCo: run <service> <cmd> with env
    DCo-->>Sh: exit code
  else neither available
    Sh-->>Dev: Print hint and exit 1
  end
  Sh-->>Dev: Propagate non-zero status if failure
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

I tap my paws on compose’s door,
Which one to run—two names, one chore.
If none respond, I leave a sign,
“Install a friend, then all is fine.”
With envs in tow and status true,
I hop, I run—the build hops too. 🐇🛠️

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly highlights the primary change by describing the fallback mechanism when the Docker Compose plugin is missing, matching the core update in the changeset without extraneous detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gus/fix-command-execution-in-production-2025-10-14

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36d78d6 and 22ab922.

📒 Files selected for processing (1)
  • metal/makefile/app.mk (1 hunks)

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.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a fallback mechanism to use the legacy docker-compose binary when the docker compose plugin is not available. This improves the developer experience on systems that might not have the latest Docker setup. The implementation is correct, but I've suggested a refactoring to reduce code duplication and improve maintainability by first determining the available command and then executing it.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

@gocanto gocanto changed the title Handle CLI run fallback when Docker Compose plugin is missing fix: Handle CLI run fallback when Docker Compose plugin is missing Oct 14, 2025
@gocanto gocanto marked this pull request as ready for review October 14, 2025 04:39
@gocanto
Copy link
Collaborator Author

gocanto commented Oct 14, 2025

@codex review

@gocanto gocanto merged commit fbcd86f into main Oct 14, 2025
3 checks passed
@gocanto gocanto deleted the gus/fix-command-execution-in-production-2025-10-14 branch October 14, 2025 04:42
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +105 to +108
DB_SECRET_USERNAME="$(DB_SECRET_USERNAME)" DB_SECRET_PASSWORD="$(DB_SECRET_PASSWORD)" DB_SECRET_DBNAME="$(DB_SECRET_DBNAME)" docker compose run --rm api-runner go run ./metal/cli/main.go || status=$$?; \
elif command -v docker-compose >/dev/null 2>&1; then \
printf "Using docker-compose to run the CLI.\n"; \
DB_SECRET_USERNAME="$(DB_SECRET_USERNAME)" DB_SECRET_PASSWORD="$(DB_SECRET_PASSWORD)" DB_SECRET_DBNAME="$(DB_SECRET_DBNAME)" docker-compose run --rm api-runner go run ./metal/cli/main.go || status=$$?; \

Choose a reason for hiding this comment

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

P1 Badge Suppress command echo to avoid leaking secret values

The new compose detection block no longer prefixes the docker compose run and docker-compose run lines with @. make will now echo these recipe lines, including the literal values of DB_SECRET_USERNAME, DB_SECRET_PASSWORD, and DB_SECRET_DBNAME. When callers override these variables with real credentials (instead of file paths), the credentials will be printed to the console and to any captured logs, undermining the redaction logic above. Restoring the leading @ (or otherwise silencing these commands) keeps secrets from being disclosed while executing make run-cli.

Useful? React with 👍 / 👎.

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.

2 participants