lib/hako/schedulers/ecs.rb in hako-0.2.0 vs lib/hako/schedulers/ecs.rb in hako-0.2.1

- old
+ new

@@ -21,19 +21,19 @@ @ecs = Aws::ECS::Client.new(region: region) @elb = EcsElb.new(app_id, Aws::ElasticLoadBalancing::Client.new(region: region), options.fetch('elb', nil)) @ec2 = Aws::EC2::Client.new(region: region) end - def deploy(image_tag, env, app_port, front, force: false) + def deploy(image_tag, env, app_port, docker_labels, front, force: false) @force_mode = force front_env = { 'AWS_DEFAULT_REGION' => front.config.s3.region, 'S3_CONFIG_BUCKET' => front.config.s3.bucket, 'S3_CONFIG_KEY' => front.config.s3.key(@app_id), } front_port = determine_front_port - task_definition = register_task_definition(image_tag, env, front.config, front_env, front_port) + task_definition = register_task_definition(image_tag, env, docker_labels, front.config, front_env, front_port) if task_definition == :noop Hako.logger.info "Task definition isn't changed" task_definition = @ecs.describe_task_definition(task_definition: @app_id).task_definition else Hako.logger.info "Registered task definition: #{task_definition.task_definition_arn}" @@ -193,13 +193,13 @@ def different_definition?(expected_container, actual_container) EcsDefinitionComparator.new(expected_container).different?(actual_container) end - def register_task_definition(image_tag, env, front_config, front_env, front_port) + def register_task_definition(image_tag, env, docker_labels, front_config, front_env, front_port) front = front_container(front_config, front_env, front_port) - app = app_container(image_tag, env) + app = app_container(image_tag, env, docker_labels) if task_definition_changed?(front, app) @ecs.register_task_definition( family: @app_id, container_definitions: [front, app], ).task_definition @@ -237,20 +237,21 @@ essential: true, environment: environment, } end - def app_container(image_tag, env) + def app_container(image_tag, env, docker_labels) environment = env.map { |k, v| { name: k, value: v } } { name: 'app', image: image_tag, cpu: @cpu, memory: @memory, links: [], port_mappings: [], essential: true, environment: environment, + docker_labels: docker_labels, } end def run_task(task_definition, env, commands) environment = env.map { |k, v| { name: k, value: v } }