skip to Main Content

I’ve set up a Google Cloud Run with continuous deployment to a github, and it redeploys every time there’s a push to the main (what I what), but when I go to check the site, it hasn’t updated the HTML I’ve been testing with. I’ve tested it on my local machine, and it’s updating the code when I run the Django server, so I’m guessing it’s something with my cloudbuild.yml? There was another post I tried to mimic, but it didn’t take.

Any advice would be very helpful! Thank you!

cloudbuild.yml:

steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/${PROJECT_ID}/exeplore', './ExePlore']
# Push the image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
  args: ['push', 'gcr.io/${PROJECT_ID}/exeplore']
# Deploy image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
  args:
  - 'run'
  - 'deploy'
  - 'exeplore'
  - '--image'
  - 'gcr.io/${PROJECT_ID}/exeplore'
  - '--region'
  - 'europe-west2'
  - '--platform'
  - 'managed'
images:
- gcr.io/${PROJECT_ID}/exeplore

Here are the variables for GCR

Edit 1: I’ve now updated my cloudbuild, so the SHORT_SHA is all gone, but now google cloud run is saying it can’t find my manage.py at /Exeplore/manage.py. I might have to trial and error it, as running the container locally is fine, and same with running the server locally. I have yet to try what Ezekias suggested, as I’ve tried rolled back to when it was correctly running the server and it doesn’t like that.

Edit 2: I’ve checked the services, it is at 100% Latest

2

Answers


  1. Check your Cloud Run service, either on the Cloud Console or by running gcloud run services describe. It may be set to serve traffic to a specific revision instead of having 100% of traffic serving LATEST.

    If that’s the case, it won’t automatically move traffic to the new revision when you deploy. If you want it to automatically switch to the new update, you can run gcloud run services update-traffic --to-latest or use the "Manage Traffic" button on the revisions tab of the Cloud Console to set 100% of traffic to the latest healthy revision.

    Login or Signup to reply.
  2. It looks like you’re building gcr.io/${PROJECT_ID}/exeplore:$SHORT_SHA, but pushing and deploying gcr.io/${PROJECT_ID}/exeplore. These are essentially different images.

    Update any image variables to include the SHORT_SHA to ensure all references are the same.


    To avoid duplication you may also want to use dynamic substitution variables

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search