()
| 56 | } |
| 57 | |
| 58 | func (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 | |
| 88 | var ( |
| 89 | ContainerNewContainer = container.NewContainer |
no test coverage detected