copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

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

Open gidsg opened this issue 1 year ago • 1 comments

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)

gidsg avatar Mar 11 '24 17:03 gidsg

+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

rhetprieto avatar Mar 13 '24 02:03 rhetprieto