func()

in codecatalyst-runner/pkg/actions/action_plan.go [123:149]


func (ap *actionPlan) loadDockerAction(action *Action, steps []string) error {
	image := action.Runs.Image
	if !strings.HasPrefix(image, "docker://") {
		image = filepath.Join(action.Basedir, image)
	}
	for i, cmd := range []string{action.Runs.PreEntryPoint, action.Runs.Entrypoint, action.Runs.PostEntryPoint} {
		if cmd != "" {
			entrypoint := "/bin/cat"
			cg, err := newCommandGroup(image, entrypoint)
			if err != nil {
				return err
			}
			cg.Commands = append(cg.Commands, []string{cmd})
			if i == 1 { // add steps to the main command group
				log.Debug().Msgf("steps: %+v", steps)
				for _, step := range steps {
					if step != "" {
						cg.Commands = append(cg.Commands, []string{step})
					}
				}
			}
			log.Debug().Msgf("adding command group: %+v", cg)
			ap.commandGroups = append(ap.commandGroups, cg)
		}
	}
	return nil
}