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

bug : look like manala can't create folder recursively when calling file from siblings (../) #26

Open
loic-roux-404 opened this issue Mar 2, 2021 · 9 comments

Comments

@loic-roux-404
Copy link

loic-roux-404 commented Mar 2, 2021

It's a special case

on recipe side

manala:
    description: Python
    sync:
      - ../.manala.yaml.tmpl.dist .manala.yaml.tmpl.dist
      # CI / CD
      - .manala/tests/
      - ../.github/workflows/auto-merge.yml .github/workflows/auto-merge.yml

project side

manala init --repository=/Users/loic/Ops/manala-recipes                                            
   • Synced file               path=.manala.yaml
   • Synced directory          path=.manala/tests
   ⨯ open .github/workflows: no such file or directory

Also with a single file (previous case was a sub folder)

manala init --repository=/Users/loic/Ops/manala-recipes                                              
   • Synced file               path=.manala.yaml
   ⨯ open .github/PULL_REQUEST_TEMPLATE.md: no such file or directory

Capture of all y retries :

I had created the folder .github in vscode, it's fix the error and can be a workaround for now

Screenshot 2021-03-02 at 23 34 26

@loic-roux-404 loic-roux-404 changed the title bug : look like manala can't create recursively folders when calling file from siblings bug : look like manala can't create folder recursively when calling file from siblings (../) Mar 2, 2021
@nervo
Copy link
Member

nervo commented Mar 5, 2021

Ok, could you try like this ?

manala:
    description: Python
    sync:
      # "../" is implicit, you don't nee to prefix each entry
      # also, second parameter is useless, it's defaulted to the same file/directory name, removing tmlp and dist extensions
      - .manala.yaml.tmpl.dist
      # you don't need trailing slash for directories, but it should work with :)
      - .manala/tests
      # try to promote "yaml" extension instead of "yml" :)
      - .github/workflows/auto-merge.yml

@loic-roux-404
Copy link
Author

loic-roux-404 commented Mar 5, 2021

I'm sharing files between various recipes because some are really simple and don't need their own configuration (like .manala.yaml.tmpl.dist)

for exemple here my folder structure :

|------.github --> shared files for each recipe
├── dev.python
            - .gitignore
            - .vscode/settings.json
├── dev.python-vm
├── dev.sf-light
| .manala.yaml.tmpl.dist --> shared file for each recipe

from dev.python i want to sync .manala.yaml.tmpl.dist, which is in the parent directory so i absolutely need to use the ../ to find it.

I know it's probably not the recommanded way but i prefer to avoid Copy paste for now

Also

For the use of each files instead of just the folder, its because of a behaviour i have sometimes and for better readability of my files in recipes.

For the behaviour, i have sometimes losted some local files (not managed by manala) when using manala up with a recipe using a - .github/ in synced files.

I don't know if it's normal but i got the use to it to secure my edits.

@nervo
Copy link
Member

nervo commented Mar 5, 2021

Hm, nice trick :)
i have something in mind to handle this properly: a "library" recipe type where you can store common dependencies. Coming (i hope) soon.

@loic-roux-404
Copy link
Author

loic-roux-404 commented Mar 5, 2021

It can be a great feature !

@nervo
Copy link
Member

nervo commented Mar 5, 2021

For your .github folder, you should remove it from manala, store local actions in .manala folder, and use them on demand in your project github actions. That's just my two cents :)

Anyway :)

So your bug can be resumed as this:

manala:
    ...
    sync:
      ...
      - ../.github/workflows/auto-merge.yml .github/workflows/auto-merge.yml

In this particular situation (using ../ path prefix in source) github/workflows destination parent directories are not created, am i true ?
Could you run it in debug mode (-d) and copy/paste the logs ?

@loic-roux-404
Copy link
Author

Look like manala think file exist before syncing

   • Searching project...      dir=.tests/dev.python/
   • Loading project...        dir=.tests/dev.python
   • Project loaded            recipe=dev.python repository=/Users/loic/Ops/manala-recipes
   • Loading dir repository... src=/Users/loic/Ops/manala-recipes
   • Repository loaded
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.cpp
   • Loading recipe...         name=dev.cpp
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.deno
   • Loading recipe...         name=dev.deno
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.go
   • Loading recipe...         name=dev.go
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.java
   • Loading recipe...         name=dev.java
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.node
   • Loading recipe...         name=dev.node
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.python
   • Loading recipe...         name=dev.python
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.python-vm
   • Loading recipe...         name=dev.python-vm
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.sf-light
   • Loading recipe...         name=dev.sf-light
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/dev.vue
   • Loading recipe...         name=dev.vue
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/ops.cd
   • Loading recipe...         name=ops.cd
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/ops.docker
   • Loading recipe...         name=ops.docker
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/ops.playbook
   • Loading recipe...         name=ops.playbook
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/ops.role
   • Loading recipe...         name=ops.role
   • Searching recipe...       dir=/Users/loic/Ops/manala-recipes/ops.vagrant
   • Loading recipe...         name=ops.vagrant
   • Recipe loaded
   • Project validated
   • Syncing file...           dst=.tests/dev.python/.github/workflows/auto-merge.yaml src=/Users/loic/Ops/manala-recipes/.github/workflows/auto-merge.yaml
   ⨯ open .tests/dev.python/.github/workflows/auto-merge.yaml: no such file or directory

@nervo
Copy link
Member

nervo commented Mar 5, 2021

Ok, i will try to reproduce !

@loic-roux-404
Copy link
Author

loic-roux-404 commented Mar 5, 2021

If you want : https://github.com/loic-roux-404/manala-recipes

you can do a DEBUG=1 ./.tests/run.sh dev.python inside

it will fail with same log

@loic-roux-404
Copy link
Author

loic-roux-404 commented Mar 7, 2021

Also, you can check manala not loosing local project files when syncing a full directory with manala

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

No branches or pull requests

2 participants