mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 10:30:59 +00:00
Allow declaratively running starlark functions
This commit is contained in:
@@ -217,8 +217,8 @@ func toStorageMounts(mounts []string) []filters.StorageMount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *RunFnRunner) preRunE(c *cobra.Command, args []string) error {
|
func (r *RunFnRunner) preRunE(c *cobra.Command, args []string) error {
|
||||||
if r.EnableStar != (r.StarPath != "") {
|
if !r.EnableStar && r.StarPath != "" {
|
||||||
return errors.Errorf("must specify --star-path with --enable-star")
|
return errors.Errorf("must specify --enable-star with --star-path")
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ArgsLenAtDash() >= 0 && r.Image == "" &&
|
if c.ArgsLenAtDash() >= 0 && r.Image == "" &&
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ apiVersion: v1
|
|||||||
"--star-name", "foo",
|
"--star-name", "foo",
|
||||||
"--", "Foo", "g=h"},
|
"--", "Foo", "g=h"},
|
||||||
path: "dir",
|
path: "dir",
|
||||||
err: "must specify --star-path with --enable-star",
|
err: "must specify --enable-star with --star-path",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "image-star-not-enabled",
|
name: "image-star-not-enabled",
|
||||||
@@ -193,7 +193,17 @@ apiVersion: v1
|
|||||||
"--star-name", "foo",
|
"--star-name", "foo",
|
||||||
"--", "Foo", "g=h"},
|
"--", "Foo", "g=h"},
|
||||||
path: "dir",
|
path: "dir",
|
||||||
err: "must specify --star-path with --enable-star",
|
err: "must specify --enable-star with --star-path",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "star-enabled",
|
||||||
|
args: []string{"run", "dir", "--enable-star"},
|
||||||
|
path: "dir",
|
||||||
|
expectedStruct: &runfn.RunFns{
|
||||||
|
Path: "dir",
|
||||||
|
NetworkName: "bridge",
|
||||||
|
EnableStarlark: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "function paths",
|
name: "function paths",
|
||||||
|
|||||||
Reference in New Issue
Block a user