mesosphere / mindthegap

Easily create and use bundles for air-gapped environments
Apache License 2.0
56 stars 11 forks source link

fix: Support published Helm charts with different name format #695

Closed jimmidyson closed 4 months ago

jimmidyson commented 4 months ago

Currently mindthegap create helm-bundle fails if the chart published in the helm repo has a different name to the expected format <chartName>-<chartVersion>.tgz. An example that hit this issue is the NFD chart that is published with the name <chartName>-chart-<chartVersion>.tgz.

This commit fixes the issue by first finding the download URL from the Helm repo index and then using the existing GetChartFromURL function to download the chart. This already correctly uses the basename of the published chart file and hence doesn't hit the above issue.

Tested to be working:

$ cat repos.yaml
repositories:
  nfd:
    repoURL: https://kubernetes-sigs.github.io/node-feature-discovery/charts/
    charts:
      node-feature-discovery:
      - 0.15.2

$ ./dist/mindthegap_darwin_arm64/mindthegap create helm-bundle --helm-charts-file=repos.yaml --overwrite
 ✓ Parsing Helm chart bundle config
 ✓ Creating temporary OCI registry directory
 ✓ Starting temporary OCI registry
 ✓ Creating temporary chart storage directory
 ✓ Fetching Helm chart node-feature-discovery (versions [0.15.2]) from nfd
(https://kubernetes-sigs.github.io/node-feature-discovery/charts/)
 ✓ Archiving Helm charts to helm-charts.tar

$ ./dist/mindthegap_darwin_arm64/mindthegap serve bundle --bundle helm-charts.tar &
 ✓ Creating temporary directory
 ✓ Unarchiving image bundle "helm-charts.tar"
 ✓ Parsing Helm charts bundle config
 ✓ Creating Docker registry
Listening on 127.0.0.1:58639

$ crane ls 127.0.0.1:58783/charts/node-feature-discovery
0.15.2
github-actions[bot] commented 4 months ago

Unit test results

100 tests   100 :white_check_mark:  0s :stopwatch:  24 suites    0 :zzz:   1 files      0 :x:

Results for commit 810aa997.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 4 months ago

e2e test results

33 tests   30 :white_check_mark:  1m 52s :stopwatch:  2 suites   3 :zzz:  1 files     0 :x:

Results for commit 810aa997.

:recycle: This comment has been updated with latest results.