MCPcopy
hub / github.com/nektos/act / runUsesContainer

Method runUsesContainer

pkg/runner/step_docker.go:58–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56}
57
58func (sd *stepDocker) runUsesContainer() common.Executor {
59 rc := sd.RunContext
60 step := sd.Step
61
62 return func(ctx context.Context) error {
63 image := strings.TrimPrefix(step.Uses, "docker://")
64 eval := rc.NewExpressionEvaluator(ctx)
65 cmd, err := shellquote.Split(eval.Interpolate(ctx, step.With["args"]))
66 if err != nil {
67 return err
68 }
69
70 var entrypoint []string
71 if entry := eval.Interpolate(ctx, step.With["entrypoint"]); entry != "" {
72 entrypoint = []string{entry}
73 }
74
75 stepContainer := sd.newStepContainer(ctx, image, cmd, entrypoint)
76
77 return common.NewPipelineExecutor(
78 stepContainer.Pull(rc.Config.ForcePull),
79 stepContainer.Remove().IfBool(!rc.Config.ReuseContainers),
80 stepContainer.Create(rc.Config.ContainerCapAdd, rc.Config.ContainerCapDrop),
81 stepContainer.Start(true),
82 ).Finally(
83 stepContainer.Remove().IfBool(!rc.Config.ReuseContainers),
84 ).Finally(stepContainer.Close())(ctx)
85 }
86}
87
88var (
89 ContainerNewContainer = container.NewContainer

Callers 1

mainMethod · 0.95

Calls 11

InterpolateMethod · 0.95
newStepContainerMethod · 0.95
NewPipelineExecutorFunction · 0.92
FinallyMethod · 0.80
IfBoolMethod · 0.80
PullMethod · 0.65
RemoveMethod · 0.65
CreateMethod · 0.65
StartMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected