"No log streams found for log group" when performing run-task.sh before first ECS deploy
sohflp opened this issue · 1 comments
sohflp commented
Description: In a customer implementation we configured a task for DB migrations (based on Slim PHP framework) to be executed via run-task.sh before the ECS deployment. When running this command in the pipeline for the first time (without the first ECS deployment) the following error happened:
---> Registering Task Definition
---> Executing ECS Task
CLUSTER_NAME: <ENVIRONMENT>
APP_NAME: <APP_NAME>
TASK_ARN: arn:aws:ecs:<REGION>:<ACCOUNT>:task-definition/<TASK>:1
---> Task ID arn:aws:ecs:<REGION>:<ACCOUNT>:task/00000000-0000-0000-0000-000000000000
No log streams found for log group /ecs/<ENVIRONMENT>/<APP_NAME>
make: *** [Makefile:89: db-migrate] Error 1
Note: Some of the values in the log were replaced to avoid exposing sensitive information.
Workaround: To fix the issue we executed the first ECS deployment manually to generate the log group for the specific task and re-run the pipeline with DB migrations, during the second try the issue was solved.
Additional technical information:
Pipeline steps:
- make db-migrate
- make deploy
Makefile:
db-migrate: .env $(ASSUME_REQUIRED) env-AWS_ACCOUNT_ID env-AWS_DEFAULT_REGION env-AWS_ENV
@echo "make db-migrate"
docker-compose -f $(PATH_DEPLOY)/docker-compose.yml run \
-e CLUSTER_NAME=$(AWS_ENV) \
-e COMMAND=$(COMMAND_MIGRATE) \
--rm deploy /work/run-task.sh
.PHONY: db-migrate
deploy: .env $(ASSUME_REQUIRED) env-AWS_ACCOUNT_ID env-AWS_DEFAULT_REGION env-AWS_ENV
@echo "make deploy"
docker-compose -f $(PATH_DEPLOY)/docker-compose.yml run \
-e CLUSTER_NAME=$(AWS_ENV) \
--rm deploy
.PHONY: deploy
docker-compose.yml
deploy:
image: dnxsolutions/ecs-deploy:1.2.0
env_file:
- .env
- .env.assume
volumes:
- ./task-definition.tpl.json:/work/task-definition.tpl.json
adenot commented
Fixed by 1.3.2