diff --git a/pkg/action/runtime.container.go b/pkg/action/runtime.container.go index bc8ae57..4769c2e 100644 --- a/pkg/action/runtime.container.go +++ b/pkg/action/runtime.container.go @@ -117,6 +117,7 @@ func (c *runtimeContainer) GetFlags() *FlagsGroup { Title: "Remote copy back", Description: "Copies the working directory back from the container. Works only if the runtime is remote.", Type: jsonschema.Boolean, + Default: false, }, &DefParameter{ Name: containerFlagRemoveImage, @@ -161,7 +162,8 @@ func (c *runtimeContainer) ValidateInput(input *Input) error { } // early peak for an exec flag. - if c.exec { + exec := input.GetFlagInGroup(c.flags.GetName(), containerFlagExec) + if exec != nil && exec.(bool) { // Mark input as validated because arguments are passed directly to exec. input.SetValidated(true) } @@ -188,7 +190,7 @@ func (c *runtimeContainer) SetFlags(input *Input) error { c.noCache = nc.(bool) } - if e, ok := flags[containerFlagEntrypoint]; ok { + if e, ok := flags[containerFlagEntrypoint]; ok && e != "" { c.entrypointSet = true c.entrypoint = e.(string) } diff --git a/plugins/actionscobra/cobra.go b/plugins/actionscobra/cobra.go index bafe5c2..68f2f22 100644 --- a/plugins/actionscobra/cobra.go +++ b/plugins/actionscobra/cobra.go @@ -35,8 +35,12 @@ func CobraImpl(a *action.Action, streams launchr.Streams, manager action.Manager if rt, ok := a.Runtime().(action.RuntimeFlags); ok { runtimeFlagsGroup := rt.GetFlags() runOpts = derefOpts(filterChangedFlags(cmd, runOpts)) - for k, v := range runOpts { - input.SetFlagInGroup(runtimeFlagsGroup.GetName(), k, v) + for flag, defaultValue := range runtimeFlagsGroup.GetAll() { + value := defaultValue + if runOpts[flag] != nil { + value = runOpts[flag] + } + input.SetFlagInGroup(runtimeFlagsGroup.GetName(), flag, value) } }