diff --git a/pkg/runner/action_composite.go b/pkg/runner/action_composite.go index a7b4143..c1e94fc 100644 --- a/pkg/runner/action_composite.go +++ b/pkg/runner/action_composite.go @@ -71,6 +71,7 @@ func newCompositeRunContext(ctx context.Context, parent *RunContext, step action Parent: parent, EventJSON: parent.EventJSON, } + compositerc.ExprEval = compositerc.NewExpressionEvaluator(ctx) return compositerc } diff --git a/pkg/runner/job_executor.go b/pkg/runner/job_executor.go index 547e234..e1de6cb 100644 --- a/pkg/runner/job_executor.go +++ b/pkg/runner/job_executor.go @@ -133,7 +133,7 @@ func newJobExecutor(info jobInfo, sf stepFactory, rc *RunContext) common.Executo func useStepLogger(rc *RunContext, stepModel *model.Step, stage stepStage, executor common.Executor) common.Executor { return func(ctx context.Context) error { - ctx = withStepLogger(ctx, stepModel.ID, stepModel.String(), stage.String()) + ctx = withStepLogger(ctx, stepModel.ID, rc.ExprEval.Interpolate(ctx, stepModel.String()), stage.String()) rawLogger := common.Logger(ctx).WithField("raw_output", true) logWriter := common.NewLineWriter(rc.commandHandler(ctx), func(s string) bool { diff --git a/pkg/runner/job_executor_test.go b/pkg/runner/job_executor_test.go index edcbfc1..e00a4fd 100644 --- a/pkg/runner/job_executor_test.go +++ b/pkg/runner/job_executor_test.go @@ -249,7 +249,17 @@ func TestNewJobExecutor(t *testing.T) { sfm := &stepFactoryMock{} rc := &RunContext{ JobContainer: &jobContainerMock{}, + Run: &model.Run{ + JobID: "test", + Workflow: &model.Workflow{ + Jobs: map[string]*model.Job{ + "test": {}, + }, + }, + }, + Config: &Config{}, } + rc.ExprEval = rc.NewExpressionEvaluator(ctx) executorOrder := make([]string, 0) jim.On("steps").Return(tt.steps) diff --git a/pkg/runner/step.go b/pkg/runner/step.go index 8a9d2b6..f730ac1 100644 --- a/pkg/runner/step.go +++ b/pkg/runner/step.go @@ -90,7 +90,7 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo return nil } - stepString := stepModel.String() + stepString := rc.ExprEval.Interpolate(ctx, stepModel.String()) if strings.Contains(stepString, "::add-mask::") { stepString = "add-mask command" } diff --git a/pkg/runner/step_action_local_test.go b/pkg/runner/step_action_local_test.go index 6b14f3d..6390289 100644 --- a/pkg/runner/step_action_local_test.go +++ b/pkg/runner/step_action_local_test.go @@ -275,6 +275,7 @@ func TestStepActionLocalPost(t *testing.T) { Step: tt.stepModel, action: tt.actionModel, } + sal.RunContext.ExprEval = sal.RunContext.NewExpressionEvaluator(ctx) if tt.mocks.env { cm.On("UpdateFromImageEnv", &sal.env).Return(func(ctx context.Context) error { return nil }) diff --git a/pkg/runner/step_action_remote_test.go b/pkg/runner/step_action_remote_test.go index 84fe082..72b0eee 100644 --- a/pkg/runner/step_action_remote_test.go +++ b/pkg/runner/step_action_remote_test.go @@ -155,6 +155,7 @@ func TestStepActionRemote(t *testing.T) { readAction: sarm.readAction, runAction: sarm.runAction, } + sar.RunContext.ExprEval = sar.RunContext.NewExpressionEvaluator(ctx) suffixMatcher := func(suffix string) interface{} { return mock.MatchedBy(func(actionDir string) bool { @@ -586,6 +587,7 @@ func TestStepActionRemotePost(t *testing.T) { Step: tt.stepModel, action: tt.actionModel, } + sar.RunContext.ExprEval = sar.RunContext.NewExpressionEvaluator(ctx) if tt.mocks.env { cm.On("UpdateFromImageEnv", &sar.env).Return(func(ctx context.Context) error { return nil }) diff --git a/pkg/runner/step_docker_test.go b/pkg/runner/step_docker_test.go index e0e8575..2008357 100644 --- a/pkg/runner/step_docker_test.go +++ b/pkg/runner/step_docker_test.go @@ -25,6 +25,8 @@ func TestStepDockerMain(t *testing.T) { ContainerNewContainer = origContainerNewContainer })() + ctx := context.Background() + sd := &stepDocker{ RunContext: &RunContext{ StepResults: map[string]*model.StepResult{}, @@ -51,8 +53,7 @@ func TestStepDockerMain(t *testing.T) { WorkingDirectory: "workdir", }, } - - ctx := context.Background() + sd.RunContext.ExprEval = sd.RunContext.NewExpressionEvaluator(ctx) cm.On("UpdateFromImageEnv", mock.AnythingOfType("*map[string]string")).Return(func(ctx context.Context) error { return nil