August 17, 2012

Running Jenkins in Windows with regular user account to see executables in PATH

Went through a very irritating "feature" of Jenkins in Windows, the fact that it runs as the default system user.
From there you have to options:
- Change the system user to have the dependencies you need, or
- Use a regular account

I went with the later.

The symptom is that commands executed in the Build - Execute Windows batch command step will not be able to find executables, despite the fact that they are defined in %PATH%.

A good way to diagnose is to check that you really have the %PATH% properly set and identify who's running the command. Use these two lines:


echo %PATH%
echo %USERDOMAIN%\%USERNAME%




To solve set the properties in the Jenkins service to use the user you wan and that should marry things just nicely. There are drawbacks in using user accounts like that but it's much easier and have the expected behaviour.



15 comments:

  1. Anonymous03:26

    Thanks, this saved my ass, after one day of desperation. I don't know why the jenkins docs don't mentioned to change the user to something else SYSTEM.

    ReplyDelete
  2. You saved my life dude :)

    ReplyDelete
  3. WOW, thanks... spent many hours trying to get ruby and python working with jenkins windows... only found the solution HERE.

    ReplyDelete
  4. Can you let me know is there a way to run Jenkins tasks using Windows command line. I want to run jenkins remotely using Bamboo. Because I have both servers in our system. If I can run jenkins using command line in windows, then i can add it to bamboo script and run jenkins when i want.

    ReplyDelete
    Replies
    1. How about invoking it via HTTP?

      Delete
  5. Thanks, I spent a lot of time on this problem before finding this.

    ReplyDelete
  6. thanks a lot for sharing this information,

    ReplyDelete
  7. Thank you for sharing your findings and solutions! I spent many hours (as it looks many others have, too!) troubleshooting this issue! It all works great now!

    ReplyDelete
  8. Hi, thanks for this post :)
    Do you know how to change the user when running inside Tomcat? I did try to change the user in tomcat "configure..." but it had no effect

    ReplyDelete
    Replies
    1. No worries :) From memory, you should be able to change the users as needed in $catalina_home/conf/tomcat-users.xml

      Delete
  9. Thank you very much!! I spent a day trying to figure out this. Thanks!!

    ReplyDelete
  10. What she said, what he said: ditto. Shall we add the addendum to Jenkins doc? Windows configuration?

    Neal

    ReplyDelete
  11. Thanks man, you saved me couple of hours.

    ReplyDelete
  12. Thank you. Your post is super helpful

    ReplyDelete