deis / deisrel

A releaser tool for Deis
MIT License
5 stars 13 forks source link

Panic if new component added to JSON file #123

Closed mboersma closed 8 years ago

mboersma commented 8 years ago

registry-proxy was added in this release, but when I naively added it to my local JSON components mapping, deisrel errored:

$ deisrel ~/.helmc/workspace/charts/workflow-v2.2.0/tpl/generate_params.toml comps.json 
panic: interface conversion: interface {} is nil, not map[string]interface {} [recovered]
    panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 1 [running]:
panic(0x46ea80, 0xc8200fb3c0)
    /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6
github.com/deis/deisrel/vendor/github.com/urfave/cli.HandleAction.func1(0xc8200e9ad8)
    /Users/matt/Projects/src/github.com/deis/deisrel/vendor/github.com/urfave/cli/app.go:476 +0x417
panic(0x46ea80, 0xc8200fb3c0)
    /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:443 +0x4e9
github.com/deis/deisrel/components.CheckVersions(0xc8200f61e0, 0xc8200f67b0, 0xc820108360, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/matt/Projects/src/github.com/deis/deisrel/components/components.go:35 +0xa01
main.main.func1(0xc820112000, 0x0, 0x0)
    /Users/matt/Projects/src/github.com/deis/deisrel/main.go:90 +0x9db
reflect.Value.call(0x3b8a60, 0xc8200f2150, 0x13, 0x500228, 0x4, 0xc8200e9a38, 0x1, 0x1, 0x0, 0x0, ...)
    /usr/local/Cellar/go/1.6.2/libexec/src/reflect/value.go:435 +0x120d
reflect.Value.Call(0x3b8a60, 0xc8200f2150, 0x13, 0xc8200e9a38, 0x1, 0x1, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.6.2/libexec/src/reflect/value.go:303 +0xb1
github.com/deis/deisrel/vendor/github.com/urfave/cli.HandleAction(0x3b8a60, 0xc8200f2150, 0xc820112000, 0x0, 0x0)
    /Users/matt/Projects/src/github.com/deis/deisrel/vendor/github.com/urfave/cli/app.go:485 +0x2ee
github.com/deis/deisrel/vendor/github.com/urfave/cli.(*App).Run(0xc82010c000, 0xc820062180, 0x3, 0x3, 0x0, 0x0)
    /Users/matt/Projects/src/github.com/deis/deisrel/vendor/github.com/urfave/cli/app.go:244 +0xb05
main.main()
    /Users/matt/Projects/src/github.com/deis/deisrel/main.go:134 +0x5f1
$ cat comps.json 
{
  "builder": ["builder"],
  "controller": ["controller"],
  "dockerbuilder": ["dockerbuilder"],
  "fluentd": ["fluentd"],
  "monitor": ["influxdb", "grafana", "telegraf"],
  "logger": ["logger"],
  "minio": ["minio"],
  "nsq": ["nsqd"],
  "postgres": ["database"],
  "redis": ["loggerRedis"],
  "registry": ["registry"],
  "registry-proxy": ["registry_proxy"],
  "router": ["router"],
  "slugbuilder": ["slugbuilder"],
  "slugrunner": ["slugrunner"],
  "workflow-manager": ["workflowManager"]
}

Running the same command against the workflow-dev chart does not cause an error since registry_proxy is in there, but then we can't see the previous semver tags, just canary.

In a perfect world, deisrel would handle this case by printing something like:

registry_proxy  (not found) -> v1.0.0 (dirty)
    registry_proxy has unrelased changes. See https://github.com/deis/registry-proxy/compare/v1.0.0...master
Joshua-Anderson commented 8 years ago

Should be a simple fix. I'm on it!