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

Workflow cannot read float #4478

Closed
cr4zy-C opened this issue Nov 6, 2020 · 4 comments · Fixed by #4490
Closed

Workflow cannot read float #4478

cr4zy-C opened this issue Nov 6, 2020 · 4 comments · Fixed by #4490
Assignees
Labels
solution/workaround There's a workaround, might not be great, but exists type/bug

Comments

@cr4zy-C
Copy link

cr4zy-C commented Nov 6, 2020

Summary

When a workflow parameter is a float, workflow parsing fails with the error message:
Failed to parse workflow: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal number 0.2 into Go struct field Parameter.spec.arguments.parameters.value of type int

What happened/what you expected to happen?
Would expect that the workflow is parsed correctly, float into type float.

Diagnostics

What Kubernetes provider are you using?
kube_version: 1.19.3 > running in VMs as local installation

when i run kubectl version :

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:50:19Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:41:49Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}

What version of Argo Workflows are you running?

argo: v2.11.7
  BuildDate: 2020-11-02T20:59:01Z
  GitCommit: bf3fec176cf6bdf3e23b2cb73ec7d4e3d051ca40
  GitTreeState: clean
  GitTag: v2.11.7
  GoVersion: go1.13.15
  Compiler: gc
  Platform: linux/amd64
apiVersion: argoproj.io/v1alpha
kind: Workflow
metadata:
  generateName: argo-test-workflow-
spec:
  entrypoint: param-test
  arguments:
    parameters:

    # test parameters
    - name: STRING
      value: this is a string
    - name: INTEGER
      value: 5
    - name: FLOAT
      value: 0.2

  templates:
  - name: param-test
    container:
      image: alpine:latest
      command: [/bin/sh, -c]
      args: ["echo 'The parameter STRING is {{workflow.parameters.STRING}}.' && echo 'The parameter INTEGER is {{workflow.parameters.INTEGER}}' && echo 'The parameter FLOAT is {{workflow.parameters.FLOAT}}'"]
      env:
      - name: STRING
        value: "{{workflow.parameters.STRING}}"
      - name: INTEGER
        value: "{{workflow.parameters.INTEGER}}"
      - name: FLOAT
        value: "{{workflow.parameters.FLOAT}}"
Failed to parse workflow: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal number 0.2 into Go struct field Parameter.spec.arguments.parameters.value of type int


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

@alexec
Copy link
Contributor

alexec commented Nov 6, 2020

Floats are not allowed in parameter values. It should be a string and can be an int64.

To support 'fload64' we would need to modify Int64OrString to support floats.

Would you like to submit a PR?

@alexec
Copy link
Contributor

alexec commented Nov 6, 2020

Oh - you can quote floats.

@alexec
Copy link
Contributor

alexec commented Nov 6, 2020

    - name: FLOAT
      value: "0.2"

@alexec alexec added the solution/workaround There's a workaround, might not be great, but exists label Nov 6, 2020
@arghya88
Copy link
Contributor

arghya88 commented Nov 6, 2020

@alexec I am interested to contribute this.Please assign this to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution/workaround There's a workaround, might not be great, but exists type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants