forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.go
35 lines (28 loc) · 721 Bytes
/
data.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package executor
import (
"context"
"encoding/json"
"fmt"
"k8s.io/utils/pointer"
"github.com/argoproj/argo-workflows/v3/workflow/data"
)
func (we *WorkflowExecutor) Data(ctx context.Context) error {
dataTemplate := we.Template.Data
if dataTemplate == nil {
return fmt.Errorf("no data template found")
}
transformedData, err := data.ProcessData(dataTemplate, newExecutorDataSourceProcessor(ctx, we))
if err != nil {
return fmt.Errorf("unable to process data template: %w", err)
}
out, err := json.Marshal(transformedData)
if err != nil {
return err
}
we.Template.Outputs.Result = pointer.StringPtr(string(out))
err = we.AnnotateOutputs(ctx, nil)
if err != nil {
return err
}
return nil
}