Skip to content

Commit

Permalink
update helm concept/import commands to support helm repos & update de…
Browse files Browse the repository at this point in the history
…pendencies
  • Loading branch information
redradrat committed Nov 6, 2021
1 parent d543b05 commit 6ba1e1d
Show file tree
Hide file tree
Showing 805 changed files with 82,756 additions and 23,555 deletions.
10 changes: 6 additions & 4 deletions cmd/helmConcept.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ import (
)

var chartVersion string
var chartRepo string
var chartRepoName string
var chartRepoURL string
var dir string

// helmImportCmd represents the import command
var helmConceptCmd = &cobra.Command{
Use: "concept",
Short: "Create a concept, wrapping a helm chart from a git repo",
Example: "kable helm concept --directory sentry sentry --repo stable --version 4.3.0",
Example: "kable helm concept --directory sentry sentry --repoName stable --version 4.3.0",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("requires exactly ONE argument")
Expand All @@ -40,7 +41,7 @@ var helmConceptCmd = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
PrintMsg("Creating concept from helm chart '%s'...", args[0])
if err := helm.InitHelmConcept(helm.HelmChart{Name: args[0], Version: chartVersion, Repo: chartRepo}, dir); err != nil {
if err := helm.InitHelmConcept(helm.HelmChart{Name: args[0], Version: chartVersion, Repo: helm.HelmRepo{Name: chartRepoName, URL: chartRepoURL}}, dir); err != nil {
PrintError("unable to import helm chart: %s", err)
}
},
Expand All @@ -58,6 +59,7 @@ func init() {
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
helmConceptCmd.Flags().StringVarP(&chartVersion, "version", "v", "", "The version of the helm chart.")
helmConceptCmd.Flags().StringVarP(&chartRepo, "repo", "r", "stable", "The repo where the helm chart resides.")
helmConceptCmd.Flags().StringVar(&chartRepoName, "repoName", "stable", "The name of the repository where the helm chart resides. (stable: https://charts.helm.sh/stable)")
helmConceptCmd.Flags().StringVar(&chartRepoURL, "repoURL", "", "The URL of the repository where the helm chart resides.")
helmConceptCmd.Flags().StringVarP(&dir, "directory", "d", ".", "The directory to create the concept in.")
}
7 changes: 4 additions & 3 deletions cmd/helmImport.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var importSubdir string
var helmImportCmd = &cobra.Command{
Use: "import",
Short: "Import a helm chart from a helm repo into the concept",
Example: "kable helm import sentry --repo stable --version 4.3.0",
Example: "kable helm import sentry --repoName stable --version 4.3.0",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("requires exactly ONE argument")
Expand All @@ -43,7 +43,7 @@ var helmImportCmd = &cobra.Command{
PrintError("current directory is not a concept directory: %s", err)
}
PrintMsg("Importing helm chart '%s' into current concept...", args[0])
if err := helm.ImportHelmChart(helm.HelmChart{Name: args[0], Version: chartVersion, Repo: chartRepo}, dir); err != nil {
if err := helm.ImportHelmChart(helm.HelmChart{Name: args[0], Version: chartVersion, Repo: helm.HelmRepo{Name: chartRepoName, URL: chartRepoURL}}, dir); err != nil {
PrintError("unable to import helm chart: %s", err)
}
},
Expand All @@ -61,6 +61,7 @@ func init() {
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
helmImportCmd.Flags().StringVarP(&chartVersion, "version", "v", "", "The version of the helm chart.")
helmImportCmd.Flags().StringVarP(&chartRepo, "repo", "r", ".", "The repo where the helm chart resides.")
helmImportCmd.Flags().StringVar(&chartRepoName, "repoName", "stable", "The name of the repository where the helm chart resides. (stable: https://charts.helm.sh/stable)")
helmImportCmd.Flags().StringVar(&chartRepoURL, "repoURL", "", "The URL of the repository where the helm chart resides.")
helmImportCmd.Flags().StringVarP(&dir, "directory", "d", ".", "The directory of the concept.")
}
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ require (
github.com/AlecAivazis/survey/v2 v2.1.1
github.com/coreos/etcd v3.3.13+incompatible
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
github.com/fatih/color v1.9.0
github.com/fatih/color v1.13.0
github.com/fatih/structs v1.1.0
github.com/go-git/go-git/v5 v5.1.0
github.com/gofiber/fiber/v2 v2.3.0
github.com/gofiber/template v1.6.6
github.com/google/go-querystring v1.0.0
github.com/google/logger v1.1.0
github.com/grafana/tanka v0.12.0
github.com/grafana/tanka v0.18.2
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.9.5 // indirect
github.com/jsonnet-bundler/jsonnet-bundler v0.4.0
Expand All @@ -29,8 +29,10 @@ require (
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
go.etcd.io/bbolt v1.3.3 // indirect
)

replace github.com/Joker/jade v1.0.0 => github.com/Joker/jade v1.0.1-0.20200506134858-ee26e3c533bb

replace github.com/grafana/tanka v0.18.2 => github.com/redradrat/tanka v0.18.2-fix639
Loading

0 comments on commit 6ba1e1d

Please sign in to comment.