devspace icon indicating copy to clipboard operation
devspace copied to clipboard

Configuration example using imports statement for git repos causes application crash

Open andersbulderbank opened this issue 2 years ago • 1 comments

What happened?
When configuring devspace.yaml with an import statement following the format of the documentation, devspace CLI commands fail with a stack trace.

Stack trace
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/loft-sh/devspace/pkg/devspace/dependency/util.switchURLType({0xc0008cdac0?, 0x1b?})
        /Users/runner/work/devspace/devspace/pkg/devspace/dependency/util/util.go:75 +0x1f4
github.com/loft-sh/devspace/pkg/devspace/dependency/util.DownloadDependency({0x2766258, 0xc0001404b0}, {0xc000a20340, 0x30}, 0xc000be3438, {0x277ebb8, 0x4069640})
        /Users/runner/work/devspace/devspace/pkg/devspace/dependency/util/util.go:124 +0xfbe
github.com/loft-sh/devspace/pkg/devspace/config/loader.ResolveImports({0x2766258, 0xc0001404b0}, {0x276cbe0, 0xc000a23800}, {0xc000a20340, 0x30}, 0x277ebb8?, {0x277ebb8, 0x4069640})
        /Users/runner/work/devspace/devspace/pkg/devspace/config/loader/imports.go:74 +0x368
github.com/loft-sh/devspace/pkg/devspace/config/loader.(*configLoader).parseConfig(0xc0002f96d0, {0x2766258, 0xc0001404b0}, 0xc0004d37c0?, {0x2774400, 0xc000a23600}, {0xc0002cacd0?, 0x50?}, {0x0, 0x0}, ...)
        /Users/runner/work/devspace/devspace/pkg/devspace/config/loader/loader.go:317 +0x18b
github.com/loft-sh/devspace/pkg/devspace/config/loader.(*configLoader).LoadWithParser(0xc0002f96d0, {0x2766220, 0xc000a1b740}, {0x0?, 0x0?}, {0x0, 0x0}, {0x2746de0, 0xc0002cae10}, 0xc0002cae60, ...)
        /Users/runner/work/devspace/devspace/pkg/devspace/config/loader/loader.go:176 +0x7cd
github.com/loft-sh/devspace/cmd.parseConfig({0x2774db8, 0x4069c58})
        /Users/runner/work/devspace/devspace/cmd/root.go:350 +0x1f7
github.com/loft-sh/devspace/cmd.BuildRoot({0x2774db8, 0x4069c58}, 0x59?)
        /Users/runner/work/devspace/devspace/cmd/root.go:201 +0x186
github.com/loft-sh/devspace/cmd.Execute()
        /Users/runner/work/devspace/devspace/cmd/root.go:139 +0x50
main.main()
        /Users/runner/work/devspace/devspace/main.go:17 +0x2c

What did you expect to happen instead?
I expected the devspace command to import the github repository specified in the devspace.yaml file without errors.

How can we reproduce the bug? (as minimally and precisely as possible)
Configure devspace.yaml using the imports statement with a git repo as documented in the devspace documentation.

My devspace.yaml:

version: v2beta1

...
imports:
- git: github.com/project/repo.git
  branch: test

Working devspace.yaml, when changing to ssh-format it works as expected:

imports:
- git: [email protected]:project/repo.git
  branch: test

Local Environment:

  • DevSpace Version: 6.3.3
  • Operating System: linux
  • ARCH of the OS: AMD64

Kubernetes Cluster:

  • Cloud Provider: google
  • Kubernetes Version: 1.27.1

Anything else we need to know?

andersbulderbank avatar Oct 18 '23 07:10 andersbulderbank

@andersbulderbank Hello! Thanks for reporting the issue. The documentation could use a correction here, since we'd need to assume github.com/project/repo.git means either [email protected]/project/repo.git OR https://github.com/project/repo.git.

We'll likely do a quick fix to assume [email protected]/project/repo.git if the URL is left ambiguous, but for now using a more specific URL should be a quick workaround!

lizardruss avatar Oct 23 '23 16:10 lizardruss