// Run one or more tasks func Run(options RunOptions) error { options.Tasks = getNames(options) if len(options.Tasks) == 0 { return fmt.Errorf("no task to run, and no default task defined") } execEnv, err := execenv.NewExecEnvFromConfig( options.Config.Meta.ExecID, options.Config.Meta.Project, options.Config.WorkingDir, ) if err != nil { return err } tasks, err := collectTasks(options, execEnv) if err != nil { return err } ctx := context.NewExecuteContext( options.Config, options.Client, execEnv, options.Quiet) return executeTasks(ctx, tasks) }
func (s *CreateTaskSuite) SetupTest() { var err error s.path, err = ioutil.TempDir("", "mount-task-test") s.Require().Nil(err) s.task = &Task{ name: task.NewName("resource", "action"), config: &config.MountConfig{ Bind: filepath.Join("a", "b", "c"), Path: "/target", ReadOnly: false, }, run: runCreate, } s.action = &createAction{task: s.task} s.ctx = context.NewExecuteContext( &config.Config{WorkingDir: s.path}, nil, nil, false) }