argoproj / argoproj/argo-workflows

Variable `workflow.parameters` does not work

Open
#10,883 3 comments 0 reactions 0 assignees View on GitHub
area/templating P3 solution/workaround
Dominant language
Go
Stars
17k
Forks
3.7k
Avg merge
1d 15h
Merged PRs (30d)
138

Description

### Pre-requisites

- [X] I have double-checked my configuration
- [X] I can confirm the issues exists when I tested with `:latest`
- [ ] I'd like to contribute the fix myself (see [contributing guide](https://github.com/argoproj/argo-workflows/blob/master/docs/CONTRIBUTING.md))

### What happened/what you expected to happen?

Expect to see all the parameters get printed out in the container but got this error instead:

```
error in entry template execution: invalid character 'n' after object key:value pair
```

Other parameters as well as `workflow.parameters.message` seem to work correctly:

```
'{{`{{workflow.name}}`}}' -- works
'{{workflow.name}}' -- works
'{{workflow.parameters.message}}' -- works

'{{workflow.parameters}}' -- doesn't work
'{{`{{workflow.parameters}}`}}' -- doesn't work
'{{workflow.parameters.json}}' -- doesn't work
```

### Version

latest

### Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

```YAML
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: test-payload
spec:
serviceAccountName: argo
arguments:
parameters:
- name: message
value: hello argo
- name: message2
value: '{{workflow.parameters}}'
entrypoint: argosay
templates:
- name: argosay
inputs:
parameters:
- name: message2
value: '{{workflow.parameters.message2}}'
container:
name: main
image: argoproj/argosay:v2
command:
- /argosay
args:
- echo
- '{{inputs.parameters.message2}}'
```

### Logs from the workflow controller

```text
kubectl logs -n argo deploy/workflow-controller | grep ${workflow}
```

### Logs from in your workflow's wait container

```text
kubectl logs -n argo -c wait -l workflows.argoproj.io/workflow=${workflow},workflow.argoproj.io/phase!=Succeeded
```

Contributor guide

Open the contributing guide

Research direction

Start by running the small workflow in the issue, using the `entrypoint: argosay` template and the controller and wait-container log commands shown. Compare the working `workflow.parameters.message` substitution with the failing whole-parameter substitutions. Done means the workflow completes without the object-parsing error and prints all parameters in the container.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.