hashicorp / hashicorp/nomad

Allow cascading/Inheritance for env {}

Open
#2,811 1 comment 7 reactions 0 assignees View on GitHub
theme/jobspec type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

Similar to `update` stanza in #2806 - it would be nice if an env{) stanza could be put in

- `job -> env`
- `job -> group -> env`
- `job -> group -> task -> env`

When an allocation is created the final env will be the result of:

- `job -> env `
- merged with `job -> group -> env`
- merged with `job -> group -> task -> env`

The most specific env (closer to the task) will always "win" in the merge.

```hcl
job "example" {

env {
FOO = "bar"
BAR = "baz"
BAZ = "qux"
}

group "sample" {
env {
FOO = "groupBar"
BAR = "groupBaz"
}

task "demo1" {
env {
FOO = "taskBar"
# FOO will be taskBAR
# BAR will be groupBaz
# BAZ will be qux
}
}

task "demo2" {
env {
# FOO will be groupBar
# BAR will be groupBaz
# BAZ will be qux
}
}
}
}
```

Similar would be great for `template{}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.