Open afgallo opened 1 year ago
Hi @afgallo !
Sure @KollaAdithya. A typical call to copilot svc deploy
would result in the following being displayed in logs:
My suggestion is that when Copilot recognises that it's running under a CI server (typically with an env variable CI=true
) it should output very minimal information on to the console and maybe only report errors.
Does that make sense?
Ah that makes sense!
Copilot already does that if you set environment variable export CI=true
in your post_build.commands
section of buildspec.yml
then you will not have all these rendering in build logs.
Interesting @KollaAdithya I did not realise copilot does that by default. Is this only available within AWS code*? I quickly tested this within my local env by running export CI=true
before a deployment and I still get the same result
docker build
If you set the CI = true
then it will display complete output of docker build at once and also --progress = plain
for the docker build. Output will look something like below. #1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.31kB done
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/library/golang:1.15
#3 ...
#4 [auth] library/golang:pull token for registry-1.docker.io
#4 DONE 0.0s
#5 [auth] library/alpine:pull token for registry-1.docker.io
#5 DONE 0.0s
#6 [internal] load metadata for docker.io/library/alpine:latest
#6 DONE 3.0s
#3 [internal] load metadata for docker.io/library/golang:1.15
#3 DONE 3.1s
#7 [builder 1/5] FROM docker.io/library/golang:1.15@sha256:ea080cc817b02a946461d42c02891bf750e3916c52f7ea8187bccde8f312b59f
#7 DONE 0.0s
#8 [internal] load build context
#8 transferring context: 655B done
#8 DONE 0.0s
#9 [stage-1 1/7] FROM docker.io/library/alpine:latest@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1
#9 resolve docker.io/library/alpine:latest@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1 0.0s done
#9 DONE 0.0s
#10 [builder 5/5] RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o e2e-service ./
#10 CACHED
#11 [stage-1 3/7] COPY --from=builder /app ./
#11 CACHED
#12 [stage-1 6/7] RUN echo
#12 CACHED
#13 [builder 4/5] WORKDIR /app
#13 CACHED
#14 [stage-1 4/7] RUN chmod +x ./e2e-service
#14 CACHED
#15 [builder 3/5] ADD . /app
#15 CACHED
#16 [builder 2/5] RUN mkdir /app
#16 CACHED
#17 [stage-1 5/7] RUN chmod +x /script.sh
#17 CACHED
#18 [stage-1 2/7] RUN apk --no-cache add ca-certificates
#18 CACHED
#19 [stage-1 7/7] ADD script.sh /app
#19 CACHED
#20 exporting to image
#20 exporting layers done
#20 writing image sha256:3c9ce4e6e1efda779c6d999192089e9e8d619a938b43177afe274b7ae0584286 done
#20 naming to 535307839156.dkr.ecr.eu-west-2.amazonaws.com/hyatt/happy:latest done
#20 DONE 0.0s
535307839156.dkr.ecr.eu-west-2.amazonaws.com/hyatt/happy:latest
Proposing Infrastructure changes for stack
output. Copilot will render the output for every 30 sec if CI is set to true.
https://github.com/aws/copilot-cli/blob/mainline/internal/pkg/term/progress/render_interval.go#L18:L20I would assume this will satisfy your requirement 🤔
This change has been released in v1.29.0: https://github.com/aws/copilot-cli/releases/tag/v1.29.0!
Thanks @huanjani and @KollaAdithya. Unfortunately something may have got lost in translation. As I've tried to articulate above, my suggestion was when CI=true
copilot should not output anything, just errors. If not desirable/feasible, something like the below would be much better IMHO:
Building docker image ...
Done!
Proposing infrastructure changes ...
Done!
Deploying service ...
Done!
Thanks for the clarification. Let me reopen this issue.
We are also adding --detach
flag to copilot svc deploy
that will not display any of the stack events. i.e
In Proposing infrastructure changes step
Is there a way to deploy with Copilot using a silent or quiet mode? This should only display errors and avoid displaying animations and other things that are not as useful in the context of a CI server.
Thanks!