bitnami/charts-syncer

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

bradwinfield opened this issue · 4 comments

We have Charts Syncer 0.17.0 running in a dev environment and it works fine. We installed and configured it to run on one of our production clusters. Upon manual kick-off:

  $ k create job test-initial-sync --from cronjob/charts-syncer
  $ k logs -l app=charts-syncer -f

We get this:

charts/wildfly/blobs/sha256:26b881308267dfc1c342dfad41a18a76cfde5389d3ee1b9c6bb33e1b17779d51"
I0606 13:16:42.280870 1 oci.go:290] [dc0628a38424af452ac2e515d61e6ff33adca28d] HTTP Status: 200 OK
I0606 13:16:42.280908 1 cache.go:54] cache hit { op:has, id:134506542131cf0da32837b667f98697050c24a8, filename:wildfly-13.3.4.tgz }
I0606 13:16:42.280915 1 cache.go:107] cache hit { op:write, id:134506542131cf0da32837b667f98697050c24a8, filename:wildfly-13.3.4.tgz }
I0606 13:16:42.422824 1 index.go:236] Indexing "wildfly-13.3.4" chart
I0606 13:16:42.422844 1 index.go:106] Indexing "wordpress" charts...
I0606 13:16:42.918187 1 cache.go:54] cache hit { op:has, id:134506542131cf0da32837b667f98697050c24a8, filename:wordpress-14.3.2.tgz }
I0606 13:16:43.348363 1 oci.go:266] [d03f7ab5e112835e2790bc984dba49d3c7280001] GET "https://registry.pivotal.io/v2/tac-for-tanzu-advanced/charts/wordpress/blobs/sha256:a53032573f8b898732f3ec461cc29dcd7bcda60a68f346d13d2ad7483c600c67"
I0606 13:16:44.182278 1 oci.go:290] [d03f7ab5e112835e2790bc984dba49d3c7280001] HTTP Status: 200 OK
I0606 13:16:44.182312 1 cache.go:54] cache hit { op:has, id:134506542131cf0da32837b667f98697050c24a8, filename:wordpress-14.3.2.tgz }
I0606 13:16:44.182317 1 cache.go:107] cache hit { op:write, id:134506542131cf0da32837b667f98697050c24a8, filename:wordpress-14.3.2.tgz }
I0606 13:16:44.462647 1 index.go:236] Indexing "wordpress-14.3.2" chart
I0606 13:16:44.462672 1 index.go:106] Indexing "zookeeper" charts...
panic: runtime error: index out of range [2] with length 2
 
goroutine 1 [running]:
github.com/philopon/go-toposort.(*Graph).Toposort(0xc0000199c0, 0xc000588b70, 0xc000168fd8, 0x18, 0xc0004740b0)
/home/runner/go/pkg/mod/github.com/philopon/go-toposort@v0.0.0-20170620085441-9be86dbd762f/toposort.go:79 +0x8b8
github.com/bitnami-labs/charts-syncer/pkg/syncer.(*Syncer).topologicalSortCharts(0xc0007312d0, 0xc000158500, 0x4c, 0x0, 0x0, 0x0)
/home/runner/work/charts-syncer/charts-syncer/pkg/syncer/index.go:252 +0x4f6
github.com/bitnami-labs/charts-syncer/pkg/syncer.(*Syncer).SyncPendingCharts(0xc0007312d0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/runner/work/charts-syncer/charts-syncer/pkg/syncer/sync.go:39 +0x1d0
github.com/bitnami-labs/charts-syncer/cmd.newSyncCmd.func2(0xc00098d680, 0xc00031a460, 0x0, 0x5, 0x0, 0x0)
/home/runner/work/charts-syncer/charts-syncer/cmd/sync.go:99 +0x27c
github.com/spf13/cobra.(*Command).execute(0xc00098d680, 0xc00031a410, 0x5, 0x5, 0xc00098d680, 0xc00031a410)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc00098d400, 0xc00009d860, 0x1, 0x0)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
/home/runner/work/charts-syncer/charts-syncer/main.go:28 +0x1bd

Config file is like this:

source:
  repo:
    kind: OCI
    url: https://registry.pivotal.io/tac-for-tanzu-advanced/charts
    useChartsIndex: true
target:
  repoName: vmware-app-catalog
  containerRegistry: xxxxxxxxxxxxxxxx
  containerRepository: containers
  repo:
    kind: OCI
    url: https://xxxxxxxxxxxx

Hi @bradwinfield!

I was able to reproduce this issue. It seems it is an issue indexing the grafana-loki chart. As a workaround, you can skip this specific chart in your config file in case you are not interested on it.

source:
  repo:
    kind: OCI
    url: https://registry.pivotal.io/tac-for-tanzu-advanced/charts
    useChartsIndex: true
target:
  repoName: vmware-app-catalog
  containerRegistry: xxxxxxxxxxxxxxxx
  containerRepository: containers
  repo:
    kind: OCI
    url: https://xxxxxxxxxxxx
skipCharts:
  - grafana-loki

We will try to investigate what's special with this chart so we can add a proper fix.

Super duper! Thanks for working on this! Will implement work-around.

Still having this issue with 0.20.1

Версия v2.0.1
charts-syncer -c ../../cilium-local.yaml sync --from-date 2020-05-15
» Syncing charts
panic: runtime error: index out of range [2] with length 0

goroutine 1 [running]:
github.com/bitnami/charts-syncer/pkg/client/repo/local.New({0x0?, 0x1df5c80?})
/home/runner/work/charts-syncer/charts-syncer/pkg/client/repo/local/local.go:48 +0x30a
github.com/bitnami/charts-syncer/pkg/client/target/local.New({0x0?, 0xc0005fdf90?})
/home/runner/work/charts-syncer/charts-syncer/pkg/client/target/local/local.go:18 +0x18
github.com/bitnami/charts-syncer/pkg/client/target.NewClient(0xc0003a8000, {0xc000db3ab8?, 0x3, 0x3})
/home/runner/work/charts-syncer/charts-syncer/pkg/client/target/core.go:28 +0x128
github.com/bitnami/charts-syncer/pkg/syncer.New(0xc000227e40, 0xc0003a8000, {0xc00063fc38, 0xb, 0x0?})
/home/runner/work/charts-syncer/charts-syncer/pkg/syncer/syncer.go:160 +0x48c
main.newSyncCmd.func2(0xc000158600?, {0x20025a1?, 0x4?, 0x20025a5?})
/home/runner/work/charts-syncer/charts-syncer/cmd/sync.go:114 +0x45c
github.com/spf13/cobra.(*Command).execute(0xc0005a8c00, {0xc000227840, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0xc0005a8900)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
/home/runner/work/charts-syncer/charts-syncer/cmd/main.go:15 +0x35