datawire / forge

Define and run multi-container apps in Kubernetes
http://forge.sh
Apache License 2.0
417 stars 44 forks source link

Forge attempts to pull in non-git folders, which results in a lockfile collision with git #109

Closed tristanpemble closed 6 years ago

tristanpemble commented 6 years ago

When using forge pull, it seems to be running git pull within any service that it finds, regardless of if it is a git repository, or if it has already tried to pull for the repository the service exists in. It should probably do something to make sure that it only pulls once per Git repository.

Reproducible from latest commit on https://github.com/forge-playground/development-environment

λ tree
.
├── README.md
├── forge.yaml
├── k8s
├── service.yaml
├── services
│   ├── local-example1
│   │   ├── k8s
│   │   └── service.yaml
│   └── local-example2
│       ├── k8s
│       └── service.yaml
└── workspace
    └── customer-portal
        ├── Dockerfile
        ├── k8s
        │   └── deployment.yaml
        └── service.yaml

9 directories, 8 files

λ forge pull
║ cloning git@github.com:forge-playground/admin-portal.git->.forge/admin-portal
║ cloning git@github.com:forge-playground/customer-portal.git->.forge/customer-portal
║ cloning git@github.com:forge-playground/payment-processor.git->.forge/payment-processor
║ cloning git@github.com:forge-playground/message-broker.git->.forge/message-broker
║ git pull
║ Already up-to-date.
║ [.forge/customer-portal] git pull
║ Already up-to-date.
║ [.forge/payment-processor] git pull
║ Already up-to-date.
║ [.forge/customer-portal/services/local-example3] git pull
║ Already up-to-date.
║ [.forge/customer-portal/services/local-example4] git pull
║ Already up-to-date.
║ [.forge/message-broker] git pull
║ Already up-to-date.
║ [services/local-example1] git pull
║ Already up-to-date.
║ [.forge/admin-portal] git pull
║ Already up-to-date.
║ [services/local-example2] git pull
║ Already up-to-date.
║ 83 tasks run, 0 errors
║

λ forge pull
║ [.forge/customer-portal] git pull
║ Already up-to-date.
║ [.forge/message-broker] git pull
║ Already up-to-date.
║ git pull
║ Already up-to-date.
║ [services/local-example1] git pull
║ fatal: Unable to create '/Projects/development-environment/.git/ORIG_HEAD.lock': File exists.
║
║ Another git process seems to be running in this repository, e.g.
║ an editor opened by 'git commit'. Please make sure all processes
║ are terminated then try again. If it still fails, a git process
║ may have crashed in this repository earlier:
║ remove the file manually to continue.
║ [.forge/admin-portal] git pull
║ Already up-to-date.
║ [services/local-example2] git pull
║ Already up-to-date.
║ [.forge/payment-processor] git pull
║ Already up-to-date.
║ [.forge/customer-portal/services/local-example3] git pull
║ Already up-to-date.
║ [.forge/customer-portal/services/local-example4] git pull
║ Already up-to-date.
║ 71 tasks run, 1 errors
║   local-example1: command '[services/local-example1] git pull' failed[128]: fatal: Unable to create '/Projects/development-environment/.git/ORIG_HEAD.lock': File exists.
║
║ Another git process seems to be running in this repository, e.g.
║ an editor opened by 'git commit'. Please make sure all processes
║ are terminated then try again. If it still fails, a git process
║ may have crashed in this repository earlier:
║ remove the file manually to continue.

notice how it is running git pull in services/*, and the error with lock files

rhs commented 6 years ago

This should be fixed in 0.3.21