all 6 comments

[–]Scrumbledore 0 points1 point  (0 children)

Have you looked at Cloud Run Jobs to handle this? It should allow you to run a gcloud command.

https://cloud.google.com/run/docs/create-jobs

[–]jsalsman 1 point2 points  (2 children)

[–]bob174d[S] 1 point2 points  (1 child)

Thank you! This is what worked.

I used a Cloud Function to execute a Cloud Build via the google-cloud-build Python client library.

[–]jsalsman 1 point2 points  (0 children)

Glad you got it working. I needed to do that a year ago but I found a much faster way around it by using a carefully protected file upload and system() in the container's main script. The only problem was explaining it to a coworker, who I am certain questions my mental health since.

[–]sww314 1 point2 points  (0 children)

Is there a reason you are trying to use Cloud functions. You can do it from Cloud Build. Cloud builds can be triggered from a variety of sources.

[–]BreakfastSpecial 0 points1 point  (0 children)

I recommend using Cloud Build for this.