google-cloud-platformgoogle-cloud-functionsgoogle-cloud-pubsubretry-logic

Google Cloud - Set default retry for Cloud function in cloudbuild


I want to know if there's a way to configure the "Retry on failure" trigger policy directly in the Cloud Function's yaml. As for now I found docs about Workflows or to simply flag it from the UI (which I did). My doubt is if I deploy again and again my CF, this flag will be lost since it's not in the cloudbuild.yaml, where I configured my topic subscription.

This is my cloud build:

steps:
- name: 'build-step'
  args:
  - gcloud
  - functions
  - deploy
  - my-cf-name
  - --region=europe
  - --source=.
  - --trigger-topic=my-topic-name
  - --runtime=python310
  - --entry-point=my-entry-point
  - --timeout=540s
  - --env-vars-file=env.yaml
  - --service-account=my-service@account

Any tip will be appreciated, thank you.


Solution

  • You can try to use the --retry flag.

    Docs are here