cloud-run-button
cloud-run-button copied to clipboard
Optional Build Logs
It is nice to default to the cleanliness of not displaying build logs, but it would be cool if the user could see them. I remember @ahmetb indicating it might be hard to implement, but something like the following would be cool:
[ ! ] Attempting to build this application with its Dockerfile. Press Esc at any time to see the build output.
[ ! ] FYI, running the following command:
docker build -t gcr.io/jw-demo/hello-netcat hello-netcat
Sending build context to Docker daemon 74.75kB
Step 1/2 : FROM alpine
---> a24bb4013296
Step 2/2 : ENTRYPOINT while :; do nc -k -l -p $PORT -e sh -c 'echo -e "HTTP/1.1 200 OK\n\n hello, world"'; done
---> Using cache
---> c5c6654985d8
Successfully built c5c6654985d8
Successfully tagged gcr.io/jw-demo/hello-netcat:latest
[ ✓ ] Built container image gcr.io/jw-demo/hello-netcat
[ ! ] FYI, running the following command:
docker push gcr.io/jw-demo/hello-netcat
[ ✓ ] Pushed container image to Google Container Registry.
[ ! ] FYI, running the following command:
gcloud run deploy hello-netcat\
--project=jw-demo\
--platform=managed\
--region=us-central1\
--image=gcr.io/jw-demo/hello-netcat\
--allow-unauthenticated
[ ✓ ] Successfully deployed service hello-netcat to Cloud Run.
* This application is billed only when it's handling requests.
* Manage this application at Cloud Console:
https://console.cloud.google.com/run/detail/us-central1/hello-netcat?project=jw-demo
* Learn more about Cloud Run:
https://cloud.google.com/run/docs
[ ✓ ] Your application is now live here:
https://hello-netcat-weurlhfjnq-uc.a.run.app
Should be doable. But most projects e.g. even the Go binaries are likely to have screens full of build messages that the user might fail to keep track of. Similarly docker-build tends to treat stderr as red (90% of the time causing false alarms to the user).
Thanks for filing the feedback so fast! Agreed, it would be really nice to opt-in to the logs, and preferably even to configure the button to always display logs (so that we can show what our project logs look like)
Yeah, there could also be an app.json flag.
I resisted not to say yet another flag, but it seems inevitable. :)
For the record, we do collect those logs already, but we only print if we fail.
And I just realized why it currently isn't possible to stream.
It's because we have an animation printing [ /|\_/... ] Building container image and while that's going on, we can't stream stuff to the output stream as it would mess with the animation.
Yeah, the app.json creep is real.
In this case we could disable the spinner.
BTW, for some reason the spinner doesn't work (sometimes or all the time?). #182