You can increase the timeout for your build by setting the timeout field in your cloudbuild.yaml or cloudbuild.json file.
Example yaml:
steps: - args: - build - -t - us.gcr.io/<...>/<...>:$BRANCH_NAME - . name: gcr.io/cloud-builders/docker timeout: 900s # Step timeout set to 15 minutes tags: - trigger-<...> timeout: 900s # Set overall build timeout to 15 minutes
Use the gcloud builds submit command with the –timeout flag to set a global timeout temporary/one-time to a specific build.
Example:
gcloud builds submit –timeout=900s
This command sets the default timeout for Cloud Build in your gcloud configuration.
It changes the configuration locally for your user or project, so all future build submissions (unless overridden) will use this default timeout setting.
Example:
gcloud config set builds/timeout 900
High resource consumption (e.g., CPU, memory) can cause builds to time out. Ensure that:
Example yaml:
options:
machineType: "N1_HIGHCPU_8" # Use a higher CPU machine type
Build Configuration: Ensure your cloudbuild.yaml file is optimized for performance.
Caching: Utilize caching to reduce build times by reusing artifacts.
Parallel Execution: Break down your build into parallel steps to improve efficiency.
Network Optimization: Minimize network latency and bandwidth usage.