Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
submodules: true

- name: Cache Go Dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
Expand Down
3 changes: 1 addition & 2 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/kubevela/pkg/cue/util"
"github.com/kubevela/pkg/util/rand"
"github.com/kubevela/pkg/util/singleton"
"github.com/kubevela/workflow/pkg/cue/model/sets"
Expand Down Expand Up @@ -160,7 +159,7 @@ func (wf *WorkflowContext) Commit(ctx context.Context) error {
}

func (wf *WorkflowContext) writeToStore() error {
varStr, err := util.ToString(wf.vars)
varStr, err := sets.ToString(wf.vars)
if err != nil {
return err
}
Expand Down
11 changes: 8 additions & 3 deletions pkg/hooks/data_passing.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ func Output(ctx wfContext.Context, taskValue cue.Value, step v1alpha1.WorkflowSt
SetAdditionalNameInStatus(stepStatus, step.Name, step.Properties, status)
for _, output := range step.Outputs {
v, err := value.LookupValueByScript(taskValue, output.ValueFrom)
if err != nil && strings.Contains(err.Error(), "not exist") && !strings.Contains(output.ValueFrom, "$returns.") {
parts := strings.Split(output.ValueFrom, ".")
if (err != nil && strings.Contains(err.Error(), "not exist") || v.Err() != nil) && !strings.Contains(output.ValueFrom, "$returns.") {
parts := strings.Split(output.ValueFrom, "output.")
if len(parts) > 1 {
v, err = value.LookupValueByScript(taskValue, fmt.Sprintf("%s.$returns.%s", parts[0], strings.Join(parts[1:], ".")))
if parts[0] == "" {
v, err = value.LookupValueByScript(taskValue, fmt.Sprintf("output.$returns.%s", strings.Join(parts[1:], ".")))
} else {
v, err = value.LookupValueByScript(taskValue, fmt.Sprintf("%soutput.$returns.%s", parts[0], strings.Join(parts[1:], ".")))
}

} else {
v, err = value.LookupValueByScript(taskValue, fmt.Sprintf("%s.$returns", output.ValueFrom))
}
Expand Down
1 change: 0 additions & 1 deletion pkg/hooks/data_passing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ func TestOutput(t *testing.T) {
r.Equal(int(resultInt), 99)
r.Equal(stepStatus["mystep"].Phase, v1alpha1.WorkflowStepPhaseSucceeded)


taskValue = cuectx.CompileString(`output: $returns: score: 99`)
stepStatus = make(map[string]v1alpha1.StepStatus)
err = Output(wfCtx, taskValue, v1alpha1.WorkflowStep{
Expand Down
Loading