Skip to content

Commit

Permalink
fix: correctly unmarshal entrypoint (#876)
Browse files Browse the repository at this point in the history
Signed-off-by: hackercat <[email protected]>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Ryan and mergify[bot] authored Nov 13, 2021
1 parent ec34eb9 commit 12fa4d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/model/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
11 changes: 10 additions & 1 deletion pkg/runner/step_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions pkg/runner/testdata/actions/docker-url/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ inputs:
runs:
using: docker
image: docker://node:12-buster-slim
entrypoint: /bin/sh -c
env:
TEST: enabled
args:
Expand Down

0 comments on commit 12fa4d7

Please sign in to comment.