copilot-cli
copilot-cli copied to clipboard
copilot svc show will not display details for deploy environment is downstream environments are not deployed.
I have an App with 4 environments configured. Using copilot pipeline, but the result would be the same without it. After the first environment deployment has completed, I cannot get details of that environment if any of the other environments are not deployed.
$ copilot env ls --app my-app
uat
prod
stg
dev
$ copilot svc show --app my-app --name my-service
describe service my-service: retrieve platform: describe task definition for service my-service: get task definition my-app-stg-my-service of service my-service: describe task definition my-app-stg-my-service: ClientException: Unable to describe task definition.
Maybe the UI could return N/A if the describe task action fails. Or if a flag for --env could be added to copilot svc show
Without this, I am unable to see details about my dev environment (1) until I deploy all four environments.
$ copilot version
version: v1.19.0, built for darwin
Not sure what was decided for this: https://github.com/aws/copilot-cli/pull/1090#issuecomment-655125651 Ref: #1093 .
Thanks!
Hi @matthewhembree !
Thank you for the issue, which version of Copilot are you using (copilot version)?
I see that we have the following method: https://github.com/aws/copilot-cli/blob/d1d8f5e6109749f4f3b83d7cd00e4fa69c78bf20/internal/pkg/deploy/deploy.go#L274-L279
Which should have filtered the my-service results to only the environments where the service is deployed.
For example in v1.19, I have a service called "backend" that's not yet deployed to the "test" env and I get the following output:
$ copilot svc show main
Service name: backend
About
Application demo
Name backend
Type Backend Service
Configurations
Environment Tasks CPU (vCPU) Memory (MiB) Platform Port
----------- ----- ---------- ------------ -------- ----
Service Discovery
Environment Namespace
----------- ---------
Variables
Name Container Environment Value
---- --------- ----------- -----
Hi @efekarakus !
I'm am using v1.19.0.
You are correct that it works. I checked again.
What I think is happening is the command only succeeds if the initial deployment is in a terminal state. Mid-deployment (any environment's first time) will result in an error. Not sure if the error will occur mid-deployment for subsequent environment deployments.
Ohhh- that makes sense, thank you for that observation!
It looks like we think that the service is deployed if there is an existing CloudFormation stack with the copilot-application, copilot-environment and copilot-service tags:
https://github.com/aws/copilot-cli/blob/d1d8f5e6109749f4f3b83d7cd00e4fa69c78bf20/internal/pkg/deploy/deploy.go#L257-L262
However, like you mentioned it's possible that the stack is currently in "CREATE_IN_PROGRESS" and the TaskDefinition doesn't exist yet. In that scenario, the CLI errors because it thinks the stack is done deploying and a task definition exists (which is not yet true).
It looks like we need to make the filtering a bit more robust by making sure the stack has been at least created. I'll mark the issue with the label/bug, but I'm glad that it doesn't appear to be a major blocker 😅