Skip to content

Fix devspace build-container-localdev race - #4669

Open
kensimon wants to merge 1 commit into
NVIDIA:mainfrom
kensimon:fix-devspace-buid-container-race
Open

Fix devspace build-container-localdev race#4669
kensimon wants to merge 1 commit into
NVIDIA:mainfrom
kensimon:fix-devspace-buid-container-race

Conversation

@kensimon

@kensimon kensimon commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

See #3106: If the build container doesn't exist yet, three different builds try to crate it at the same time and only one of them "wins", failing the first build.

Fix it by making an explicit before:build step that ensures build-container-localdev exists.

Related issues

#3106

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

See NVIDIA#3106: If the build container doesn't exist yet, three different
builds try to crate it at the same time and only one of them "wins",
failing the first build.

Fix it by making an explicit before:build step that ensures
build-container-localdev exists.
@kensimon
kensimon requested a review from a team as a code owner August 6, 2026 14:03
@kensimon kensimon added this to the v2.2 milestone Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • Chores
    • Streamlined local development image builds.
    • Added a pre-build step to ensure the shared build container is created when needed.
    • Removed redundant checks during individual image builds.

Walkthrough

The DevSpace configuration moves the shared build-container-localdev existence check into a before:build hook. The three custom image commands retain their application image builds without repeating the base-image check.

Changes

Local build preparation

Layer / File(s) Summary
Centralized base-image build hook
devspace.yaml
The before:build hook builds build-container-localdev when it is absent. The nico-api, nico-bmc-proxy, and machine-a-tron image commands remove their repeated conditional build steps.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the race condition, the fix, the related issue, and the testing performed.
Title check ✅ Passed The title clearly identifies the build race condition fixed by the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
devspace.yaml (1)

49-50: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Serialize the base-image build

The global before:build hook is serialized only within one DevSpace invocation. Separate devspace build processes can both pass docker image inspect before either creates build-container-localdev.

Use an inter-process lock or another mechanism that serializes this build for all three application images.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@devspace.yaml` around lines 49 - 50, Update the before:build workflow around
the application image build command to use an inter-process lock or equivalent
cross-process serialization, ensuring all three application image builds cannot
concurrently pass the base-image check and create build-container-localdev.
Preserve the existing Docker build behavior while applying the shared
synchronization across separate devspace build invocations.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@devspace.yaml`:
- Around line 49-50: Update the before:build workflow around the application
image build command to use an inter-process lock or equivalent cross-process
serialization, ensuring all three application image builds cannot concurrently
pass the base-image check and create build-container-localdev. Preserve the
existing Docker build behavior while applying the shared synchronization across
separate devspace build invocations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6dc44d98-adf2-4f4e-b1d7-34a7f5429ede

📥 Commits

Reviewing files that changed from the base of the PR and between 4f0e11f and 4680efd.

📒 Files selected for processing (1)
  • devspace.yaml

@pbreton pbreton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

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.

bug(devspace): first deploy races on shared build-container-localdev image

2 participants