示例#1
0
文件: capture.go 项目: dnephin/dobi
// Run the job to capture the output in a variable
func (t *captureTask) Run(ctx *context.ExecuteContext, _ bool) (bool, error) {
	// Always pass depsModified as true so that the task runs and is never cached
	modified, err := t.runTask.Run(ctx, true)
	if err != nil {
		return modified, err
	}

	out := strings.TrimSpace(t.buffer.String())
	logging.ForTask(t).Debug("Setting %q to: %s", t.variable, out)
	return true, os.Setenv(t.variable, out)
}
示例#2
0
文件: remove.go 项目: dnephin/dobi
// Run creates the host path if it doesn't already exist
func (t *RemoveTask) Run(ctx *context.ExecuteContext, _ bool) (bool, error) {
	logger := logging.ForTask(t)

	RemoveContainer(logger, ctx.Client, ContainerName(ctx, t.name.Resource()), false)

	for _, path := range t.config.Artifact.Paths() {
		if err := os.RemoveAll(path); err != nil {
			logger.Warnf("failed to remove artifact %s: %s", t.config.Artifact, err)
		}
	}

	logger.Info("Removed")
	return true, nil
}
示例#3
0
文件: mount.go 项目: dnephin/dobi
func (t *createAction) run(ctx *context.ExecuteContext) (bool, error) {
	logger := logging.ForTask(t.task)

	if t.exists(ctx) {
		logger.Debug("is fresh")
		return false, nil
	}

	if err := t.create(ctx); err != nil {
		return false, err
	}
	logger.Info("Created")
	return true, nil
}
示例#4
0
文件: env.go 项目: dnephin/dobi
// Run sets environment variables
func (t *Task) Run(ctx *context.ExecuteContext, _ bool) (bool, error) {
	for _, filename := range t.config.Files {
		vars, err := opts.ParseEnvFile(filename)
		if err != nil {
			return true, err
		}
		if err := setVariables(vars); err != nil {
			return true, err
		}
	}
	if err := setVariables(t.config.Variables); err != nil {
		return true, err
	}
	logging.ForTask(t).Info("Done")
	return true, nil
}
示例#5
0
文件: actions.go 项目: dnephin/dobi
func remove(task *Task, ctx *context.ExecuteContext) (bool, error) {
	logging.ForTask(task).Warn("Bind mounts are not removable")
	return false, nil
}
示例#6
0
文件: alias.go 项目: dnephin/dobi
// Run does nothing. Dependencies were already run.
func (t *Task) Run(ctx *context.ExecuteContext, depsModified bool) (bool, error) {
	logging.ForTask(t).Info("Done")
	return depsModified, nil
}
示例#7
0
文件: run.go 项目: dnephin/dobi
func (t *Task) logger() *log.Entry {
	return logging.ForTask(t)
}