argo-workflows: Default values for inputs parameters in WorkflowTemplate not working

Summary

What happened/what you expected to happen?

Previously (at least in v3.1.13), we can use default values for input parameters in a template in WorkflowTemplate. But now it’s broken in v3.2.4. Maybe It’s like this issue #2305

What version of Argo Workflows are you running? v3.2.4

Diagnostics

workflow-template

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: job-sample
spec:
  entrypoint: main
  arguments:
    parameters:
      - name: date
  templates:
    - name: main
      inputs:
        parameters:
          - name: date
            value: "{{inputs.parameters.date}}"
            default: yesterday
      container:
        image: docker/whalesay:latest
        command:
          - cowsay
        args:
          - "{{inputs.parameters.date}}"

workflow

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: yesterday-
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: day
            templateRef:
              name: job-sample
              template: main

What Kubernetes provider are you using? GKE

What executor are you running? Docker

Main container logs in v3.1.13

 ___________
< yesterday >
 -----------
    \
     \
      \
                    ##        .
              ## ## ##       ==
           ## ## ## ##      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/

Main container logs in v3.2.4

 ____________________________
< {{inputs.parameters.date}} >
 ----------------------------
    \
     \
      \
                    ##        .
              ## ## ##       ==
           ## ## ## ##      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/

Message from the maintainers:

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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 19 (8 by maintainers)

Most upvoted comments

@alexec When submitting as a Workflowtemplate and then creating a Workflow that uses that, the whole is expression is printed without any subsitution:

"


/ {{=inputs.parameters.date != nil ?
\ inputs.parameters.date : “yesterday”}} /

\
 \
  \
                ##        .
          ## ## ##       ==
       ## ## ## ##      ===
   /""""""""""""""""___/ ===
     \______ o          __/
      \    \        __/
        \____\______/"

Maybe workaround:

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: job-sample
spec:
  entrypoint: main
  arguments:
    parameters:
      - name: date
  templates:
    - name: main
      inputs:
        parameters:
          - name: date
            value: '{{=inputs.parameters.date != nil ? inputs.parameters.date : "yesterday"}}'
      container:
        image: docker/whalesay:latest
        command:
          - cowsay
        args:
          - "{{inputs.parameters.date}}"

Maybe introduced by fix: Parameter with Value and Default #6887

@yoshina9a it is a wrong way to refer the parameter

      inputs:
        parameters:
          - name: date
            value: "{{inputs.parameters.date}}" <--- it is refering itself. so controller is not able to resolve it
            default: yesterday