moshebe/gebug

Empty port cause invalid docker-compose.yml generation

InbarPerry opened this issue · 1 comments

When going to through gebug init process, you are prompt with a choice to expose ports in the container.
Leaving the field empty generates an invalid docker-compose.yml file when executing gebug start:

docker-compose.yml
version: '3'
services:
  gebug-goproj:
    build:
      context: ..
      dockerfile: .gebug/Dockerfile
    volumes:
      - ../:/src:ro
    ports:

and the invalid yaml cause the following error:

ERROR: The Compose file './.gebug/docker-compose.yml' is invalid because:
services.gebug-goproj.ports contains an invalid type, it should be an array
2020-07-21T17:11:28.155+0300	FATAL	cmd/start.go:57	Failed to start	{"error": "exit status 1"}
github.com/moshebe/gebug/cmd.glob..func6
	/Users/inbar/go/src/github.com/moshebe/gebug/cmd/start.go:57
github.com/spf13/cobra.(*Command).execute
	/Users/inbar/go/src/github.com/spf13/cobra/command.go:846
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/inbar/go/src/github.com/spf13/cobra/command.go:950
github.com/spf13/cobra.(*Command).Execute
	/Users/inbar/go/src/github.com/spf13/cobra/command.go:887
github.com/moshebe/gebug/cmd.Execute
	/Users/inbar/go/src/github.com/moshebe/gebug/cmd/root.go:38
main.main
	/Users/inbar/go/src/github.com/moshebe/gebug/main.go:6
runtime.main
	/usr/local/Cellar/go/1.14.2_1/libexec/src/runtime/proc.go:203

Workaround

Manually delete the ports section from .gebug/docker-compose.yml and run gebug start --skip-generate instead.

Nice catch. Are you working on this one? If so, can you share you plan of solving this issue?