-
Notifications
You must be signed in to change notification settings - Fork 203
Description
The functions SDK for dotnet isolated performs an inner-restore/build/publish to discover and collect WebJobs extensions required to support worker extensions. This works fine for most cases; however, it is a headache when using secure/compliant builds. These secure builds often have network access only during restore phase and our design requires it during build phase. The end result is build failures due to no network access for the inner-build.
After having synced with the dotnet, msbuild, and nuget teams it is not feasible for us to participate in the restore target. We do not have enough information at restore time and rely on targets that are a part of build. The best option we came up with is to provide a tool, probably as part of func cli, which can generate this inner WorkerExtensions.csproj and have it checked in as part of source control. Customers can then include this project as part of their restore phase. This will be a tool only for customers with this strict network requirements.
Work Needed
- Updated SDK build targets to recognize and use a pre-existing
WorkerExtensions.csproj - Create a tool to generate said
WorkerExtensions.csprojand to point the function worker csproj to this generate project.
Workaround
To workaround this issue today, you can avoid requiring network for restore by pre-restoring the necessary packages ahead of time.
- Build function app locally
- Copy
WorkerExtension.csprojinto your solution and ensure it is part of your builds restore phase- Can find the file path from the build logs. Or if using
1.17.3-preview*SDK, the project will be in intermediate output directory (obj) of your function app - If using central package management, replace
VersionwithVersionOverride
- Can find the file path from the build logs. Or if using
The goal is to just have those set of PackageReference from WorkerExtension.csproj be restored ahead of time, so those packages are cached locally. This way the inner-build's restore will be 100% cache hits and never access the network.