Skip to content

Commit 47573af

Browse files
authored
Deprecate --chart flag (#413)
1 parent c93479b commit 47573af

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

cli/cmd/cluster_prepare.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ replicated cluster prepare --distribution eks --version 1.27 --instance-type c6.
9191

9292
// for builders plan (chart only)
9393
cmd.Flags().StringVar(&r.args.prepareClusterChart, "chart", "", "Path to the helm chart package to deploy")
94+
cmd.Flags().MarkHidden("chart")
95+
9496
addValueOptionsFlags(cmd.Flags(), &r.args.prepareClusterValueOpts)
9597

9698
cmd.Flags().StringVar(&r.args.prepareClusterNamespace, "namespace", "default", "The namespace into which to deploy the KOTS application or Helm chart.")
@@ -130,6 +132,7 @@ func validateClusterPrepareFlags(args runnerArgs) error {
130132
}
131133

132134
if args.prepareClusterChart != "" {
135+
printChartDeprecationWarning()
133136
if args.prepareClusterKotsSharedPassword != "" {
134137
return errors.New("The --shared-password flag cannot be used when deploying a Helm chart")
135138
}
@@ -309,6 +312,7 @@ func prepareRelease(r *runners, log *logger.Logger) (*types.ReleaseInfo, error)
309312
}
310313

311314
if r.args.prepareClusterChart != "" {
315+
printChartDeprecationWarning()
312316
fmt.Fprintln(r.w)
313317
log.ActionWithSpinner("Reading chart from %s", r.args.prepareClusterChart)
314318
var err error

cli/cmd/release_create.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func (r *runners) InitReleaseCreate(parent *cobra.Command) error {
5959
cmd.Flags().MarkHidden("yaml-file")
6060
cmd.Flags().MarkHidden("yaml")
6161

62+
// deprecated
63+
cmd.Flags().MarkHidden("chart")
64+
6265
cmd.RunE = r.releaseCreate
6366
return nil
6467
}
@@ -242,6 +245,8 @@ Prepared to create release with defaults:
242245
}
243246

244247
if r.args.createReleaseChart != "" {
248+
printChartDeprecationWarning()
249+
245250
fmt.Fprint(r.w, "You are creating a release that will only be installable with the helm CLI.\n"+
246251
"For more information, see \n"+
247252
"https://docs.replicated.com/vendor/helm-install#about-helm-installations-with-replicated\n")

cli/cmd/release_lint.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ func (r *runners) InitReleaseLint(parent *cobra.Command) {
3737
cmd.Flags().StringVar(&r.args.lintReleaseFailOn, "fail-on", "error", "The minimum severity to cause the command to exit with a non-zero exit code. Supported values are [info, warn, error, none].")
3838
cmd.Flags().StringVar(&r.outputFormat, "output", "table", "The output format to use. One of: json|table (default: table)")
3939

40+
// deprecated
41+
cmd.Flags().MarkHidden("chart")
42+
4043
cmd.RunE = r.releaseLint
4144
}
4245

@@ -60,6 +63,7 @@ func (r *runners) releaseLint(cmd *cobra.Command, args []string) error {
6063
isBuildersRelease = isHelmChartsOnly
6164
contentType = "application/tar"
6265
} else if r.args.lintReleaseChart != "" {
66+
printChartDeprecationWarning()
6367
data, err := os.ReadFile(r.args.lintReleaseChart)
6468
if err != nil {
6569
return errors.Wrap(err, "failed to read chart file")

cli/cmd/release_update.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ func (r *runners) InitReleaseUpdate(parent *cobra.Command) {
2424
cmd.Flags().StringVar(&r.args.updateReleaseYamlDir, "yaml-dir", "", "The directory containing multiple yamls for a Kots release. Cannot be used with the --yaml flag.")
2525
cmd.Flags().StringVar(&r.args.updateReleaseChart, "chart", "", "Helm chart to create the release from. Cannot be used with the --yaml, --yaml-file, or --yaml-dir flags.")
2626

27+
// deprecated
28+
cmd.Flags().MarkHidden("chart")
29+
2730
cmd.RunE = r.releaseUpdate
2831
}
2932

@@ -85,6 +88,7 @@ func (r *runners) releaseUpdate(cmd *cobra.Command, args []string) error {
8588
return errors.Wrap(err, "make release from dir")
8689
}
8790
} else if r.args.updateReleaseChart != "" {
91+
printChartDeprecationWarning()
8892
r.args.updateReleaseYaml, err = makeReleaseFromChart(r.args.updateReleaseChart)
8993
if err != nil {
9094
return errors.Wrap(err, "make release from chart")

cli/cmd/root.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"text/tabwriter"
1010

11+
"github.com/fatih/color"
1112
"github.com/pkg/errors"
1213

1314
"github.com/replicatedhq/replicated/pkg/credentials"
@@ -364,6 +365,11 @@ func printIfError(cmd *cobra.Command, err error) {
364365
}
365366
}
366367

368+
func printChartDeprecationWarning() {
369+
red := color.New(color.FgHiRed)
370+
red.Fprintf(os.Stderr, "\nThe --chart flag is deprecated and will be removed in a future release. Please use the --yaml or --yaml-dir flag instead.\n\n")
371+
}
372+
367373
func parseTags(tags []string) ([]types.Tag, error) {
368374
parsedTags := []types.Tag{}
369375
for _, tag := range tags {

0 commit comments

Comments
 (0)