Where to find deployment and run logs GCP - docker

So, I've deployed a container using Google Cloud Run with continuous deployment. Google Cloud Build says that build was successful, but when I go to app url I see a error page: "Continuous deployment has been set up, but your repository has failed to build and deploy.".
There's no container logs in Google Cloud Run logs page, the only ones I can see are: "Hello from Cloud Run! The container started successfully and is listening for HTTP requests on $PORT"
How do I find deployment and run logs in order to figure out what went wrong?

Make sure your Build,Push and Deploy step was set up correctly in Cloud Build (either within your repository cloudbuild.yaml or Inline in the trigger). Since you are likely using a trigger you can find the configuration there (Cloud Build > Triggers > {your-tigger}).
The error can mean that the image you are trying to mount in your Cloud Run did not build correctly.
To verify the image has been created you can go to Cloud Run YAML tab and verify the image it is trying to pull is actually there (Cloud Run > {your-service} > YAML tab).

Related

How to deploy apps to cloud run using buildpack as cloudbuild trigger configuration?

I'm trying to deploy python apps on cloud run & i want to use buildpacks as cloud build trigger configuration. I created cloud build trigger and when i run it the image was created succesfully on container registry, but the service on cloud run still wasn't created.
I've tried to add cloudbuild.yaml to create cloud run service but still not helping. Can anybody give some advice?

Is there any way in google cloud to automatically erase a past docker image the moment you create a new one?

I made a google cloud run trigger that creates an image the moment you make a git push into the repo. This creates the image that is stored in gc, but in the long run that will be full of docker images. I´m lookin for a way to do it automatically, i know it can be done manually but that is not what I want. Anything is helpful at this moment
You can integrate your code in Cloud Source Repositories. Then, Cloud Build will create the desired Docker image than will be pushed to Google Cloud Container Registry. As soon as you commit code, the whole pipeline will run, updating the image.
Click the Cloud Run instance / Set up continuous deployment, enter the GitHub repo and enter Build configuration.
Then you attach the existing Cloud Build trigger to Cloud Run service
GCP Documentation:
https://cloud.google.com/run/docs/continuous-deployment-with-cloud-build

How to save build logs from Bitbucket Pipelines

Currently, the way I have my pipelines setup is having each step run on 'self.hosted' runners. I do it this way so I don't have to spend Bitbucket build minutes. Every time the pipeline runs, I can see the containers being created and terminated on my Docker application. The only debugging method I have found is by clicking on the container with the "build" word in it. Inside the container, I can see all the logs; every project build step and tests.
I'm trying to find a way to save these build logs into a text file and download it as an artifact. Bitbucket has a guide to generate support logs but none of the logs are build logs.

How to deploy the built docker image built by Cloud Build on Cloud Run automatically

Currently I trigger a Cloud Build each time a pull request is completed.
The image is built correctly, but we have to manually go to Edit and Deploy New Revision and select the most recent docker image to deploy.
How can we automate this process and have the a container deployed from the image automatically?
You can do it with a pretty simple GitHub Action. I have followed this article:
https://towardsdatascience.com/deploy-to-google-cloud-run-using-github-actions-590ecf957af0
Cloud Run also natively integrates with Cloud Build. You can import a GitHub repository and it sets up a GCB trigger for your repository (on the specified branch or tag filter).
You can use GitLab CI to automate your Cloud Run deployment.
Here are the tutorial if you want to automate your deployment with GitLab CI Link

CI/CD integration problem when using google-cloud-build with github push as trigger for Cloud Run

I am trying to set up a CI/CD pipeline using one of my public GitHub repositories as the source for Cloud Run (fully-managed) service using Cloud Build. I am using a Dockerfile initialized in root folder of the repository with source configuration parameter initialized as /Dockerfile when setting up the cloud build trigger. (to continuously deploy new revisions from source repository)
When, I initialize the cloud run instance, I face the following error:
Moreover, when I try to run my cloud build trigger manually, it shows the following error:
I also tried editing continuous deployment settings by setting it to automatically detect Dockerfile/cloudbuild.yaml. After that, build process becomes successful but the revision are not getting updated. I've also tried deploying a new revision and then triggering cloud build trigger but it isn't still able to pick the latest build from container registry.
I am positive that my Dockerfile and application code are working properly since I've previously submitted the build on Container registry using Google Cloud Shell and have tested it manually after deploying it to cloud run.
Need help to fix the issue.
UPPERCASE letters in the image path aren't allowed. Chnage Toxicity-Detector to toxicity-detector

Resources