Fix crash when .dockerignore is missing during cloud build#315
Merged
danielmillerp merged 1 commit intomainfrom Apr 9, 2026
Merged
Fix crash when .dockerignore is missing during cloud build#315danielmillerp merged 1 commit intomainfrom
danielmillerp merged 1 commit intomainfrom
Conversation
The build context preparation crashes with FileNotFoundError when a manifest specifies a dockerignore path but the file doesn't exist on disk. This adds an existence check and logs a warning instead of crashing, so builds proceed with no ignore patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BuildContextManager.__enter__crashes withFileNotFoundErrorwhen a manifest declares a.dockerignorepath but the file doesn't exist on disksgpctl agentex-cloud build submitto fail for any agent created without a.dockerignore(e.g. manually created agents that didn't useagentex init)Test plan
.dockerignorepresent (no behavior change).dockerignore(previously crashed, now warns and continues)🤖 Generated with Claude Code
Greptile Summary
Adds a
dockerignore_path.exists()guard inBuildContextManager.__enter__so a missing.dockerignorefile emits a warning and falls back to an empty ignore-patterns list instead of raisingFileNotFoundError. The change is minimal, correctly scoped, and the existingignore_patterns = []initialisation on line 92 ensures directory-copy logic downstream still receives a valid list.Confidence Score: 5/5
Safe to merge — fix is minimal, correct, and handles the missing-file case gracefully with no regressions.
No P0 or P1 findings. The existence check is correctly placed,
ignore_patternsis already initialised to[]before the guard so downstream logic is unaffected, and the warning follows the f-string logging convention used throughout the file.No files require special attention.
Vulnerabilities
No security concerns identified. The new warning log records a local file path, which is expected and benign in a build-tool context.
Important Files Changed
.dockerignore; gracefully warns and continues when file is absent. Logic is correct and consistent with the rest of the file's f-string logging style.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[__enter__ called] --> B[Copy Dockerfile to temp dir] B --> C{dockerignore path configured?} C -- No --> F[ignore_patterns = empty list] C -- Yes --> D{dockerignore_path.exists?} D -- Yes --> E[Copy .dockerignore and extract patterns] D -- No --> G[Log warning, keep ignore_patterns empty] E --> H[add_directory for each include_path] F --> H G --> H H --> I[Return self]Reviews (1): Last reviewed commit: "Fix crash when .dockerignore file is mis..." | Re-trigger Greptile