Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
406 stars 196 forks source link

[Issue] Deployed zip does not obey .funcignore #1039

Open pamelafox opened 1 year ago

pamelafox commented 1 year ago

Output from azd version

azd version 0.3.0-beta.4-pr.1945868 (commit 3aadf6dc4c842ba6813e423e4e9d6788e6dff200)

Output from az version

{
  "azure-cli": "2.40.0",
  "azure-cli-core": "2.40.0",
  "azure-cli-telemetry": "1.0.8",
  "extensions": {
    "containerapp": "0.3.11",
    "containerapp-compose": "0.2.2"
  }
}

Describe the bug

I'm fairly certain that azd is zipping up everything in the folder and not ignoring files/folders in funcignore which I would expect to be ignored.

I suspect that because 1) zipping my little function folder takes a lot longer than I'd expect and 2) I see no evidence of funcignore parsing in codebase, and I see this TODO here about ignoring files: https://github.com/Azure/azure-dev/blob/a74e800f053779cb97e365068b80c879c328c2a9/cli/azd/pkg/project/internal/project_utils.go#L16

To Reproduce

  1. git clone https://github.com/pamelafox/regression-model-azure-demo at 6d8c7e76981186663f888a1f7cd55308b2ce0f3f
  2. Run azd up
  3. Browse "App Files" in Azure Portal, still see .DS_Store

Expected behavior

I expect it to not zip up files/folders specified in .funcignore

Environment

Mac OS X Ventura

Additional context

I can reorganize my project structure to avoid such a large deploy, but I think it'd be good to support .funcignore for consistency with other ways to deploy function apps.

ashikns commented 6 months ago

+1 to this issue. I've had to restructure a project to avoid the frontend node_modules folder getting published. Another problem is that local.settings.json also gets published, which can contain sensitive info like connection strings.

Is there any workaround to this issue?

jongio commented 3 weeks ago

@pamelafox and @ashikns - I have a PR out that should resolve this issue. Can you please try that PR and confirm is resolves this?

https://github.com/Azure/azure-dev/pull/4258

You will need to add a .funcignore file to the root of the service folder you want azd to honor.

/src/service1/.funcignore.

Thanks Jon