mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
* feat:(Changed order of events, to prevent enviroment to run before if statement is run * changed issue597 to issue-597 * Added test for linux/amd64
This commit is contained in:
parent
c93106acb2
commit
eab73d227f
3 changed files with 51 additions and 11 deletions
|
@ -212,6 +212,23 @@ func (rc *RunContext) newStepExecutor(step *model.Step) common.Executor {
|
|||
Success: true,
|
||||
Outputs: make(map[string]string),
|
||||
}
|
||||
runStep, err := rc.EvalBool(sc.Step.If)
|
||||
|
||||
if err != nil {
|
||||
common.Logger(ctx).Errorf(" \u274C Error in if: expression - %s", sc.Step)
|
||||
exprEval, err := sc.setupEnv(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rc.ExprEval = exprEval
|
||||
rc.StepResults[rc.CurrentStep].Success = false
|
||||
return err
|
||||
}
|
||||
|
||||
if !runStep {
|
||||
log.Debugf("Skipping step '%s' due to '%s'", sc.Step.String(), sc.Step.If)
|
||||
return nil
|
||||
}
|
||||
|
||||
exprEval, err := sc.setupEnv(ctx)
|
||||
if err != nil {
|
||||
|
@ -219,17 +236,6 @@ func (rc *RunContext) newStepExecutor(step *model.Step) common.Executor {
|
|||
}
|
||||
rc.ExprEval = exprEval
|
||||
|
||||
runStep, err := rc.EvalBool(sc.Step.If)
|
||||
if err != nil {
|
||||
common.Logger(ctx).Errorf(" \u274C Error in if: expression - %s", sc.Step)
|
||||
rc.StepResults[rc.CurrentStep].Success = false
|
||||
return err
|
||||
}
|
||||
if !runStep {
|
||||
log.Debugf("Skipping step '%s' due to '%s'", sc.Step.String(), sc.Step.If)
|
||||
return nil
|
||||
}
|
||||
|
||||
common.Logger(ctx).Infof("\u2B50 Run %s", sc.Step)
|
||||
err = sc.Executor()(ctx)
|
||||
if err == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue