.funcignore does not support wildcards
Adding a wildcard to the .funcignore has no effect.
cat .funcignore
*.ts
func -v
3.0.3568
func azure functionapp publish myapi --list-included-files | grep .ts | wc
10968 10968 1061578
According to https://github.com/Azure/azure-functions-core-tools/blob/db2ff784941c3f6241aea996818ba370ea441bd2/src/Azure.Functions.Cli/Common/GitIgnoreParser.cs#L8 the ignore parser is a C# reimplementation of the basically dead https://github.com/codemix/gitignore-parser which has several logic flaws and isn't compliant with the git ignore spec - see the issue tracker for that project for some of the problems and note how long ago the most recent commit is.
I recommend removing the DIY parser in favor of https://github.com/goelhardik/ignore or similar to gain full gitignore syntax compliance and less maintenance headaches.
Short term bandaid hack workaround found using BASH/ZSH.
- Move your
.funcignoreto.funcignore.source. - Add
.funcignoreto your.gitignore. - Add the following to your
package.jsonas a custom deploy command, or add as a script call in whatever tooling you use:
deploy() {
rm -f .funcignore
npm run build \
&& git ls-files --cached --others --ignored --exclude-from=.funcignore.source > .funcignore \
&& echo '.funcignore' >> .funcignore \
&& func azure functionapp publish "$@" --typescript;
}
- Commit the above changes. You want to make sure that your git history shows that the file has been moved since you don't want to commit the compiled edition the above script creates.
- Call the deploy script passing the name of your Function app.
Note that user of other languages would need to modify the above, but the user of this hack should be able to work out how to integrate it.
Is .funcignore supported syntax included in the web documentation somewhere? Couldn't find it.
@th0ger I cannot either. That said the code itself appears to be designed with the intention of using gitignore syntax, and this is supported by the posts around the introduction of the feature and the commit message that introduced it. https://github.com/Azure/azure-functions-core-tools/issues/341#issuecomment-364310826
Additionally the default funcignore file generated by the cli uses globs in gitignore style - globs that do not work at the moment.
Since this seems to be a bigger issue and will take a while to fix, should we maybe update the cli to generate files that will actually work in the meantime and add a warning to the documentation?