lib/command/run_detached.rb in cpl-0.4.1 vs lib/command/run_detached.rb in cpl-0.5.0
- old
+ new
@@ -8,20 +8,22 @@
OPTIONS = [
app_option(required: true),
image_option
].freeze
DESCRIPTION = "Runs one-off **_non-interactive_** replicas (close analog of `heroku run:detached`)"
- LONG_DESCRIPTION = <<~HEREDOC
+ LONG_DESCRIPTION = <<~DESC
- Runs one-off **_non-interactive_** replicas (close analog of `heroku run:detached`)
- Uses `Cron` workload type with log async fetching
- Implemented with only async execution methods, more suitable for production tasks
- Has alternative log fetch implementation with only JSON-polling and no WebSockets
- Less responsive but more stable, useful for CI tasks
- HEREDOC
- EXAMPLES = <<~HEREDOC
+ DESC
+ EXAMPLES = <<~EX
```sh
cpl run:detached rails db:prepare -a $APP_NAME
+
+ # Need to quote COMMAND if setting ENV value or passing args to command to run
cpl run:detached 'LOG_LEVEL=warn rails db:migrate' -a $APP_NAME
# Uses some other image.
cpl run:detached rails db:migrate -a $APP_NAME --image /some/full/image/path
@@ -30,11 +32,11 @@
# Uses a different image (which may not be promoted yet).
cpl run:detached rails db:migrate -a $APP_NAME --image appimage:123 # Exact image name
cpl run:detached rails db:migrate -a $APP_NAME --image latest # Latest sequential image
```
- HEREDOC
+ EX
WORKLOAD_SLEEP_CHECK = 2
attr_reader :location, :workload, :one_off
@@ -75,10 +77,10 @@
spec["defaultOptions"]["autoscaling"]["minScale"] = 1
spec["defaultOptions"]["capacityAI"] = false
# Override image if specified
image = config.options[:image]
- image = "/org/#{config[:cpln_org]}/image/#{latest_image}" if image == "latest"
+ image = "/org/#{config.org}/image/#{latest_image}" if image == "latest"
container["image"] = image if image
# Set cron job props
spec["type"] = "cron"
spec["job"] = { "schedule" => "* * * * *", "restartPolicy" => "Never" }