ChristofferNissen / helmper

Import Helm Charts to OCI registries, optionally with vulnerability patching
https://christoffernissen.github.io/helmper/
Apache License 2.0
243 stars 9 forks source link

Helmper 0.1.13 - panic: runtime error: invalid memory address or nil pointer dereference #88

Open akitsul opened 4 months ago

akitsul commented 4 months ago

Hello, I'm trying to sync charts and one of them is bitnami/postgresql (https://github.com/ChristofferNissen/helmper/issues/81). After upgrade helmper to 0.1.13 - bitnami/postgresql synced, yeap! But sync bitnami/keycloak is failured:

helmper --f sync.yaml

 _         _
| |_  ___ | | _____  ___  ___  ___
|   || -_|| ||     || . || -_||  _|
|_|_||___||_||_|_|_||  _||___||_|
                    |_|
version 0.1.13 (commit fb537925fa03ff2bdbef970e94ccd48eba91c86a, built at 2024-07-26T13:20:18Z)

{"time":"2024-07-29T13:33:18.793349049+07:00","level":"INFO","msg":"Updated all Helm repositories ✅"}
+---+----------+------------+---------+----------------+--------+---------+------------+---------+--------------------+---------+
| # | TYPE     | CHART      | VERSION | LATEST VERSION | LATEST | VALUES  | SUBCHART   | VERSION | CONDITION          | ENABLED |
+---+----------+------------+---------+----------------+--------+---------+------------+---------+--------------------+---------+
| 0 | Chart    | postgresql | 15.5.6  | 15.5.20        | ❌     | default |            |         |                    |         |
| 1 | Subchart |            |         |                |        | parent  | common     | 2.x.x   |                    | ❌      |
| 2 | Chart    | keycloak   | 21.3.1  | 21.8.0         | ❌     | default |            |         |                    |         |
| 3 | Subchart |            |         |                |        | parent  | postgresql | 15.x.x  | postgresql.enabled | ✅      |
| 4 | Subchart |            |         |                |        | parent  | common     | 2.x.x   |                    | ❌      |
+---+----------+------------+---------+----------------+--------+---------+------------+---------+--------------------+---------+
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x1b2ebef]

goroutine 630 [running]:
helm.sh/helm/v3/pkg/registry.(*Client).Tags(0x0, {0xc0030d9346?, 0xc000ec4c88?})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.15.3/pkg/registry/client.go:671 +0x10f
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).getOciURI(0xc000ec5218, {0xc0030d9340, 0x33}, {0xc001ae35aa, 0x6}, 0xc000988b40)
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.15.3/pkg/downloader/chart_downloader.go:154 +0x128
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).ResolveChartVersion(0xc000ec5218, {0xc0030d9340, 0x33}, {0xc001ae35aa, 0x6})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.15.3/pkg/downloader/chart_downloader.go:199 +0xfdb
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).DownloadTo(0xc000ec5218, {0xc0030d9340, 0x33}, {0xc001ae35aa?, 0x3d78020?}, {0xc001b1f1c0, 0x1a})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.15.3/pkg/downloader/chart_downloader.go:90 +0x4f
helm.sh/helm/v3/pkg/action.(*Pull).Run(0xc0011b6380, {0xc0030d9340, 0x33})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.15.3/pkg/action/pull.go:132 +0xbd1
github.com/ChristofferNissen/helmper/pkg/helm.Chart.Locate({{0xc001ae35a0, 0xa}, {0xc001ae35aa, 0x6}, {0x0, 0x0}, {{0xc0030876a0, 0x8}, {0xc000ec9950, 0x28}, ...}, ...})
    /home/runner/work/helmper/helmper/pkg/helm/chart.go:759 +0x98f
github.com/ChristofferNissen/helmper/pkg/helm.determineSubChartPath(0xc001842b70?, 0xc00332c680, 0xc00330a8d0?, {0xc00348d3b0?, 0x0?}, 0xc001213f38)
    /home/runner/work/helmper/helmper/pkg/helm/chartOption.go:130 +0x265
github.com/ChristofferNissen/helmper/pkg/helm.ChartOption.Run.func1.1()
    /home/runner/work/helmper/helmper/pkg/helm/chartOption.go:247 +0x8d6
golang.org/x/sync/errgroup.(*Group).Go.func1()
    /home/runner/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
    /home/runner/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:75 +0x96

Config:

k8s_version: 1.27.9
parser:
  disableImageDetection: true
import:
  enabled: true
registries:
  - name: charts
    url: REGISTRY_URL
charts:
  - name: postgresql
    version: 15.5.6
    repo:
      name: postgresql
      url: oci://registry-1.docker.io/bitnamicharts
  - name: keycloak
    version: 21.3.1
    repo:
      name: keycloak
      url: oci://registry-1.docker.io/bitnamicharts
ChristofferNissen commented 4 months ago

Thanks for opening an issue, will take a look at it