Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.funcignore does not support wildcards #2701

Open
coderbyheart opened this issue Sep 2, 2021 · 5 comments
Open

.funcignore does not support wildcards #2701

coderbyheart opened this issue Sep 2, 2021 · 5 comments
Labels

Comments

@coderbyheart
Copy link

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
@kf6kjg
Copy link

kf6kjg commented Aug 27, 2022

According to

/// This is a C# reimplementation of https://github.com/codemix/gitignore-parser
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.

@kf6kjg
Copy link

kf6kjg commented Dec 22, 2022

Short term bandaid hack workaround found using BASH/ZSH.

  1. Move your .funcignore to .funcignore.source.
  2. Add .funcignore to your .gitignore.
  3. Add the following to your package.json as 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;
}
  1. 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.
  2. 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.

@th0ger
Copy link

th0ger commented Aug 15, 2023

Is .funcignore supported syntax included in the web documentation somewhere? Couldn't find it.

@kf6kjg
Copy link

kf6kjg commented Aug 15, 2023

@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. #341 (comment)

Additionally the default funcignore file generated by the cli uses globs in gitignore style - globs that do not work at the moment.

@jp-hoehmann
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants