Skip to content
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

steps.XX.outputs.parameters.YY is invalid when XX is expanded #3182

Open
jessesuen opened this issue Jun 5, 2020 · 2 comments
Open

steps.XX.outputs.parameters.YY is invalid when XX is expanded #3182

jessesuen opened this issue Jun 5, 2020 · 2 comments
Labels
area/looping `withParams`, `withItems`, and `withSequence` area/templating Templating with `{{...}}` type/feature Feature request

Comments

@jessesuen
Copy link
Member

jessesuen commented Jun 5, 2020

What happened:

A user tried to do something like this:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: steps-
spec:
  entrypoint: entry
  templates:
  - name: entry
    steps:
    - - name: one
        template: whalesay
        withSequence:
          count: "1"
    - - name: two
        template: whalesay
        withParam: "{{steps.one.outputs.parameters.aaa}}"

  - name: whalesay
    container:
      image: docker/whalesay
      command: [cowsay]
      args: ["hello"]
    outputs:
      parameters:
      - name: aaa
        value: "asdf"

We currently allow the referencing of {{steps.one.outputs.parameters.aaa}}. However, when that step is expanded with items, then {{steps.one.outputs.parameters.aaa}} is ambiguous and does not represent a single value.

The above workflow fails with error: withParam value could not be parsed as a JSON list: {{steps.one.outputs.parameters.aaa}}

Name:                steps-66hj2
Namespace:           default
ServiceAccount:      default
Status:              Failed
Message:             withParam value could not be parsed as a JSON list: {{steps.one.outputs.parameters.aaa}}
Conditions:
 Completed           True
Created:             Fri Jun 05 12:45:37 -0700 (5 seconds ago)
Started:             Fri Jun 05 12:45:37 -0700 (5 seconds ago)
Finished:            Fri Jun 05 12:45:43 -0700 (now)
Duration:            6 seconds

STEP             TEMPLATE  PODNAME                DURATION  MESSAGE
 ✖ steps-66hj2   entry                                      withParam value could not be parsed as a JSON list: {{steps.one.outputs.parameters.aaa}}
 ├---✔ one(0:0)  whalesay  steps-66hj2-411194440  4s

We should do one of two things:

  1. prevent this through validation
  2. Make {{steps.one.outputs.parameters.aaa}} reference a virtual json list of the all items of the referenced variable.
@simster7 simster7 self-assigned this Jun 6, 2020
@crenshaw-dev
Copy link
Member

Is there a workaround for this?

@simster7
Copy link
Member

Is there a workaround for this?

To avoid this error for now, don't use output parameters from an expanded step such as withParams, withItems, etc.

We might add support for Jesse's #2 point (Make {{steps.one.outputs.parameters.aaa}} reference a virtual json list of the all items of the referenced variable.) given how feasible it is

@alexec alexec added type/feature Feature request and removed type/bug labels Jul 10, 2020
@alexec alexec added area/templating Templating with `{{...}}` area/looping `withParams`, `withItems`, and `withSequence` labels Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/looping `withParams`, `withItems`, and `withSequence` area/templating Templating with `{{...}}` type/feature Feature request
Projects
None yet
Development

No branches or pull requests

4 participants