Allow declaratively running starlark functions

This commit is contained in:
Phillip Wittrock
2020-04-20 18:37:44 -07:00
parent 982b9e77d4
commit c1f2dd3688
2 changed files with 14 additions and 4 deletions

View File

@@ -217,8 +217,8 @@ func toStorageMounts(mounts []string) []filters.StorageMount {
}
func (r *RunFnRunner) preRunE(c *cobra.Command, args []string) error {
if r.EnableStar != (r.StarPath != "") {
return errors.Errorf("must specify --star-path with --enable-star")
if !r.EnableStar && r.StarPath != "" {
return errors.Errorf("must specify --enable-star with --star-path")
}
if c.ArgsLenAtDash() >= 0 && r.Image == "" &&

View File

@@ -183,7 +183,7 @@ apiVersion: v1
"--star-name", "foo",
"--", "Foo", "g=h"},
path: "dir",
err: "must specify --star-path with --enable-star",
err: "must specify --enable-star with --star-path",
},
{
name: "image-star-not-enabled",
@@ -193,7 +193,17 @@ apiVersion: v1
"--star-name", "foo",
"--", "Foo", "g=h"},
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",