argo lint doesn't catch syntax errors in a WorkflowTemplate

Created on 11 May 2020  路  5Comments  路  Source: argoproj/argo

Checklist:

  • [x] I've included the version.
  • [x] I've included reproduction steps.
  • [x] I've included the workflow YAML.
  • [x] I've included the logs.

What happened:
Ran argo lint on a WorkflowTemplate with syntax errors and they weren't caught. If the kind is changed to Workflow then the syntax errors are caught.
What you expected to happen:
The syntax errors to be caught.
How to reproduce it (as minimally and precisely as possible):
Call argo lint with this WorkflowTemplate. Note the purposeful misspelling of parameters

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: workflow-template-submittable
spec:
  entrypoint: whalesay-template # Fields other than "arguments" and "templates" not supported in v2.4 - v2.6
  arguments:
    parmeters:
      - name: message
        value: hello world
  templates:
    - name: whalesay-template
      inputs:
        parmeters:
          - name: message
      container:
        image: docker/whalesay
        command: [cowsay]
        args: ['{{inputs.parameters.message}}']

Anything else we need to know?:

Environment:

  • Argo version:
v2.7.7
  • Kubernetes version :
v1.14.10

Other debugging information (if applicable):

  • lint result:
argo lint test_workflow_template.yaml
WARN[0000] WorkflowTemplate is not a workflow
test_workflow_template.yaml is valid
Workflow manifests validated


Message from the maintainers:

If you are impacted by this bug please add a 馃憤 reaction to this issue! We often sort issues this way to know what to prioritize.

bug

Most helpful comment

@dan-katz As @dtaniwaki correctly pointed out, WorkflowTemplates should be linted with

$ argo template lint <FILE_NAME>

When I ran this, the lint returned an error as expected:

$ argo template lint t.yaml
ERRO[0000] t.yaml failed to parse: error unmarshaling JSON: while decoding JSON: json: unknown field "parmeters"

However, the command still exits 0 and not 1 when this is the case. Furhermore, when incorrectly linting with argo lint:

$ argo lint t.yaml
WARN[0000] WorkflowTemplate is not a workflow
t.yaml is valid
Workflow manifests validated

A warning is issued correctly, but a Workflow manifests validated message is still returned, which is incorrect since nothing was validated. I'll fix this.

All 5 comments

@dtaniwaki ?

argo workflowtemplate lint instead?

I'll own this

@dan-katz As @dtaniwaki correctly pointed out, WorkflowTemplates should be linted with

$ argo template lint <FILE_NAME>

When I ran this, the lint returned an error as expected:

$ argo template lint t.yaml
ERRO[0000] t.yaml failed to parse: error unmarshaling JSON: while decoding JSON: json: unknown field "parmeters"

However, the command still exits 0 and not 1 when this is the case. Furhermore, when incorrectly linting with argo lint:

$ argo lint t.yaml
WARN[0000] WorkflowTemplate is not a workflow
t.yaml is valid
Workflow manifests validated

A warning is issued correctly, but a Workflow manifests validated message is still returned, which is incorrect since nothing was validated. I'll fix this.

Thank you for the quick responses!

Was this page helpful?
0 / 5 - 0 ratings