Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear documentation on variable interpolation #891

Closed
r0ps3c opened this issue Mar 7, 2016 · 4 comments
Closed

Unclear documentation on variable interpolation #891

r0ps3c opened this issue Mar 7, 2016 · 4 comments
Assignees
Labels
theme/docs Documentation issues and enhancements

Comments

@r0ps3c
Copy link

r0ps3c commented Mar 7, 2016

Hi,

running nomad 0.3.0, with a task using the docker driver, I have the following in the task definition:

env {
  test="${nomad.id}"
}

Yet this does not appear to be interpolated, as in the target process/task:

$ echo $test
${nomad.id}

My reading of #653 suggested this should work, so curious what I am missing?

@dadgar
Copy link
Contributor

dadgar commented Mar 7, 2016

https://www.nomadproject.io/docs/jobspec/interpreted.html

Please let us know how it can be improved. $nomad.id has changed to ${nomad.unique.id} in 0.3

@r0ps3c
Copy link
Author

r0ps3c commented Mar 7, 2016

Thanks for the updated syntax/variable name. My original testing was around interpolation of metadata values. I see now that they are handled differently than nomad variables, and additional testing has clarified that metadata variables (seem to) need to be set at the task level to be available/interpolated into the task's environment. For example:

job "example" {
...
    group "example" {
...
         task "example" {
...
                        env {
                                "TASKVAR" = "${NOMAD_META_TASKVAR}"
                                "GROUPVAR" = "${NOMAD_META_GROUPVAR}"
                                "JOBVAR" = "${NOMAD_META_JOBVAR}"
                        }
                        meta {
                                 "taskvar" = "1"
                        }

                }
                meta {
                                "groupvar" = "1"
                }

        }
        meta {
                                "jobvar" = "1"
        }
...

# echo $GROUPVAR $JOBVAR $TASKVAR
${NOMAD_META_GROUPVAR} ${NOMAD_META_JOBVAR} 1

The documentation was not clear (at least to me) on the above behavior, so perhaps if this could be made explicit it'd be helpful

@dadgar dadgar added the theme/docs Documentation issues and enhancements label Mar 10, 2016
@sethvargo sethvargo self-assigned this Oct 28, 2016
@dadgar
Copy link
Contributor

dadgar commented May 24, 2017

Going to close this as the docs have changed significantly but happily take more specific issues or PRs to clarify further!

@dadgar dadgar closed this as completed May 24, 2017
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/docs Documentation issues and enhancements
Projects
None yet
Development

No branches or pull requests

3 participants