Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit a4333e8

Browse files
committed
Change type of flag from boolean to string, rename to --stack-version
Signed-off-by: Joffrey F <joffrey@docker.com>
1 parent 75db77c commit a4333e8

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

cmd/docker-app/helm.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"fmt"
5+
46
"github.com/docker/app/internal"
57
"github.com/docker/app/internal/packager"
68
"github.com/docker/app/internal/renderer"
@@ -9,11 +11,11 @@ import (
911
)
1012

1113
var (
12-
beta1 bool
1314
helmComposeFiles []string
1415
helmSettingsFile []string
1516
helmEnv []string
1617
helmRender bool
18+
stackVersion string
1719
)
1820

1921
func helmCmd() *cobra.Command {
@@ -32,7 +34,10 @@ func helmCmd() *cobra.Command {
3234
if err != nil {
3335
return err
3436
}
35-
return renderer.Helm(appname, helmComposeFiles, helmSettingsFile, d, helmRender, beta1)
37+
if stackVersion != "v1beta2" && stackVersion != "v1beta1" {
38+
return fmt.Errorf("invalid stack version %q (accepted values: v1beta1, v1beta2)", stackVersion)
39+
}
40+
return renderer.Helm(appname, helmComposeFiles, helmSettingsFile, d, helmRender, stackVersion)
3641
},
3742
}
3843
if internal.Experimental == "on" {
@@ -44,6 +49,6 @@ be rendered instead of exported as a template.`
4449
}
4550
cmd.Flags().StringArrayVarP(&helmSettingsFile, "settings-files", "f", []string{}, "Override settings files")
4651
cmd.Flags().StringArrayVarP(&helmEnv, "set", "s", []string{}, "Override settings values")
47-
cmd.Flags().BoolVarP(&beta1, "beta1", "b", false, "Use an older specification to produce a chart compatible with Docker UCP 2.0")
52+
cmd.Flags().StringVarP(&stackVersion, "stack-version", "", "v1beta2", "Version of the stack specification for the produced helm chart")
4853
return cmd
4954
}

internal/renderer/helm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ func makeStack(appname string, targetDir string, data []byte, beta1 bool) error
316316
}
317317

318318
// Helm renders an app as an Helm Chart
319-
func Helm(appname string, composeFiles []string, settingsFile []string, env map[string]string, render, beta1 bool) error {
319+
func Helm(appname string, composeFiles []string, settingsFile []string, env map[string]string, render bool, stackVersion string) error {
320320
targetDir := internal.AppNameFromDir(appname) + ".chart"
321+
beta1 := stackVersion == "v1beta1"
321322
if err := os.Mkdir(targetDir, 0755); err != nil && !os.IsExist(err) {
322323
return errors.Wrap(err, "failed to create Chart directory")
323324
}

0 commit comments

Comments
 (0)