Hudson/Jenkins $WORKSPACE variable not working on node

izar picture izar · Aug 17, 2012 · Viewed 13.1k times · Source

So I have a version.txt file in my Source Control. I check it out on master and build, and have the Set Environment Variables through a file with the File Path being $WORKSPACE/Version.txt

On the master it correctly finds the Version.txt and sets MAJOR=x etc..

When I do the same build on a slave node, with the same configuration I always get a

[envfile] Reading environment variables from file.
[envfile] Path to file: /var/hudson/workspace/DEV_BUILD/Version.txt
[envfile] Can not find environment file. Path to file=[/var/hudson/workspace/DEV_BUILD/Version.txt]

but I see earlier that:

Building remotely on cent5.5_64
Cleaning the workspace because project is configured to clean the workspace before each build.
server: 192.168.1.207
[UGCS_DEV_BUILD] $ sscm get / -wreplace  -d/var/hudson/workspace/DEV_BUILD -r

get from main/DEV:

/var/hudson/workspace/DEV_BUILD/Version.txt

I am guessing $WORKSPACE refers to the master? Anyone have any ideas how to get this to work on a Slave?

Answer

Y__ picture Y__ · Aug 20, 2012

It seems that the EnvFile plugin isn't working with slaves : https://issues.jenkins-ci.org/browse/JENKINS-9546

Moreover from the comments in this JIRA, they suggest to use the EnvInject plugin : https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Regards,