Strider-CD / strider-node

Run Node.js tests in strider
11 stars 13 forks source link

Issue With PATH Ordering #36

Open andrewburgess opened 8 years ago

andrewburgess commented 8 years ago

I'm not sure if I've misconfigured something, but the PATH environment variable seems to be putting /usr/bin in the middle, before the N_PREFIX directory, which means the system level version of node is used instead of the one just downloaded via n

Output of $PATH after n activates the version requested

/home/strider/builds/data/${project-branch}/node_modules/.bin
/home/strider/builds/data/node_modules/.bin
/home/strider/builds/node_modules/.bin
/home/strider/node_modules/.bin
/home/node_modules/.bin
/node_modules/.bin
/usr/bin
/home/strider/app/node_modules/strider-node/node_modules/n/bin
/home/strider/builds/data/${project-branch}/.n/bin
/home/strider/app/node_modules/strider-node/node_modules/.bin
/home/strider/builds/data/${project-branch}/${job-id}.globals/node_modules/.bin

/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin

I'm not sure where that /usr/bin comes from in the middle, but I'm wondering if maybe https://github.com/Strider-CD/strider-node/blob/master/worker.js#L82 needs to be flipped so that the new paths are prepended to ret.path instead of appended.

knownasilya commented 8 years ago

Sounds like something you can submit as a PR and test it with your setup to see if it makes a difference 👍

andrewburgess commented 8 years ago

@knownasilya I've tried switching it in my local instance and I'm not seeing a change in the PATH environment variable.

I'm not familiar with how Strider is architected. Where is the PATH environment variable set up? Trying to make that switch didn't seem to show any difference in the PATH contents, nor did trying to set ret.env.PATH.

andrewburgess commented 8 years ago

Running a few more experiments, it looks like ret.path is appended to a PATH variable somewhere else in Strider (as in, all of those .bin directories and the /usr/bin are set elsewhere and then the additions from this plugin are appended afterwards).

Any ideas as to where I might be able to look?

knownasilya commented 8 years ago

Here's one place https://github.com/Strider-CD/strider-runner-core/blob/master/lib/job.js#L312