fabfuel / ecs-deploy

Powerful CLI tool to simplify Amazon ECS deployments, rollbacks & scaling
Other
843 stars 145 forks source link

Structured output #226

Open smoehrle opened 1 month ago

smoehrle commented 1 month ago

This PR is based on https://github.com/fabfuel/ecs-deploy/pull/225. Only this commit is new: https://github.com/fabfuel/ecs-deploy/commit/49c710e2b09422f71788e17c48edb3a6daee6866

It adds a flag --out-file which outputs some data in a structured format for further processing. Again, if you give me a hint, that this is something you would merge, I can further polish everything and make it available to others :innocent:

Example output:


$ ecs deploy app-messenger-cluster app-messenger-service app-web-cluster app-web-service  --out-file data.json [...]
$ cat data.json  | jq
[
  {
    "cluster": "app-messenger-cluster",
    "service": "app-messenger-service",
    "old_task_definition": "app-messenger-td:7",
    "old_task_definition_arn": "arn:aws:ecs:eu-central-1:111122223333:task-definition/app-messenger-td:7",
    "task_definition": "app-messenger-td:8",
    "task_definition_arn": "arn:aws:ecs:eu-central-1:111122223333:task-definition/app-messenger-td:8"
  },
  {
    "cluster": "app-web-cluster",
    "service": "app-web-service",
    "old_task_definition": "app-web-td:4",
    "old_task_definition_arn": "arn:aws:ecs:eu-central-1:111122223333:task-definition/app-web-td:4",
    "task_definition": "app-web-td:5",
    "task_definition_arn": "arn:aws:ecs:eu-central-1:111122223333:task-definition/app-web-td:5"
  }
]