wacul / aws-ecs

Wercker step and github action for AWS ECS Deploy
6 stars 2 forks source link

fix TaskDefinition can not be blank error, when create task definition and service from scratch #47

Closed podhmo closed 3 years ago

podhmo commented 3 years ago

Fix the error like the following.

$ python main.py service --region us-east-1 --services-yaml /ops/aws-ecs/v2/services.yml --environment-yaml /ops/aws-ecs/v2/develop.yml --deploy-service-group application --template-group batch
Step: Check ECS Template

* Template check environment `develop` done.

Step: Fetch ECS Information

.

* Check succeeded

Step: Delete Unused

  There was no service or task to delete.

Step: Check Deploy ECS Service and Scheduled tasks

x Service 'develop-count-example-service' status not Active. will be recreated.

Step: Deploy ECS Service

x Service 'develop-count-example-service' not Found. will be created.

x Unexpected error in `develop-count-example-service`.
Traceback (most recent call last):
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/aws/__init__.py", line 335, in update_service
    res = self.client.update_service(**parameters)
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/venv/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/venv/lib/python3.7/site-packages/botocore/client.py", line 676, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.ClientException: An error occurred (ClientException) when calling the UpdateService operation: TaskDefinition not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/ecs/deploy.py", line 284, in __update_service
    force_new_deployment=force_new_deployment,
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/aws/__init__.py", line 347, in update_service
    raise EcsServiceNotFoundException()
aws.EcsServiceNotFoundException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/ecs/deploy.py", line 44, in run
    self.process(deploy, mode)
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/ecs/deploy.py", line 61, in process
    self.process_service(deploy)
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/ecs/deploy.py", line 160, in process_service
    desired_count=service.task_environment.desired_count,
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/ecs/deploy.py", line 294, in __update_service
    res_service = self.__create_service(service)
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/ecs/deploy.py", line 242, in __create_service
    service_registries=service.service_registries,
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/aws/__init__.py", line 217, in create_service
    response = self.client.create_service(**parameters)
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/venv/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/podhmo/ghq/github.com/wacul/aws-ecs/venv/lib/python3.7/site-packages/botocore/client.py", line 676, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameterException) when calling the CreateService operation: TaskDefinition can not be blank.

Wait for Service Status 'Stable'

x `develop-count-example-service` previous process error. skipping.