Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Glob path matching causes panic #242

@sqsp-rwatkins

Description

@sqsp-rwatkins

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 #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions