// 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) }
// 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 }
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 }
// 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 }
func remove(task *Task, ctx *context.ExecuteContext) (bool, error) { logging.ForTask(task).Warn("Bind mounts are not removable") return false, nil }
// 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 }
func (t *Task) logger() *log.Entry { return logging.ForTask(t) }