Skip to content

Commit

Permalink
Merge branch 'release/1.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabfuel committed Aug 24, 2020
2 parents a21dc07 + 1a93c80 commit 45c29a9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ecs_deploy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.10.1'
VERSION = '1.10.2'
5 changes: 3 additions & 2 deletions ecs_deploy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,13 @@ def scale(cluster, service, desired_count, access_key_id, secret_access_key, reg
@click.option('--subnet', type=str, multiple=True, help='A subnet ID to launch the task within. Required for launch type FARGATE (multiple values possible)')
@click.option('--securitygroup', type=str, multiple=True, help='A security group ID to launch the task within. Required for launch type FARGATE (multiple values possible)')
@click.option('--public-ip', is_flag=True, default=False, help='Should a public IP address be assigned to the task (default: False)')
@click.option('--platform-version', help='The version of the Fargate platform on which to run the task. Optional, FARGATE launch type only.', required=False)
@click.option('--region', help='AWS region (e.g. eu-central-1)')
@click.option('--access-key-id', help='AWS access key id')
@click.option('--secret-access-key', help='AWS secret access key')
@click.option('--profile', help='AWS configuration profile name')
@click.option('--diff/--no-diff', default=True, help='Print what values were changed in the task definition')
def run(cluster, task, count, command, env, secret, launchtype, subnet, securitygroup, public_ip, region, access_key_id, secret_access_key, profile, diff):
def run(cluster, task, count, command, env, secret, launchtype, subnet, securitygroup, public_ip, platform_version, region, access_key_id, secret_access_key, profile, diff):
"""
Run a one-off task.
Expand All @@ -330,7 +331,7 @@ def run(cluster, task, count, command, env, secret, launchtype, subnet, security
if diff:
print_diff(td, 'Using task definition: %s' % task)

action.run(td, count, 'ECS Deploy', launchtype, subnet, securitygroup, public_ip)
action.run(td, count, 'ECS Deploy', launchtype, subnet, securitygroup, public_ip, platform_version)

click.secho(
'Successfully started %d instances of task: %s' % (
Expand Down
13 changes: 9 additions & 4 deletions ecs_deploy/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def update_service(self, cluster, service, desired_count, task_definition):

def run_task(self, cluster, task_definition, count, started_by, overrides,
launchtype='EC2', subnets=(), security_groups=(),
public_ip=False):
public_ip=False, platform_version=None):

if launchtype == LAUNCH_TYPE_FARGATE:
if not subnets or not security_groups:
Expand All @@ -105,14 +105,18 @@ def run_task(self, cluster, task_definition, count, started_by, overrides,
}
}

if platform_version is None:
platform_version = 'LATEST'

return self.boto.run_task(
cluster=cluster,
taskDefinition=task_definition,
count=count,
startedBy=started_by,
overrides=overrides,
launchType=launchtype,
networkConfiguration=network_configuration
networkConfiguration=network_configuration,
platformVersion=platform_version,
)

return self.boto.run_task(
Expand Down Expand Up @@ -679,7 +683,7 @@ def __init__(self, client, cluster_name):
self.started_tasks = []

def run(self, task_definition, count, started_by, launchtype, subnets,
security_groups, public_ip):
security_groups, public_ip, platform_version):
try:
result = self._client.run_task(
cluster=self._cluster_name,
Expand All @@ -690,7 +694,8 @@ def run(self, task_definition, count, started_by, launchtype, subnets,
launchtype=launchtype,
subnets=subnets,
security_groups=security_groups,
public_ip=public_ip
public_ip=public_ip,
platform_version=platform_version,
)
self.started_tasks = result['tasks']
return True
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def readme():
return f.read()


dependencies = ['click<7.0.0', 'botocore>=1.12.0', 'boto3>=1.4.7', 'future', 'requests', 'dictdiffer==0.8.0']
dependencies = ['click<7.0.0', 'botocore>=1.17.47', 'boto3>=1.14.47', 'future', 'requests', 'dictdiffer==0.8.0']

setup(
name='ecs-deploy',
Expand Down
9 changes: 5 additions & 4 deletions tests/test_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def test_task_set_command_with_multiple_arguments(task_definition):
assert container[u'command'] == [u'run-application', u'arg1', u'arg2']

def test_task_set_command_with_empty_argument(task_definition):
empty_argument = " "
empty_argument = " "
task_definition.set_commands(webserver=empty_argument + u'run-webserver arg1 arg2')
for container in task_definition.containers:
if container[u'name'] == u'webserver':
Expand Down Expand Up @@ -856,7 +856,7 @@ def test_run_action(client):
def test_run_action_run(client, task_definition):
action = RunAction(client, CLUSTER_NAME)
client.run_task.return_value = dict(tasks=[dict(taskArn='A'), dict(taskArn='B')])
action.run(task_definition, 2, 'test', LAUNCH_TYPE_EC2, (), (), False)
action.run(task_definition, 2, 'test', LAUNCH_TYPE_EC2, (), (), False, None)

client.run_task.assert_called_once_with(
cluster=CLUSTER_NAME,
Expand All @@ -867,7 +867,8 @@ def test_run_action_run(client, task_definition):
launchtype=LAUNCH_TYPE_EC2,
subnets=(),
security_groups=(),
public_ip=False
public_ip=False,
platform_version=None,
)

assert len(action.started_tasks) == 2
Expand Down Expand Up @@ -960,7 +961,7 @@ def update_service(self, cluster, service, desired_count, task_definition):

def run_task(self, cluster, task_definition, count, started_by, overrides,
launchtype='EC2', subnets=(), security_groups=(),
public_ip=False):
public_ip=False, platform_version=None):
if not self.access_key_id or not self.secret_access_key:
raise EcsConnectionError(u'Unable to locate credentials. Configure credentials by running "aws configure".')
if cluster == 'unknown-cluster':
Expand Down

0 comments on commit 45c29a9

Please sign in to comment.