Search code examples
gcloudschedulerjobsgoogle-cloud-run

Cannot use GCloud CLI in Cloud Run


I would like to use GCloud CLI in my Cloud Run script. For example, to automatically create and delete jobs.

On my local pc, "gcloud scheduler jobs create ..." and "gcloud scheduler jobs delete ..." work fine. However, the same commands fail in my script. In the Cloud Run logs it says: "sh: 1: gcloud: not found".

How can I use GCloud CLI in Cloud Run? Or is there another way to automatically create and delete jobs? Thanks in advance!


Solution

  • Probably the suggestion of John Hanley is correct and a possible way to solve my problem.

    Instead I solved it by using the CloudSchedulerClient, rather than the GCloud CLI. As my Cloud Run script is written in Python, this is probably the easiest way.