1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

shared container for job

This commit is contained in:
Casey Lee 2020-02-23 15:01:25 -08:00
parent a3af4d491b
commit 12ac7300b9
10 changed files with 444 additions and 531 deletions

View file

@ -11,7 +11,6 @@ import (
"regexp"
"strings"
"github.com/nektos/act/pkg/model"
"github.com/robertkrimen/otto"
"github.com/sirupsen/logrus"
"gopkg.in/godo.v2/glob"
@ -34,11 +33,11 @@ func (rc *RunContext) NewExpressionEvaluator() ExpressionEvaluator {
}
}
// NewStepExpressionEvaluator creates a new evaluator
func (rc *RunContext) NewStepExpressionEvaluator(step *model.Step) ExpressionEvaluator {
vm := rc.newVM()
// NewExpressionEvaluator creates a new evaluator
func (sc *StepContext) NewExpressionEvaluator() ExpressionEvaluator {
vm := sc.RunContext.newVM()
configers := []func(*otto.Otto){
rc.vmEnv(step),
sc.vmEnv(),
}
for _, configer := range configers {
configer(vm)
@ -236,10 +235,9 @@ func (rc *RunContext) vmGithub() func(*otto.Otto) {
}
}
func (rc *RunContext) vmEnv(step *model.Step) func(*otto.Otto) {
func (sc *StepContext) vmEnv() func(*otto.Otto) {
return func(vm *otto.Otto) {
env := rc.StepEnv(step)
_ = vm.Set("env", env)
_ = vm.Set("env", sc.Env)
}
}