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

[Issue] Symlinks ignored when zipping for app service deployment #4715

Open
jjgriff93 opened this issue Jan 22, 2025 · 2 comments · May be fixed by #4768 or #4773
Open

[Issue] Symlinks ignored when zipping for app service deployment #4715

jjgriff93 opened this issue Jan 22, 2025 · 2 comments · May be fixed by #4768 or #4773
Labels
app service customer-reported identify a customer issue

Comments

@jjgriff93
Copy link
Member

Output from azd version
azd version 1.11.1 (commit ae08ceba17c7078c547df9ee5f97e9e7ceb2fe53)

Describe the bug
We have the following azure.yaml:

# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

name: ai-document-review
metadata:
  template: [email protected]
infra:
  provider: terraform
services:
  app:
    project: app/api
    host: appservice
    language: python
    hooks:
      # Build the UI code into the API's www directory.
      prepackage:
        shell: sh
        run: 'task app-build-ui'
  flows:
    project: flows
    host: appservice
    language: python

The app service is a FastAPI Python application, and it consumes a set of common utils in our monorepo from the top-level directory (in a folder called common). To reference these we use a symlink within the app/api directory:

Image

When trying to deploy the service with azd up, we run into the following challenge:

ERROR: error executing step command 'package --all': failed packaging service 'app': open /var/folders/kl/dwz9d6xx5jx9s3ygwtqc5q_c0000gn/T/azd2971955672/common: no such file or directory

Which I've tracked down to the copy implementation in the cli:

func buildForZip(src, dst string, options buildForZipOptions) error {

It seems it uses this library and doesn't pass any options for:

OnSymlink func(src string) SymlinkAction

Which defaults to ignoring them: https://github.com/otiai10/copy/blob/5ef5923d6ff098ea7a51792c1ec963d04fad9794/copy.go#L307

To Reproduce

  1. Create new Python App Service azd template with an appservice service in the azure.yaml config
  2. Add common folder to root and create dummy util
  3. Add symlink to common within src/api directory
  4. Call the util from the api main.py
  5. azd up

Expected behavior
Symlinks should be respected and Deep copied, or failing that a new option should be introduced to enable this

Environment

  • Mac M3, Python 3.12.8
@weikanglim
Copy link
Contributor

This is indeed right, we had previously discovered this when landing #4381.

We should support symlinks.

@hemarina hemarina added app service customer-reported identify a customer issue labels Jan 30, 2025
@jjgriff93
Copy link
Member Author

Raised a PR #4768

@jjgriff93 jjgriff93 linked a pull request Feb 6, 2025 that will close this issue
@weikanglim weikanglim linked a pull request Feb 7, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app service customer-reported identify a customer issue
Projects
None yet
3 participants