GoogleCloudPlatform / cloud-run-button

Let anyone deploy your GitHub repos to Google Cloud Run with a single click
https://cloud.run
Apache License 2.0
528 stars 92 forks source link

Optional Build Logs #190

Open jamesward opened 4 years ago

jamesward commented 4 years ago

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
ahmetb commented 4 years ago

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).

dfreilich commented 4 years ago

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)

jamesward commented 4 years ago

Yeah, there could also be an app.json flag.

ahmetb commented 4 years ago

I resisted not to say yet another flag, but it seems inevitable. :)

ahmetb commented 4 years ago

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.

jamesward commented 4 years ago

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