Init project
Some checks failed
Lint / Run on Ubuntu (push) Has been cancelled
E2E Tests / Run on Ubuntu (push) Has been cancelled
Tests / Run on Ubuntu (push) Has been cancelled

This commit is contained in:
2025-07-15 17:58:36 +02:00
parent 61902f4159
commit 7c2294d9df
77 changed files with 4797 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
package downloader
// It should download a helm chart from git

View File

@@ -0,0 +1,3 @@
package downloader
// It should download a helm chart

View File

@@ -0,0 +1,35 @@
package downloader
import (
"context"
"fmt"
"strings"
"github.com/allanger/yaho/internal/tools/git"
"github.com/allanger/yaho/internal/tools/helm"
)
type PullOptions struct {}
// A very stupid check
func isGitRepo(repository string) bool {
return strings.HasPrefix(repository, "git@") || strings.HasSuffix(repository, ".git")
}
// Pull chart into a temporary directory
func PullChart(ctx context.Context, repository, chart, version string, opts *PullOptions) (string, error) {
if isGitRepo(repository) {
git := git.GitLib{}
path, err := git.CloneRepo(ctx, repository, version)
if err != nil {
return "", err
}
return fmt.Sprintf("%s/%s", path, chart), nil
} else {
helm := helm.HelmLib{}
path, err := helm.PullChart(ctx, repository, chart, version)
if err != nil {
return "", err
}
return path, nil
}
}