Skip to content

Fix: Fix output #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Fix: Fix output #203

wants to merge 4 commits into from

Conversation

shivin
Copy link

@shivin shivin commented Apr 10, 2025

Description of your changes

Fixes #6734
We looked at the issue and debugged the code. We added following fixes to fix the issue:

  1. Add backward compatibility for workflow outputs with builtin function.
  2. We observed extra quotes coming in the string written to configmap. Replaced util.ToString to sets.ToString in writeToStore function.
    I have:
  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

We tested the code by applying KubeVela application and verified the output is proper.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: test-app
spec:
  components: []
  workflow:
    steps:
      - name: read-secret
        type: read-object
        properties:
          apiVersion: v1
          kind: Secret
          name: mysecret
        outputs:
          - name: mypasswor1
            valueFrom: |-
              import "encoding/base64"
              "\(base64.Decode(null,output.value.data["password"] ))"

Data in ConfigMap:

apiVersion: v1
data:
  vars: |
    mypasswor1: "mypassword"
kind: ConfigMap

Special notes for your reviewer

@shivin shivin changed the title Fix output Fix: Fix output Apr 10, 2025
@@ -71,6 +71,13 @@ func Output(ctx wfContext.Context, taskValue cue.Value, step v1alpha1.WorkflowSt
} else {
v, err = value.LookupValueByScript(taskValue, fmt.Sprintf("%s.$returns", output.ValueFrom))
}
} else if v.Err() != nil && !strings.Contains(output.ValueFrom, "$returns.") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you merge it with the above case?
something like

if (err != nil && strings.Contains(err.Error(), "not exist") ||v.Err() != nil)  && !strings.Contains(output.ValueFrom, "$returns.")

shivin and others added 4 commits April 14, 2025 12:32
Signed-off-by: Pushparaj Shetty KS <[email protected]>
Signed-off-by: Pushparaj Shetty K S <[email protected]>
Signed-off-by: Pushparaj Shetty KS <[email protected]>
Signed-off-by: Pushparaj Shetty K S <[email protected]>
Signed-off-by: Pushparaj Shetty KS <[email protected]>
Signed-off-by: Pushparaj Shetty K S <[email protected]>
Signed-off-by: Pushparaj Shetty K S <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in workflow outputs with decode function from v1.9.11 to v1.10.x
3 participants