1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix tests

Signed-off-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Casey Lee 2020-02-13 11:47:38 -08:00
parent e67e06809c
commit 7183c74cd0
6 changed files with 159 additions and 29 deletions

View file

@ -22,21 +22,20 @@ import (
// RunContext contains info about current job
type RunContext struct {
Config *Config
Run *model.Run
EventJSON string
Env map[string]string
Outputs map[string]string
Tempdir string
Config *Config
Run *model.Run
EventJSON string
Env map[string]string
Outputs map[string]string
Tempdir string
PriorStepFailed bool
ExtraPath []string
}
// GetEnv returns the env for the context
func (rc *RunContext) GetEnv() map[string]string {
if rc.Env == nil {
rc.Env = mergeMaps(rc.Run.Workflow.Env, rc.Run.Job().Env)
if rc.Env["PATH"] == "" {
rc.Env["PATH"] = "/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
}
}
return rc.Env
}
@ -64,8 +63,10 @@ func (rc *RunContext) Executor() common.Executor {
err := rc.newStepExecutor(s)(ctx)
if err == nil {
common.Logger(ctx).Infof(" \u2705 Success - %s", s)
rc.PriorStepFailed = false
} else {
common.Logger(ctx).Errorf(" \u274C Failure - %s", s)
rc.PriorStepFailed = true
}
return err
})