filecli, filecmd: added uploading as helm chart

This commit is contained in:
2026-03-12 17:17:51 +02:00
parent 95ed9ddb97
commit 27c912d266
6 changed files with 170 additions and 20 deletions
+6 -3
View File
@@ -29,6 +29,7 @@ type ImportFilesParams struct {
Source string
Dest string
Progress bool
Chart bool
}
type ImportFilesResult struct {
Files []string `json:"files,omitempty"`
@@ -69,8 +70,6 @@ func (util *FileUtil) importFiles(common *CommonFileParams, params *ImportFilesP
return nil
}
ref.JoinResource(relpath)
//fmt.Printf("====%s %s\n", relpath, ref.Raw())
//return nil
file, err := os.OpenFile(walkpath, os.O_RDONLY, 0)
if err != nil {
putErrors = append(putErrors, err)
@@ -89,7 +88,11 @@ func (util *FileUtil) importFiles(common *CommonFileParams, params *ImportFilesP
mw := filecli.NewBasicAuthMiddleware(ref.Userinfo())
cli := filecli.NewClient(nil, mw)
err = cli.PutFile(ctx, ref.Raw(), file, stat.Size())
mime := defMediaType
if params.Chart {
mime = hcMediaType
}
err = cli.PutFile(ctx, ref.Raw(), mime, file, stat.Size())
if err != nil {
putErrors = append(putErrors, err)
fmt.Printf("- %s: error: %v \n", ref.Raw(), err)