Skip to content

Commit

Permalink
add task id context to rails-console-ecs type (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandromello committed Jul 24, 2023
1 parent eab84bf commit 12261ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/agent/agent.clj
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,15 @@
;; pass the script as base64 and decode inside the container
;; which will prevent character escaping issues. Rails was used to no rely
;; on local dependencies tools like base64.
task-id (get-in task [:secrets :RUNOPS_TASK_ID])
ecs-command (format
(str "/bin/sh -c \""
(when (get-in task [:secrets :ECS_DEBUG]) "set -x; ")
"DISABLE_SPRING=1 rails runner 'require \"'\"base64\"'\";"
"File.write(\"'\"/tmp/runops-script\"'\", Base64.decode64(\"'\"%s\"'\"))'"
"&& DISABLE_SPRING=1 rails runner /tmp/runops-script"
"File.write(\"'\"/tmp/runops-script-%s\"'\", Base64.decode64(\"'\"%s\"'\"))'"
"&& DISABLE_SPRING=1 rails runner /tmp/runops-script-%s"
"\"")
base64-script)]
task-id base64-script task-id)]
(aws-ecs-exec ecs-command task)))

(def custom-command-tmpl
Expand Down

0 comments on commit 12261ed

Please sign in to comment.