From 30bee6f0e210a54ddf99161a7b5cf81de6e0527d Mon Sep 17 00:00:00 2001 From: Acid Chicken Date: Wed, 22 May 2024 00:10:35 +0900 Subject: [PATCH] fix: update index --- charts/hariko/Chart.yaml | 2 +- charts/misskey/Chart.yaml | 2 +- hariko/cmd/root.go | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/charts/hariko/Chart.yaml b/charts/hariko/Chart.yaml index 7244007..9be1721 100644 --- a/charts/hariko/Chart.yaml +++ b/charts/hariko/Chart.yaml @@ -1,3 +1,3 @@ apiVersion: v2 name: hariko -version: 0.1.13 +version: 0.1.14 diff --git a/charts/misskey/Chart.yaml b/charts/misskey/Chart.yaml index 58c5c07..bddfd3a 100644 --- a/charts/misskey/Chart.yaml +++ b/charts/misskey/Chart.yaml @@ -1,3 +1,3 @@ apiVersion: v2 name: misskey -version: 0.1.13 +version: 0.1.14 diff --git a/hariko/cmd/root.go b/hariko/cmd/root.go index 2ade592..7fe0f39 100644 --- a/hariko/cmd/root.go +++ b/hariko/cmd/root.go @@ -15,6 +15,7 @@ import ( "helm.sh/helm/v3/pkg/getter" "helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/repo" + "sigs.k8s.io/yaml" ) const ( @@ -180,10 +181,11 @@ func deploy(packageName string, repositoryName string, repositoryURL string) (*r p := getter.All(settings) actionConfig := new(action.Configuration) actionConfig.Init(settings.RESTClientGetter(), settings.Namespace(), "", func(_ string, _ ...interface{}) {}) - r, err := repo.NewChartRepository(&repo.Entry{ + c := repo.Entry{ Name: repositoryName, URL: repositoryURL, - }, p) + } + r, err := repo.NewChartRepository(&c, p) if err != nil { return nil, err } @@ -191,6 +193,18 @@ func deploy(packageName string, repositoryName string, repositoryURL string) (*r if err != nil { return nil, err } + b, err := os.ReadFile(settings.RepositoryConfig) + if err != nil { + return nil, err + } + var re repo.File + if err := yaml.Unmarshal(b, &re); err != nil { + return nil, err + } + re.Update(&c) + if err := re.WriteFile(settings.RepositoryConfig, 0600); err != nil { + return nil, err + } if _, err := repo.LoadIndexFile(index); err != nil { return nil, err }