-
Notifications
You must be signed in to change notification settings - Fork 462
Description
Description
Child item of: #3881
Description
Background
func pack
is positioned to support .NET, Python, Node, and Custom Handler projects.
For each, it'd be good to perform some basic validations to catch any issues at build-time.
UX
In the terminal output, perhaps we can add a section, "Validating project". Then, in real time, we can list the validations we are performing and whether it "PASSED" or "FAILED". We can discuss if this belongs more in a --verbose
scenario, but I do think it would be nice to convey the checks we are running.
If any validation fails, we should log the validation's title with an actionable message to self-resolve.
- Title is to help with SEO when looking for best practice resolutions. We could also create a Learn doc to map validations with resolutions.
- Actionable message is to help with self-resolution
Extra
- Let me know how I can help with actionable error messages.
- In the future, we can think more about what to do in the
--no-build
scenarios beyond the basics we put here.
Validations
.NET
Title | Validation | Notes |
---|---|---|
Validate Folder Structure | The deployment payload should match the output of a dotnet publish command, though without the enclosing parent folder. The zip archive should be made from the following files: .azurefunctions/ , extensions.json , functions.metadata , host.json , worker.config.json , any project executables (a console app), and other supporting files and directories peered to that executable. |
Check this once dotnet publish has been run. If --no-build is specified, ensure that the directory structure is still as follows. |
Python
Title | Validation | Notes |
---|---|---|
Validate OS Compatibility | Check if the customer is running “func pack” from a Windows machine. | Throw a warning, noting the risk of native dependencies and recommend using --build-native-deps if they have docker installed. |
Validate Folder Structure | Check for the existence of function_app.py , requirements.txt , .python_packages/ , and host.json |
Check in the --no-build scenario as well; .python_packages/ should not be empty either; throw an error if failed |
Validate Python Programming Model | Check that the customer isn’t trying to use both V1 and V2 programming models in the same app (function_app.py and function.json should not exist) | Check in the --no-build scenario as well; throw an error if failed |
Node.js
Title | Validation | Notes |
---|---|---|
Validate Folder Structure | Check for the existence of “package.json” and “host.json” at the root. | throw an error if failed |
PowerShell
Title | Validation | Notes |
---|---|---|
Validate Folder Structure | Check for the existence of “host.json"; at least one folder contains “functions.json” | throw an error if failed |
Customer Handlers
check host.json and confirm that the custom handler executable exists. If the file is missing, we can issue a warning, since the customer may add the configuration by other methods as well.