func NewStepsContext()

in pkg/runner/steps_context.go [25:54]


func NewStepsContext(globalCtx *GlobalContext, stepDir string, inputs map[string]*structpb.Value, env *Environment, options ...func(*StepsContext)) (*StepsContext, error) {
	outputFile, err := NewStepFileInTmp()

	if err != nil {
		return nil, fmt.Errorf("creating steps context: output file: %w", err)
	}

	exportFile, err := NewStepFileInTmp()

	if err != nil {
		return nil, fmt.Errorf("creating steps context: export file: %w", err)
	}

	stepsCtx := &StepsContext{
		globalCtx:  globalCtx,
		stepDir:    stepDir,
		env:        env,
		inputs:     inputs,
		steps:      map[string]*proto.StepResult{},
		outputFile: outputFile,
		exportFile: exportFile,
	}

	for _, option := range options {
		option(stepsCtx)
	}

	precond.MustNotBeNil(stepsCtx.env, "steps context must have an environment")
	return stepsCtx, nil
}