azure-functions-core-tools
azure-functions-core-tools copied to clipboard
`publish` should preserve executable bits on files
Description
Currently, func azure functionapp publish --custom will check the defaultExecutablePath in host.json and only set the executable permission on that file (if it exists). There are some issues with this:
- It's possible to override any host.json setting, including the
defaultExecutablePathusing app settings. One example is if local development and prod deployment use different binaries; one can configure host.json with the local executable path, and configure an app setting in the cloud to override that value in production. In this case, the executable permission isn't set on the production binary. - It's possible that multiple files need executable permissions. Looks like this isn't possible today.
It would be great if the logic can be updated such that:
- On posix file systems, the zip file retains the original permissions in the files.
- On Windows file systems, enable read and execute permission on every file in the zip. There's a precendent for this in Docker, where all files copied from Windows into the image have
755permissions by default.
Also consider printing a warning if the detected default executable is missing (although this might cause confusion where the default executable is expected to be in the PATH, such as python or dotnet).