String literal template escape not working `%%{`
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
Nomad v1.4.1 (2aa7e66bdb526e25f59883952d74dad7ea9a014e)
### Operating system and Environment details
Ubuntu 20.04
### Issue
Template escape sequence to allow putting a literal `%{` in an argument does not work.
### Reproduction steps
Run nomad agent with `sudo nomad agent -dev`
`nomad job run ` (see job file below)
Check the status of the job/allocation and see the error:
```
* failed to parse config:
* Invalid template control keyword: "test" is not a valid template control keyword.
```
#### Expected Result
Job runs successfully and echos `%{test}`
#### Actual Result
Job fails with:
```
* failed to parse config:
* Invalid template control keyword: "test" is not a valid template control keyword.
```
### Job file (if appropriate)
```
job "template-test" {
datacenters = ["dc1"]
group "processors" {
count = 1
task "echotest" {
driver = "exec"
config {
command = "/usr/bin/echo"
args = [
"%%{test}"
]
}
}
}
}
```
### Nomad Server logs (if appropriate)
```
2022-10-19T15:05:17.390-0700 [ERROR] client.alloc_runner.task_runner: running driver failed: alloc_id=117f823f-182e-5cd7-1441-708882dd5cae task=echotest
error=
| 2 errors occurred:
| \t* failed to parse config:
| \t* Invalid template control keyword: "test" is not a valid template control keyword.
|
2022-10-19T15:05:17.391-0700 [INFO] client.alloc_runner.task_runner: not restarting task: alloc_id=117f823f-182e-5cd7-1441-708882dd5cae task=echotest reason="Error was unrecoverable"
```
### Nomad Client logs (if appropriate)
N/A
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with `sudo nomad agent -dev` and the supplied job file, then trace Nomad's template parsing for the `%%{` escape in the `args` value. Done means the job runs successfully and echoes the literal `%{test}` without the invalid template control keyword error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100