Skip to content

Add --detach/-d to run command for API-based execution - #28

Open
usiegj00 wants to merge 3 commits into
mainfrom
feature/run-detach-api
Open

Add --detach/-d to run command for API-based execution#28
usiegj00 wants to merge 3 commits into
mainfrom
feature/run-detach-api

Conversation

@usiegj00

@usiegj00 usiegj00 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Add --detach/-d flag to bld run for API-based one-off command execution. Uses POST /api/v1/apps/:id/dynos/run (buildio/build#1458) via the SDK's run_dyno method — creates a fresh K8s Job with the app's image and config vars. No SSH or ContainerSSH required.

bld run -d -a my-app -- rails db:migrate
bld run -d -a my-app -t worker -s Standard-2X -- rake heavy:task
bld run -d -a my-app --timeout 600 -- rails runner scripts/backfill.rb

New options (detach mode only):

  • -t/--type — process type (default: worker)
  • -s/--size — dyno size (default: from formation)
  • --timeout — seconds, 30–1800 (default: 300)

Default (no -d) remains SSH-based interactive mode — no behavior change.

Also accessible to addons (e.g. CronToGo) via addon access keys since the require_app filter resolves addon_resource_owner?.attached_apps.

Test plan

  • shards build compiles
  • bld run --help shows new flags
  • bld run -d -a <app> -- echo hello returns output
  • bld run -a <app> (no -d) still works via SSH

Uses the new POST /api/v1/apps/:id/dynos/run endpoint via the SDK's
run_dyno method. Creates a fresh K8s Job with the app's image and
env — no SSH or ContainerSSH required.

Options: -t/--type (process type), -s/--size (dyno size),
--timeout (30-1800s). Also available to addons like CronToGo
via their addon access keys.
@usiegj00
usiegj00 requested a review from usiegl00 May 8, 2026 10:08

@usiegl00 usiegl00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this still depend on the cli keeping the http connection alive with the rails server?

usiegj00 added 2 commits May 8, 2026 22:04
Debug output now says 'Connection established', 'Authentication
successful', etc. instead of mentioning SSH as an implementation
detail.

@usiegl00 usiegl00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

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.

2 participants