You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that variable interpolation (using either node attributes or runtime environment variables) does not work in the meta stanza. I'm not sure whether this is an intended feature or not, but the documentation does suggest variable interpolation should work in the meta stanza.
Moving the meta stanza under the task stanza still results in the same output.
Reproduction steps
Run the sample job
Perform a docker inspect on the running container to see env variable output
Job file
job"meta-stanza-test-job" {
type="service"datacenters=["dc1"]
meta {
TEST_NUMBER=1TEST_STRING="string"# Interpolation here fails for both node attributes (e.g. ${node.datacenter}) and runtime environment variablesTEST_INTERPOLATION="${NOMAD_DC}-${NOMAD_JOB_NAME}"
}
group"meta-stanza-test-group" {
task"meta-stanza-test-task" {
env {
TEST_NUMBER="${NOMAD_META_TEST_NUMBER}"TEST_STRING="${NOMAD_META_TEST_STRING}"TEST_INTERPOLATION="${NOMAD_META_TEST_INTERPOLATION}"ENV_TEST_INTERPOLATION="${NOMAD_DC}-${NOMAD_JOB_NAME}"
}
driver="docker"config {
image="registry:latest"port_map {
http=5000
}
}
resources {
cpu=500memory=512network {
mbits=25port"http" {
}
}
}
}
}
}
@langmartin verified, just saw this in 0.10.0. I'm confused by your comment, are you saying this is intended behaviors, or are you confirming the issue?
The problem we're seeing is trying to interpret node meta into consul service tags defined in the service stanza. This worked fine in Consul 0.9.6 and earlier. Given this worked before, this should be marked as regression.
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Nomad version
Nomad v0.10.0-rc1 (c49bf41)
Operating system and Environment details
Distribution: Ubuntu Xenial 16.04.6
Kernel Version: Linux 4.4.0-165-generic x86_64
Docker Version: 19.03.3, build a872fc2
Issue
It appears that variable interpolation (using either node attributes or runtime environment variables) does not work in the meta stanza. I'm not sure whether this is an intended feature or not, but the documentation does suggest variable interpolation should work in the meta stanza.
Moving the meta stanza under the task stanza still results in the same output.
Reproduction steps
docker inspect
on the running container to see env variable outputJob file
Job output
Running
docker inspect <container_id>
gives:"Env": [
"ENV_TEST_INTERPOLATION=dc1-meta-stanza-test-job",
"NOMAD_ADDR_http=172.16.1.10:31850",
"NOMAD_ALLOC_DIR=/alloc",
"NOMAD_ALLOC_ID=9f4e46c2-a707-e96b-dd44-f7440111d984",
"NOMAD_ALLOC_INDEX=0",
"NOMAD_ALLOC_NAME=meta-stanza-test-job.meta-stanza-test-group[0]",
"NOMAD_CPU_LIMIT=500",
"NOMAD_DC=dc1",
"NOMAD_GROUP_NAME=meta-stanza-test-group",
"NOMAD_HOST_PORT_http=31850",
"NOMAD_IP_http=172.16.1.10",
"NOMAD_JOB_NAME=meta-stanza-test-job",
"NOMAD_MEMORY_LIMIT=512",
"NOMAD_META_TEST_INTERPOLATION=${NOMAD_DC}-${NOMAD_JOB_NAME}",
"NOMAD_META_TEST_NUMBER=1",
"NOMAD_META_TEST_STRING=string",
"NOMAD_NAMESPACE=default",
"NOMAD_PORT_http=5000",
"NOMAD_REGION=global",
"NOMAD_SECRETS_DIR=/secrets",
"NOMAD_TASK_DIR=/local",
"NOMAD_TASK_NAME=meta-stanza-test-task",
"TEST_INTERPOLATION=${NOMAD_DC}-${NOMAD_JOB_NAME}",
"TEST_NUMBER=1",
"TEST_STRING=string",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
The text was updated successfully, but these errors were encountered: