Mutagen file sync in devMode using absolute paths ...
# 🌱|help-and-getting-started
q
In a recent release of Garden, support for syncing of files outside of the garden module's root using absolute paths instead of relative ones was supposed to have been implemented. However, in my testing locally it appears like files aren't being synced. My test scenario was like this. First I tested the module using a relative reference to a file I wanted to sync: /src/my-test-service/garden/garden.yaml
Copy code
type: container
name: my-test-container
services:
  - name: "my-test-http"
    devMode:
      sync:
        - source: Dockerfile
          target: /Dockerfile
Then I exec into the container and verify that the Dockerfile has been mounted to /Dockerfile Next, I modified /src/my-test-service/garden/garden.yaml like so:
Copy code
type: container
name: my-test-container
services:
  - name: "my-test-http"
    devMode:
      sync:
        - source: /src/my-test-service/garden/Dockerfile
          target: /Dockerfile
And after deploying again in dev mode, the /Dockerfile mount does not show up. Is this a possible regression, or is there any chance that absolute paths weren't field tested before being marked as supported?
Some additional info that might help. I used the mutagen.sh script packaged with Garden to print out the syncs. For the non-working sync, I can see it's appending the module root directory to the sync URL
Copy code
Name: Deployment--my-garden--my-test-http-1
Identifier: sync_pqxnin5Ri2b4PxliS4Fmu177aLY0hTppFKzN851EFuX
Alpha:
        URL: /src/my-test-service/garden/src/my-test-service/garden/Dockerfile
        Connected: Yes
        Synchronizable contents:
                0 directories
                0 files (0 B)
                0 symbolic links
Beta:
        URL: exec:'/workspace/.garden/tools/kubectl/49eb930aa565a80f/kubectl exec -i --context=my-cluster --namespace=my-garden --container my-test-http Deployment/my-test-http -- /.garden/mutagen-agent synchronizer':/Dockerfile
        Connected: Yes
        Synchronizable contents:
                0 directories
                0 files (0 B)
                0 symbolic links
Status: Watching for changes
--------------------------------------------------------------------------------
One additional follow up - it looks like even though absolute paths are not treated as absolute, using the posix notation like "../../" does work in this context and allows us to sync files outside of the module root. So I think this is a combination of a bug and/or inaccurate docs.
c
Thanks for reporting this @quaint-librarian-55734! Absolute paths were allowed in https://github.com/garden-io/garden/pull/3145 And it looks the changes made in the PR above were not enough to support it. There is a path concatenation with module root here: https://github.com/garden-io/garden/blob/main/core/src/plugins/kubernetes/dev-mode.ts#L153 And it's unnecessary when an absolute path is used. I'll check this and will try to submit a fix PR in asap.
I fixed the path construction in https://github.com/garden-io/garden/pull/3447 - it will be released in
0.12.48
16 Views