mesosphere / mindthegap

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

fix: helm chart bundles by downloading versions first and uploading using local file names #694

Closed faiq closed 4 months ago

faiq commented 4 months ago

Currently this fails.

$ mindthegap version
v1.13.3

$ cat repos.yaml 
# Copyright 2021 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

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

like so

$ 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/) 
failed to push Helm chart to temporary registry: failed to push chart /tmp/.helm-bundle-temp-storage-2871538291/node-feature-discovery-0.15.2.tgz to oci://127.0.0.1:36489/charts: /tmp/.helm-bundle-temp-storage-2871538291/node-feature-discovery-0.15.2.tgz: no such file, output:

This is because the file ended up getting saved like this

$ ls -lah /tmp/.helm-bundle-temp-storage-967163187/node-feature-discovery-chart-0.15.4.tgz 
-rw-r--r-- 1 faiqus faiqus 14K Apr 23 15:32 /tmp/.helm-bundle-temp-storage-967163187/node-feature-discovery-chart-0.15.4.tgz

notice the -chart-0.15.4.tgz but when we return we a name that usually works for all charts

this PR downloads all the chart versions first and then goes through the directory and uploads the tar files.

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 481b1ef5.

: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 54s :stopwatch:  2 suites   3 :zzz:  1 files     0 :x:

Results for commit 481b1ef5.

faiq commented 4 months ago

it looks like the urls: for the chart are like this

    - https://github.com/kubernetes-sigs/node-feature-discovery/releases/download/v0.15.4/node-feature-discovery-chart-0.15.4.tgz