Skip to content

fix: use dedicated buildx builder instance in cloud build - #5881

Merged
cuixq merged 2 commits into
google:masterfrom
cuixq:fix
Aug 21, 2026
Merged

fix: use dedicated buildx builder instance in cloud build#5881
cuixq merged 2 commits into
google:masterfrom
cuixq:fix

Conversation

@cuixq

@cuixq cuixq commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Second try for #5692

Cloud Build steps building Go images (such as build-importer) have been intermittently failing with the following error:

ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: frontend grpc server closed unexpectedly

#5874 tried to fix the issue by pinning # syntax=docker/dockerfile:1.4:

  • Even when pinned to an older version (1.4) that introduced --build-context, the fundamental mechanism still relied on spawning an ephemeral helper container over gRPC (gateway.v0).
  • The underlying host daemon's runtime and memory pressure during Go builds still caused the gRPC connection to the helper container to terminate unexpectedly (frontend grpc server closed unexpectedly).

Instead of attempting to patch the parser on top of an outdated host daemon, we spin up a dedicated, standalone modern BuildKit daemon container:

  1. Added setup-buildx step in deployment/build-and-stage.yaml:
    • Executes docker buildx create --name osv-builder --use --driver-opt network=host.
    • Starts an official moby/buildkit container with modern BuildKit and native --build-context support.
  2. Shared docker-config Volume:
    • Mounts /root/.docker across all buildx steps so each step container seamlessly connects to and reuses the osv-builder instance.
  3. --load Flag:
    • Exports the built images from the BuildKit container back into the local Docker daemon image store so standard docker push steps work without modification.
  4. Removed # syntax= headers:
    • Removed from go/Dockerfile and go/cmd/osv-linter-worker/Dockerfile since the modern BuildKit instance handles --build-context natively without needing external gateway containers.

@cuixq
cuixq marked this pull request as ready for review August 21, 2026 03:29
@cuixq
cuixq merged commit 4db84c9 into google:master Aug 21, 2026
25 checks passed
@cuixq
cuixq deleted the fix branch August 21, 2026 04:33
cuixq added a commit that referenced this pull request Aug 21, 2026
Hope this is the last try for
#5692...

In #5877, `recoverer` was migrated to Go and added as a `buildx build`
step in `deployment/build-and-stage.yaml`. However, it was missing
`--load` and the shared `docker-config` volume introduced in #5881. As a
result, the built image was retained inside the `osv-builder` container
and never loaded into the host Docker daemon's image store.
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.

2 participants