argo-workflows: Linter failing on TemplateRef for WorkflowTemplate
Summary
I got a “template reference not found” when using the linter on the following example. I was expecting a valid workflowTemplate, so I suspect an error in the linter.
Diagnostics
What Kubernetes provider are you using? Version 1.16.15 Self Hosted
What version of Argo Workflows are you running? 2.12.9
Example
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate # used to be Workflow
metadata:
generateName: workflow-template-hello-world-
spec:
entrypoint: whalesay
templates:
- name: whalesay
steps: # You should only reference external "templates" in a "steps" or "dag" "template".
- - name: call-whalesay-template
templateRef: # You can reference a "template" from another "WorkflowTemplate" using this field
name: workflow-template-1 # This is the name of the "WorkflowTemplate" CRD that contains the "template" you want
template: whalesay-template # This is the name of the "template" you want to reference
arguments: # You can pass in arguments as normal
parameters:
- name: message
value: "hello world"
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: workflow-template-1
spec:
entrypoint: whalesay-template # Fields other than "arguments" and "templates" not supported in v2.4 - v2.6
arguments:
parameters:
- name: message
value: hello world
templates:
- name: whalesay-template
inputs:
parameters:
- name: message
container:
image: docker/whalesay
command: [cowsay]
args: ["{{inputs.parameters.message}}"]
Result in the command line :
λ argo-windows-amd64-2.12.9.exe -v
time="2021-02-23T15:16:34.878Z" level=debug msg="CLI version" version="{v2.12.9 2021-02-16T22:46:55Z 737905345d70ba1ebd566ce1230e4f971993dfd0 v2.12.9 clean go1.13 gc windows/amd64}"
λ argo-windows-amd64-2.12.9.exe template lint ref-example.yaml
time="2021-02-23T15:40:54.449Z" level=error msg="templates.whalesay.steps[0].call-whalesay-template template reference workflow-template-1.whalesay-template not found"
time="2021-02-23T15:40:54.492Z" level=fatal msg="Errors encountered in validation"
Notes :
- This was originally a dicussion
- I transformed one of the official example from kind Workflow to kind : WorkflowTemplate (Should be correct according to Workflow template Spec)
- I checked the discussions around “templateRef” and from my understanding the use cas inside a step is still valid.
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 16
- Comments: 18 (8 by maintainers)
I’m running into the same issue but the workaround of combining them into one yaml in dependency order doesn’t work for me. In this case, they are all
kind: WorkflowTemplate
. It still attempts to connect to kubernetes to retrieve the other templates.broken argo lint makes troubleshooting argo workflows really really hard for us. It is like looking for needle in haystack. Would it be possible to bump up the priority? Thanks
@sarabala1979 I’ve found the opposite. If I glue the scripts into a single file in an appropriate order it works ok [workaround], but if you split the files it never works because the templates are never defined. I image if I were to do it like so:
It would work - but that complicates our CI!
@tvalasek as an ugly workaround, we rename all our templates to start with
_
and then do the following:I’m not proud!