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

Host env vars take precendece over task env vars with exec/raw_exec #11202

Closed
lgfa29 opened this issue Sep 17, 2021 · 1 comment · Fixed by #11206
Closed

Host env vars take precendece over task env vars with exec/raw_exec #11202

lgfa29 opened this issue Sep 17, 2021 · 1 comment · Fixed by #11206
Assignees
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/driver/exec theme/driver/raw_exec type/bug

Comments

@lgfa29
Copy link
Contributor

lgfa29 commented Sep 17, 2021

Nomad version

Nomad v1.1.4 (acd3d7889328ad1df2895eb714e2cbe3dd9c6d82)

Operating system and Environment details

Ubuntu 20.04

Issue

When running exec or raw_exec tasks, the NOMAD_* environment variables are overwritten if they are defined in the host as well.

Reproduction steps

1 Start a Nomad agent with a NOMAD_* env var defined

$ NOMAD_ALLOC_ID=not-an-alloc nomad agent -dev
  1. Run an exec/raw_exec job that prints its own env vars
  2. Check value for NOMAD_ALLOC_ID

Expected Result

The allocation ID

Actual Result

The value set in the host (not-an-alloc)

Job file (if appropriate)

job "env" {
  datacenters = ["dc1"]

  group "env" {
    task "env" {
      driver = "exec"

      config {
        command = "/bin/bash"
        args    = ["local/script.sh"]
      }

      template {
        data = <<EOF
env | grep NOMAD
while true
do
  sleep 10
done
EOF

        destination = "local/script.sh"
      }

      resources {
        cpu    = 10
        memory = 10
      }
    }
  }
}
@lgfa29 lgfa29 added type/bug theme/driver/exec theme/driver/raw_exec stage/accepted Confirmed, and intend to work on. No timeline committment though. labels Sep 17, 2021
@lgfa29 lgfa29 added this to Needs Triage in Nomad - Community Issues Triage via automation Sep 17, 2021
@jrasell jrasell moved this from Needs Triage to In Progress in Nomad - Community Issues Triage Sep 20, 2021
@jrasell jrasell self-assigned this Sep 20, 2021
@tgross tgross removed this from In Progress in Nomad - Community Issues Triage Nov 8, 2021
@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 Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/driver/exec theme/driver/raw_exec type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants