fix: correctly unmarshal entrypoint (#876)

Signed-off-by: hackercat <me@hackerc.at>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Ryan 2021-11-13 20:43:31 +01:00 committed by GitHub
parent ec34eb9532
commit 12fa4d703d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View file

@ -47,7 +47,7 @@ type ActionRuns struct {
Env map[string]string `yaml:"env"`
Main string `yaml:"main"`
Image string `yaml:"image"`
Entrypoint []string `yaml:"entrypoint"`
Entrypoint string `yaml:"entrypoint"`
Args []string `yaml:"args"`
Steps []Step `yaml:"steps"`
}

View file

@ -527,6 +527,8 @@ func (sc *StepContext) runAction(actionDir string, actionPath string, localActio
}
}
// TODO: break out parts of function to reduce complexicity
// nolint:gocyclo
func (sc *StepContext) execAsDocker(ctx context.Context, action *model.Action, actionName string, containerLocation string, actionLocation string, rc *RunContext, step *model.Step, localAction bool) error {
var prepImage common.Executor
var image string
@ -589,7 +591,14 @@ func (sc *StepContext) execAsDocker(ctx context.Context, action *model.Action, a
}
entrypoint := strings.Fields(step.With["entrypoint"])
if len(entrypoint) == 0 {
entrypoint = action.Runs.Entrypoint
if action.Runs.Entrypoint != "" {
entrypoint, err = shellquote.Split(action.Runs.Entrypoint)
if err != nil {
return err
}
} else {
entrypoint = nil
}
}
stepContainer := sc.newStepContainer(ctx, image, cmd, entrypoint)
return common.NewPipelineExecutor(

View file

@ -9,6 +9,7 @@ inputs:
runs:
using: docker
image: docker://node:12-buster-slim
entrypoint: /bin/sh -c
env:
TEST: enabled
args: