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

Interpreted environment variable not working in service name #1819

Closed
zeecitizen opened this issue Oct 15, 2016 · 2 comments
Closed

Interpreted environment variable not working in service name #1819

zeecitizen opened this issue Oct 15, 2016 · 2 comments
Labels
Milestone

Comments

@zeecitizen
Copy link

Hi,

I am trying to append the ${NOMAD_ALLOC_INDEX} to the service name. I have a task with count > 1 and I need to be able to talk to the services exposed by them individually.

Trying to use ${NOMAD_ALLOC_INDEX} in the service name gives the following error:

* service[0] "service-${NOMAD_ALLOC_INDEX}" validation failed: 1 error(s) occurred:

* service name must be valid per RFC 1123 and can contain only alphanumeric characters or dashes and must be less than 63 characters long: "service-${NOMAD_ALLOC_INDEX}"

Shouldn't this interpreted environment variable be available in the service name as Alex Dadgar confirmed in the conversation given below?

Nomad version

zeeshan@zeeshan:~$ nomad version
Nomad v0.4.0

Operating system and Environment details

Ubuntu 16.04

Reproduction steps

Put ${NOMAD_ALLOC_INDEX} in service name

Here is how the Nomad job specification template looks like:

..
..
"Services": [
{
"Id": "",
"Name": "{{id}}-${NOMAD_ALLOC_INDEX}",
"Tags": [
"protocol-http"
],
..
..

Detailed Error Message

    2016/10/15 23:59:39 [DEBUG] http: Request /v1/jobs?prefix= (3.510918ms)
    2016/10/15 23:59:40 [DEBUG] http: Request /v1/jobs?prefix= (96.163µs)
    2016/10/15 23:59:41 [DEBUG] http: Request /v1/jobs?prefix= (118.761µs)
    2016/10/15 23:59:42 [DEBUG] http: Request /v1/jobs?prefix= (141.468µs)
    2016/10/15 23:59:42 [ERR] http: Request /v1/jobs, error: 1 error(s) occurred:

* Task group 1 validation failed: 1 error(s) occurred:

* Task 1 validation failed: 1 error(s) occurred:

* 1 error(s) occurred:

* service[0] "service-${NOMAD_ALLOC_INDEX}" validation failed: 1 error(s) occurred:

* service name must be valid per RFC 1123 and can contain only alphanumeric characters or dashes and must be less than 63 characters long: "service-${NOMAD_ALLOC_INDEX}"

Conversation on https://gitter.im/hashicorp-nomad/Lobby:

Christian Winther @jippi Oct 14 16:11
${NOMAD_ALLOC_INDEX} straight up doesn’t work?

...

Christian Winther @jippi Oct 14 16:13
ah, those Environment Variables can’t be used there

Frank Rosner @FRosner Oct 14 16:13
@jippi so it's not expanding the variable. Yep

...

Alex Dadgar @dadgar Oct 14 19:21
@FRosner That is a bug, it should be interpretable
Can you file an issue

@FRosner
Copy link

FRosner commented Oct 25, 2016

Thanks a lot @dadgar!

@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 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants