drone-cache icon indicating copy to clipboard operation
drone-cache copied to clipboard

Glob path matching causes panic

Open sqsp-rwatkins opened this issue 1 year ago • 0 comments

Describe the bug Using 2 or more glob paths for the mount paths causes a panic

To Reproduce Steps to reproduce the behavior:

  1. Using the following config in drone:
image: meltwater/drone-cache
settings:
  backend: gcs
  cache_key: [REDACTED]/{{ checksum "yarn.lock" }}
  json_key: [REDACTED]
  bucket: [REDACTED]
  region: [REDACTED]
  mount:
    - "packages/**/node_modules"
    - "node_modules"
    - "plugins/**/node_modules"
  1. See Drone console output for error

Expected behavior Expected glob paths to work as described and implemented in https://github.com/meltwater/drone-cache/pull/209

Drone console output

panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
github.com/meltwater/drone-cache/internal/plugin.(*Config).HandleMount(0xc0006bf740, {0x142da80, 0xc00011f090})
	/home/runner/work/drone-cache/drone-cache/internal/plugin/config.go:56 +0x345
github.com/meltwater/drone-cache/internal/plugin.(*Plugin).Exec(0xc0006bf5d8)
	/home/runner/work/drone-cache/drone-cache/internal/plugin/plugin.go:134 +0xebc
main.run(0xc0001f9500?)
	/home/runner/work/drone-cache/drone-cache/main.go:613 +0x1706
github.com/urfave/cli/v2.(*App).RunContext(0xc000434700, {0x1433a70?, 0xc00013c030}, {0xc00011e1e0, 0x1, 0x1})
	/home/runner/work/drone-cache/drone-cache/vendor/github.com/urfave/cli/v2/app.go:392 +0xf3f
github.com/urfave/cli/v2.(*App).Run(...)
	/home/runner/work/drone-cache/drone-cache/vendor/github.com/urfave/cli/v2/app.go:253
main.main()
	/home/runner/work/drone-cache/drone-cache/main.go:493 +0x423a

Desktop (please complete the following information): N/A running in drone using meltwater/drone-cache

sqsp-rwatkins avatar Mar 15 '23 16:03 sqsp-rwatkins