Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate basic helm readme's for app umbrella charts #452

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/plural/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (p *Plural) doBuild(installation *api.Installation, force bool) error {

workspace.PrintLinks()

appReadme(repoName, false) // nolint:errcheck
return err
}

Expand Down
24 changes: 24 additions & 0 deletions cmd/plural/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import (

"github.com/pluralsh/plural/pkg/helm"
"github.com/pluralsh/plural/pkg/provider"
"github.com/pluralsh/plural/pkg/scaffold"
"github.com/pluralsh/plural/pkg/utils"
"github.com/pluralsh/plural/pkg/utils/git"
"github.com/pluralsh/plural/pkg/wkspace"
"github.com/urfave/cli"
)
Expand All @@ -20,6 +22,18 @@ func (p *Plural) workspaceCommands() []cli.Command {
Usage: "generates kubernetes credentials for this subworkspace",
Action: latestVersion(kubeInit),
},
{
Name: "readme",
Usage: "generate chart readme for an app",
ArgsUsage: "NAME",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "dry-run",
Usage: "output to stdout instead of to a file",
},
},
Action: latestVersion(func(c *cli.Context) error { return appReadme(c.Args().Get(0), c.Bool("dry-run")) }),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to add requireArgs helper

},
{
Name: "helm",
Usage: "upgrade/installs the helm chart for this subworkspace",
Expand Down Expand Up @@ -186,3 +200,13 @@ func (p *Plural) mapkubeapis(c *cli.Context) error {

return minimal.MapKubeApis()
}

func appReadme(name string, dryRun bool) error {
repoRoot, err := git.Root()
if err != nil {
return err
}

dir := filepath.Join(repoRoot, name, "helm", name)
return scaffold.Readme(dir, dryRun)
}
13 changes: 12 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ require (
github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.5.0
github.com/norwoodj/helm-docs v1.11.2
github.com/olekukonko/tablewriter v0.0.5
github.com/packethost/packngo v0.29.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
Expand All @@ -51,6 +52,7 @@ require (
github.com/pluralsh/polly v0.1.1
github.com/rodaine/hclencoder v0.0.1
github.com/samber/lo v1.33.0
github.com/spf13/viper v1.8.1
github.com/thoas/go-funk v0.9.2
github.com/urfave/cli v1.22.10
github.com/wailsapp/wails/v2 v2.4.1
Expand Down Expand Up @@ -97,6 +99,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/goccy/go-json v0.9.7 // indirect
Expand All @@ -112,17 +115,23 @@ require (
github.com/leaanthony/go-ansi-parser v1.0.1 // indirect
github.com/leaanthony/gosod v1.0.3 // indirect
github.com/leaanthony/slicer v1.5.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pluralsh/controller-reconcile-helper v0.0.4 // indirect
github.com/spf13/afero v1.8.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tkrajina/go-reflector v0.5.5 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/vektah/gqlparser/v2 v2.5.1 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down Expand Up @@ -251,7 +260,7 @@ require (
github.com/schollz/progressbar/v3 v3.8.6 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down Expand Up @@ -293,3 +302,5 @@ require (
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)

replace github.com/norwoodj/helm-docs v1.11.2 => github.com/pluralsh/helm-docs v1.11.3-0.20230914190909-3fe18acd95d7
Loading
Loading