Ensure wwwroot directory exists on new slot and app creation w/ networking restrictions#11757
Ensure wwwroot directory exists on new slot and app creation w/ networking restrictions#11757
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Ensures the worker process working directory is created when missing (e.g., new deployment slots/apps) and adds a unit test to cover the behavior.
Changes:
- Create the worker process working directory on demand before building the
ProcessStartInfo. - Add a unit test validating the working directory is created and applied to the worker
ProcessStartInfo.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs | Adds a unit test validating missing working directories are created and used. |
| src/WebJobs.Script.Grpc/ProcessManagement/DefaultWorkerProcessFactory.cs | Creates the working directory if it doesn’t exist before creating the worker process. |
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogWarning(ex, "Failed to create working directory '{workingDirectory}'. The worker process may fail to start.", context.WorkingDirectory); |
There was a problem hiding this comment.
If directory creation fails, the method continues and will likely fail later when starting the process with a non-existent WorkingDirectory, producing a less actionable error. Consider failing fast by rethrowing (or throwing a dedicated exception), or explicitly clearing/falling back the working directory when creation fails so the process can still start deterministically.
| _logger.LogWarning(ex, "Failed to create working directory '{workingDirectory}'. The worker process may fail to start.", context.WorkingDirectory); | |
| _logger.LogWarning(ex, "Failed to create working directory '{workingDirectory}'.", context.WorkingDirectory); | |
| throw new InvalidOperationException($"Failed to create working directory '{context.WorkingDirectory}' for the worker process.", ex); |
There was a problem hiding this comment.
I think the current failure behavior (diagnostic error saying no directory is found) is sufficient and this log adds more information upon investigation.
Issue describing the changes in this PR
resolves #11654
Pull request checklist
IMPORTANT: Currently, changes must be backported to the
in-procbranch to be included in Core Tools and non-Flex deployments.in-procbranch is not requiredrelease_notes.md