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
String interpolation with function call not working for meta properties.
I have two places in my .hcl file where I am using the substr function to grab the short version of my commit hash, which is used to tag my docker image. In the meta stanza, the string is not interpolated, and as show as-is in the UI (see the screenshot). In the task/config stanza, it works fine.
Job file
job "my-job" {
meta {
image_tag = "${substr("[[ .DEPLOY_SUB___VERSION ]]", 0, 7)}" # This doesn't work, and is show in the UI as-is
}
group "my-group" {
task "my-task" {
config {
image = "uri.for.my.image:${substr("[[ .DEPLOY_SUB___VERSION ]]", 0, 7)}" # This works
}
}
}
# ...
}
This is what is presented in the UI:
I also tried doing the following, but it was invalid hcl:
@TylerPachal the HCL2 functions like substr are only available in Nomad 1.0 and above, so Nomad is trying that as a plain old string. Even for Nomad 1.0 the syntax needs to be a little different because of a bug in quote-escaping (ref #9838), but this job works:
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
0.12.9
Issue
String interpolation with function call not working for
meta
properties.I have two places in my
.hcl
file where I am using thesubstr
function to grab the short version of my commit hash, which is used to tag my docker image. In themeta
stanza, the string is not interpolated, and as show as-is in the UI (see the screenshot). In thetask/config
stanza, it works fine.Job file
This is what is presented in the UI:
I also tried doing the following, but it was invalid
hcl
:Edit: We are using Levant to do the replacement of
DEPLOY_SUB___VERSION
.The text was updated successfully, but these errors were encountered: