lib/hako/schedulers/ecs.rb in hako-0.8.2 vs lib/hako/schedulers/ecs.rb in hako-0.8.3

- old
+ new

@@ -53,11 +53,11 @@ end Hako.logger.info 'Deployment completed' end end - def oneshot(containers, commands) + def oneshot(containers, commands, env) definitions = create_definitions(containers, -1) definitions.each do |definition| definition.delete(:essential) end task_definition = register_task_definition_for_oneshot(definitions) @@ -65,11 +65,11 @@ Hako.logger.info "Task definition isn't changed" task_definition = @ecs.describe_task_definition(task_definition: "#{@app_id}-oneshot").task_definition else Hako.logger.info "Registered task definition: #{task_definition.task_definition_arn}" end - task = run_task(task_definition, commands) + task = run_task(task_definition, commands, env) Hako.logger.info "Started task: #{task.task_arn}" containers = wait_for_task(task) Hako.logger.info 'Oneshot task finished' exit_code = 127 containers.each do |name, container| @@ -292,18 +292,20 @@ environment: environment, docker_labels: app.docker_labels, } end - def run_task(task_definition, commands) + def run_task(task_definition, commands, env) + environment = env.map { |k, v| { name: k, value: v } } @ecs.run_task( cluster: @cluster, task_definition: task_definition.task_definition_arn, overrides: { container_overrides: [ { name: 'app', command: commands, + environment: environment, }, ], }, count: 1, started_by: "hako oneshot #{@app_id}",