in codecatalyst-runner/pkg/workflows/workflow_features_provider.go [110:175]
func (wfp *workflowFeaturesProvider) Features(plan runner.Plan) ([]runner.Feature, error) {
action := wfp.workflowActions[plan.ID()]
var outputs map[string]string
if po, ok := planOutputs[plan.ID()]; ok {
outputs = po
} else {
outputs = make(map[string]string)
planOutputs[plan.ID()] = outputs
}
var loggerFeature runner.Feature
switch wfp.outputMode {
case OutputModeTUI:
loggerFeature = features.TUILogger(plan.ID())
case OutputModeText:
loggerFeature = features.ConsoleLogger()
}
ft := []runner.Feature{
features.Reuse(wfp.Reuse),
actions.ActionOutputHandler(outputs, false),
features.Dryrun(wfp.dryrun),
}
if wfp.sharedCompute || (action != nil && slices.Contains(action.Inputs.Sources, "WorkflowSource")) {
ft = append(ft,
features.WorkingDirImporter(wfp.EnvironmentConfiguration.WorkingDir, wfp.cacheDir, wfp.bindWorkingDir, wfp.sharedCompute, &wfp.isWorkingDirSetup),
)
}
if action != nil && action.Environment.Name != "" {
if profile, ok := wfp.environmentProfiles[action.Environment.Name]; !ok {
return nil, fmt.Errorf("no AWS profile has been associated with environment %s", action.Environment.Name)
} else {
ft = append(ft, AWSEnvironment(profile))
}
}
inputs := make(map[string]string)
if action != nil {
for _, input := range action.Inputs.Variables {
inputs[input.Name] = input.Value
}
}
if action != nil && !wfp.noCache {
ft = append(ft, FileCache(wfp.EnvironmentConfiguration.WorkingDir, action.Caching.FileCaching, staticCacheDirProvider(wfp.cacheDir)))
}
ft = append(ft,
features.StatusLogger(plan.ID()),
)
if action != nil {
ft = append(ft,
OutputArtifacts(plan.ID(), action.Outputs.Artifacts, wfp.artifactPlans, wfp.cacheDir),
InputArtifacts(action.Inputs.Artifacts, wfp.artifactPlans, wfp.cacheDir),
)
}
ft = append(ft,
ReplaceVariableHandler(planOutputs, wfp.secretProvider),
InputVariableHandler(inputs),
features.DependsOn(wfp.planTracker.ProgressHandle(plan.ID())),
loggerFeature,
)
return ft, nil
}