ChristofferNissen / helmper

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

Panic: runtime error: invalid memory address or nil pointer dereference #81

Closed akitsul closed 2 months ago

akitsul commented 2 months ago

Hello, I'm trying to sync charts and one of them is bitnami/postgresql. This error occurs for many bitnami charts https://github.com/bitnami/charts/tree/main/bitnami.

My config for reproduce:

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

Result:

helmper --f sync.yaml

 _         _
| |_  ___ | | _____  ___  ___  ___
|   || -_|| ||     || . || -_||  _|
|_|_||___||_||_|_|_||  _||___||_|
                    |_|
version 0.1.11 (commit 637d0f73d5e30161a8d58d92286d0b283f71dfa3, built at 2024-07-15T23:16:50Z)

{"time":"2024-07-25T14:26:56.310578706+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.19        | ❌     | default |          |         |           |         |
| 1 | Subchart |            |         |                |        | parent  | common   | 2.x.x   |           | ❌      |
+---+----------+------------+---------+----------------+--------+---------+----------+---------+-----------+---------+
 100% [===============] (2/2) Parsing charts...        
+---+------------+---------------+-----------------+-------+
| # | HELM CHART | CHART VERSION | HELM VALUE PATH | IMAGE |
+---+------------+---------------+-----------------+-------+
+---+------------+---------------+-----------------+-------+
+---+------------+---------------+-------+--------+--------+
| # | HELM CHART | CHART VERSION | IMAGE | CHARTS | IMPORT |
+---+------------+---------------+-------+--------+--------+
+---+------------+---------------+-------+--------+--------+
|   |            |               |       |        |      0 |
+---+------------+---------------+-------+--------+--------+
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x1b26a0f]

goroutine 1 [running]:
helm.sh/helm/v3/pkg/registry.(*Client).Tags(0x0, {0xc0035eb476?, 0xc00212adb0?})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.14.4/pkg/registry/client.go:671 +0x10f
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).getOciURI(0xc00212b340, {0xc0035eb470, 0x2f}, {0xc00239d8f6, 0x5}, 0xc001aafb90)
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.14.4/pkg/downloader/chart_downloader.go:154 +0x128
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).ResolveChartVersion(0xc00212b340, {0xc0035eb470, 0x2f}, {0xc00239d8f6, 0x5})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.14.4/pkg/downloader/chart_downloader.go:199 +0xfdb
helm.sh/helm/v3/pkg/downloader.(*ChartDownloader).DownloadTo(0xc00212b340, {0xc0035eb470, 0x2f}, {0xc00239d8f6?, 0x3bce0a0?}, {0xc0037d0d60, 0x1a})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.14.4/pkg/downloader/chart_downloader.go:90 +0x4f
helm.sh/helm/v3/pkg/action.(*Pull).Run(0xc001e77a40, {0xc0035eb470, 0x2f})
    /home/runner/go/pkg/mod/helm.sh/helm/v3@v3.14.4/pkg/action/pull.go:132 +0xbd1
github.com/ChristofferNissen/helmper/pkg/helm.Chart.pullTar({{0xc00239d8f0, 0x6}, {0xc00239d8f6, 0x5}, {0x0, 0x0}, {{0xc00329ab00, 0xa}, {0xc001b86a20, 0x28}, ...}, ...})
    /home/runner/work/helmper/helmper/pkg/helm/chart.go:415 +0xaef
github.com/ChristofferNissen/helmper/pkg/helm.Chart.Push({{0xc00239d8f0, 0x6}, {0xc00239d8f6, 0x5}, {0x0, 0x0}, {{0xc00329ab00, 0xa}, {0xc001b86a20, 0x28}, ...}, ...}, ...)
    /home/runner/work/helmper/helmper/pkg/helm/chart.go:514 +0x1d8
github.com/ChristofferNissen/helmper/pkg/helm.ChartImportOption.Run({{0xc001039950, 0x1, 0x1}, 0xc00286bb78, 0x0, 0x0}, {0x54b13a0, 0x7b65a60}, {0xc00212d940, 0x3, ...})
    /home/runner/work/helmper/helmper/pkg/helm/chartImportOption.go:137 +0xc3b
github.com/ChristofferNissen/helmper/internal.Program({0xc0001920a0, 0x2, 0x2})
    /home/runner/work/helmper/helmper/internal/program.go:212 +0xe07
main.main()
    /home/runner/work/helmper/helmper/cmd/helmper/main.go:12 +0x49

Other charts with dependencies sync without errors.