properly parse arguments to Docker container steps (#539)
This commit is contained in:
parent
c4f1f3a1cf
commit
475a6aa1d0
1
go.mod
1
go.mod
|
@ -24,6 +24,7 @@ require (
|
||||||
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
|
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
|
||||||
github.com/imdario/mergo v0.3.11 // indirect
|
github.com/imdario/mergo v0.3.11 // indirect
|
||||||
github.com/joho/godotenv v1.3.0
|
github.com/joho/godotenv v1.3.0
|
||||||
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
||||||
github.com/mgutz/str v1.2.0 // indirect
|
github.com/mgutz/str v1.2.0 // indirect
|
||||||
github.com/morikuni/aec v1.0.0 // indirect
|
github.com/morikuni/aec v1.0.0 // indirect
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/kballard/go-shellquote"
|
||||||
|
|
||||||
"github.com/nektos/act/pkg/common"
|
"github.com/nektos/act/pkg/common"
|
||||||
"github.com/nektos/act/pkg/container"
|
"github.com/nektos/act/pkg/container"
|
||||||
|
@ -241,7 +242,10 @@ func (sc *StepContext) runUsesContainer() common.Executor {
|
||||||
step := sc.Step
|
step := sc.Step
|
||||||
return func(ctx context.Context) error {
|
return func(ctx context.Context) error {
|
||||||
image := strings.TrimPrefix(step.Uses, "docker://")
|
image := strings.TrimPrefix(step.Uses, "docker://")
|
||||||
cmd := strings.Fields(sc.RunContext.NewExpressionEvaluator().Interpolate(step.With["args"]))
|
cmd, err := shellquote.Split(sc.RunContext.NewExpressionEvaluator().Interpolate(step.With["args"]))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
entrypoint := strings.Fields(step.With["entrypoint"])
|
entrypoint := strings.Fields(step.With["entrypoint"])
|
||||||
stepContainer := sc.newStepContainer(ctx, image, cmd, entrypoint)
|
stepContainer := sc.newStepContainer(ctx, image, cmd, entrypoint)
|
||||||
|
|
||||||
|
@ -355,7 +359,10 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := strings.Fields(step.With["args"])
|
cmd, err := shellquote.Split(step.With["args"])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if len(cmd) == 0 {
|
if len(cmd) == 0 {
|
||||||
cmd = action.Runs.Args
|
cmd = action.Runs.Args
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue