datawire / forge

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

Forge fails if there is not Git remote configured #168

Open plombardi89 opened 6 years ago

plombardi89 commented 6 years ago

While working on something that uses Forge I learned that Forge requires a Git remote to operate. My guess is that this is due to the how Forge wants to interpolate repository information into the annotations / labels of created Kubernetes objects.

~/w/ambassador-examples> forge -v build
║ CONFIG: /home/plombardi/work/ambassador-examples/forge.yaml
║ [ambassador] git rev-parse --abbrev-ref HEAD
║ master
║ [ambassador] git diff --quiet HEAD .
║ [ambassador] git log --no-color -n1 --format=oneline -- .
║ kubectl apply --dry-run -f /home/plombardi/work/ambassador-examples/ambassador/.forge/k8s/ambassador -o name
║ deployment/ambassador
║ clusterrole/ambassador
║ serviceaccount/ambassador
║ clusterrolebinding/ambassador
║ service/ambassador-admin
║ service/ambassador
║ [ambassador] git remote get-url origin
║ fatal: No such remote 'origin'
║ 19 tasks run, 1 errors
║   ambassador: [exit 128]: fatal: No such remote 'origin'

This behaviour is not desirable if you're prototyping or bootstrapping a project with Forge because there is a chance you're

  1. Not using a repository yet
  2. Don't plan to use a repository.

Forge should just populated "unknown" or something similar in that case.