Skip to content

Commit

Permalink
Make rendering template in agent client temporary
Browse files Browse the repository at this point in the history
Signed-off-by: Edwin Yu <[email protected]>
  • Loading branch information
edwinyyyu committed Aug 25, 2023
1 parent fb574a3 commit cbc6ec9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go/tasks/plugins/webapi/agent/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ func (p Plugin) Create(ctx context.Context, taskCtx webapi.TaskExecutionContextR
return nil, nil, err
}

var argTemplate []string
if taskTemplate.GetContainer() != nil {
templateParameters := template.Parameters{
TaskExecMetadata: taskCtx.TaskExecutionMetadata(),
Inputs: taskCtx.InputReader(),
OutputPath: taskCtx.OutputWriter(),
Task: taskCtx.TaskReader(),
}
argTemplate = taskTemplate.GetContainer().Args
modifiedArgs, err := template.Render(ctx, taskTemplate.GetContainer().Args, templateParameters)
if err != nil {
return nil, nil, err
Expand All @@ -103,6 +105,10 @@ func (p Plugin) Create(ctx context.Context, taskCtx webapi.TaskExecutionContextR
return nil, nil, err
}

if taskTemplate.GetContainer() != nil {
taskTemplate.GetContainer().Args = argTemplate
}

return &ResourceMetaWrapper{
OutputPrefix: outputPrefix,
AgentResourceMeta: res.GetResourceMeta(),
Expand Down

0 comments on commit cbc6ec9

Please sign in to comment.