I am trying to run Windows Service on Windows 2019 Core machine and it looks like it doesn’t have access to environment variables.
My environment variables are set correctly coming from my consul kv store. I ran following and verified that it is set correctly:
config {
command = "powershell"
args = ["gci env: | oss"]
}
Here is my job specification where executable is expecting to read environment variable set by my template and looks like it doesn’t have access to it… I would like to know if Nomad spuns off another process which doesn’t get passed environment variables from the parent process?
job "email-handler-service-win" {
datacenters = ["dc1"]
node_pool = "windows-2019"
type = "batch"
group "email-service" {
constraint {
attribute = "${meta.node_name}"
value = "cord21"
}
task "run-exe" {
template {
destination = "${NOMAD_SECRETS_DIR}/envs.txt"
env = true
data = <<EOH
{{range ls "arch_team" }}
{{ .Key }}={{ .Value }}
{{ end }}
EOH
}
driver = "raw_exec"
artifact {
source = "https://myrepo/EmailHandlerService_winx64.zip"
destination = "local"
}
config {
command = "./local/EmailHandlerService_winx64/EmailHandler.Service.exe"
}
}
}
}
Thanks a lot…