aws / copilot-cli

The AWS Copilot CLI is a tool for developers to build, release and operate production ready containerized applications on AWS App Runner or Amazon ECS on AWS Fargate.
https://aws.github.io/copilot-cli/
Apache License 2.0
3.48k stars 400 forks source link

`copilot job run --follow` option (feature request) #5721

Open gidsg opened 6 months ago

gidsg commented 6 months ago

It would be useful when testing a Scheduled Job to be able to immediately tail the log output in the CLI

e.g.

copilot job run --follow

would behave similarly to copilot job run && copilot job logs --follow except the logs would be limited to the just triggered run.

This would also be consistent with copilot task run --follow (except for a job rather than a task)

rhetprieto commented 6 months ago

+1 to this.

My use case involves running a database migration. I'm not using the copilot pipelines; instead, I prefer to trigger the deployment operation through a GitHub Action. As I couldn't find an intuitive way to run migrations, the solution I came up with was to define the db-migration as a job (with schedule: "none"). I would have expected to be able to run copilot job run --follow and be able to read the exit code; unfortunately, that isn't possible.

The workaround I'm using is to invoke a task based off that job. I'm sharing in case it works for you as well:

  1. Execute copilot task run --generate-cmd my-app/my-job
  2. Take the output from the prior command and append \ --follow
  3. Execute the modified output