shared container for job

This commit is contained in:
Casey Lee
2020-02-23 15:01:25 -08:00
parent 9179d8924d
commit 01876438c2
11 changed files with 445 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)
}
}