Skip to content

fix(gcp): raise cloudbuild poll retry budget from 3 to 5 attempts - #2344

Merged
lionello merged 1 commit into
mainfrom
fix/gcp-cloudbuild-poll-retry-budget
Nov 21, 2026
Merged

lionello merged 1 commit into
mainfrom
fix/gcp-cloudbuild-poll-retry-budget

Conversation

@lionello

@lionello lionello commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • pollBuildWithRetry in cloudbuild.go already retries transient gRPC/auth errors during cloudbuild polling (added across Try to fix the random deadline exceeded error #2119 and fix(gcp): retry cloudbuild poll once on transient per-RPC auth 503 #2184), but the budget was only 3 attempts with a short 500ms/1s backoff.
  • Checked the last 30 cli-smoketests.yml runs in DefangLabs/defang-mvp: this exact failure mode — isTransientAuthError correctly matching a per-RPC creds failed GitHub Actions OIDC token-endpoint hiccup — showed up once (see run #44787185675), and it exhausted all 3 retries while the hiccup was still ongoing.
  • Raises pollBuildMaxAttempts from 3 to 5, giving a few more seconds of exponential backoff before giving up, consistent with the function's stated intent ("a single flake doesn't abort an in-flight deploy").

Test plan

  • go test -race -short ./pkg/clouds/gcp/... (existing TestPollBuildWithRetry_* suite references the constant directly, so it adapts automatically)
  • nix develop --command make pre-push (full repo test suite) passes
  • Note: make lint currently fails on main itself due to ~20 pre-existing gosec findings (G101/G117/G122/G705) in unrelated files, unrelated to this change — appears to be golangci-lint/gosec version drift, not something this PR introduces or fixes. Confirmed identical failure on unmodified main.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when checking the status of Google Cloud builds. Builds that take longer to report their status are now less likely to be missed during polling.

The GCP smoketest hit this transient-auth path for real: a GitHub
Actions OIDC token-endpoint hiccup outlasted the 3-attempt budget
added in #2184, so a single flake still aborted the deploy. More
headroom costs a few extra seconds of backoff on an already
multi-minute build poll.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lionello
lionello requested a review from defangdevs as a code owner November 21, 2026 01:01
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The maximum number of Cloud Build poll attempts increases from three to five.

Changes: Cloud Build Polling

Layer / File(s) Summary
Poll attempt limit
src/pkg/clouds/gcp/cloudbuild.go
pollBuildMaxAttempts increases from 3 to 5.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: Minimal · up to 99919

This change gives Cloud Build polling two more attempts before it gives up on transient authentication or gRPC errors. Failed polls may take a few extra seconds of backoff to give up. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: raising the Cloud Build poll retry budget from 3 to 5 attempts in the GCP cloud provider. The raw summary confirms that pollBuildMaxAttempts goes from 3 to 5 in src/pk…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: raising the Cloud Build poll retry budget from 3 to 5 attempts in the GCP cloud provider. The raw summary confirms that pollBuildMaxAttempts goes from 3 to 5 in src/pkg/clouds/gcp/cloudbuild.go, and the PR objectives describe the same change to pollBuildWithRetry. The title is specific and matches the changeset. The fix(gcp) prefix is a conventional-commit style label and does not affect the assessment.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 64385790-e39d-4748-916e-2a61ee1cf9b4
Commits

Reviewing files that changed from the base of the PR and between af1f3d1 and 9991966.

Files selected for processing: 1

  • src/pkg/clouds/gcp/cloudbuild.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@lionello
lionello merged commit e882670 into main Nov 21, 2026
17 checks passed
@lionello
lionello deleted the fix/gcp-cloudbuild-poll-retry-budget branch November 21, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant