コード例 #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)
}