From 12261ed6815561b53db70f7d966841a30c201273 Mon Sep 17 00:00:00 2001 From: Sandro Mello Date: Mon, 24 Jul 2023 08:50:39 -0300 Subject: [PATCH] add task id context to rails-console-ecs type (#118) --- src/agent/agent.clj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/agent/agent.clj b/src/agent/agent.clj index 2306ba7..ab23dd3 100644 --- a/src/agent/agent.clj +++ b/src/agent/agent.clj @@ -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