carvel-dev / carvel-dev/vendir
remove manual source in favor of using directory source
- Dominant language
- Go
- Stars
- 399
- Forks
- 73
- Avg merge
- 2h 53m
- Merged PRs (30d)
- 2
Description
If `vendir sync` fails, manually managed directories might be deleted.
There are two paths in the config: 1) manually managed `lib/manifests`, 2) Non-existing `git` `lib/bin`
```yaml
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: lib
contents:
- path: manifests
manual: {}
- path: bin
git:
url: https://github.com/k14s/vendir
ref: origin/master
includePaths:
- bin/non-existing
newRootPath: bin
```
Dir structure before `sync`:
```
.
├── lib
│ └── manifests
│ └── tpl.yaml
└── vendir.yml
```
After `sync`:
```
.
├── lib
└── vendir.yml
```
As far as I understand, `vendir` processes paths in the order they're defined in the configuration. For manually managed paths it moves them into temporary space. If one of the next paths can't be ensured due some error, the path previously moved to the temporary space is not moved back.
If I change the order of the paths, `lib/manifests` directory stay intact.
It looks like a bug and might lead to data loss (files and staged changes can be restored from git or from IDE history, but still).
Contributor guide
Assessment
This issue has not been assessed yet.