Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Jenkins to trigger and manage a series of import jobs. I want to put my import script in Github, and when Jenkins builds the job, it should (a) pull that version controlled script out of Github and (b) run the script.

The problem that I am running into is that I don't know how to reference the name of the script to run within the job. I'm assuming that source code is pulled into the workspace directory. Is that assumption correct? (If only there was documentation!)

Here's what I've done so far:

  1. Installed Jenkins (obviously) on my Windows Server (no, I didn't have a choice about that)
  2. Created a repository on my github account and put my code in it
    • It's public at
    • You'll see I have two scripts, and omniture-video\ The code there is under patent by Apple, I'm sure :)
    • The idea is that I would want to run
  3. Installed the Github plugin
  4. Created a job as follows:
  5. Manually execute the job

What I get, however, is an error message that the file cannot be located. This is strange, because I assume the workflow would be "pull a local copy of source to the ...(Job)/workspace/ directory, then run the batch command in the context of the workspace directory.

Here's the full console output:

Started by user anonymous Building in workspace C:\Program Files (x86)\Jenkins\jobs\Testing Github Integration\workspace [workspace] $ cmd /c call C:\Windows\TEMP\hudson1966342425043540895.bat

C:\Program Files (x86)\Jenkins\jobs\Testing Github Integration\workspace>python python: can't open file '': [Errno 2] No such file or directory

C:\Program Files (x86)\Jenkins\jobs\Testing Github Integration\workspace>exit 2 Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE

Obviously I was expecting to just see the results of my print statement in the console.

What did I mess up? And why isn't my script already there?

share|improve this question
Lets see the code from C:\Windows\TEMP\hudson1966342425043540895.bat are you using git pull? – user160910 Aug 13 '13 at 17:25
Jenkins automatically creates then deletes it. You can see the full contents in the console output, however - it's the "python" command I referenced above – Affable Geek Aug 13 '13 at 17:34 is not in your path. Do you see the file in the workspace directory or is that automatically deleted as well? When you run git pull you need to be in the local copy of the cloned repository I believe, it should then pull any new changes into the local repo. It is hard to help you when I cannot see any of the actual commands being run. – user160910 Aug 13 '13 at 17:40
Did you follow these instructions for the github plugin ? Did you set the GIT_HOME environmental variable etc? – user160910 Aug 13 '13 at 17:44
D'oh! One more reason to hate windows. Thank you - I think that may be the issue – Affable Geek Aug 13 '13 at 17:46

For my build (on a Linux host), I do something like this (as a build step in Jenkins) to execute a build script out of the freshly-checked-out workspace:

Execute shell Command:

 sh -x $WORKSPACE/build/

I presume it would work similar on Windows, except of course you would use \ rather than / and you're using python rather than sh to execute your script.

share|improve this answer

You could store some script in Git, e.g.

 echo 'test'

Then in "Execute shell" input, put import of that script and call "_test_func":



 + source
 + _test_func
share|improve this answer

You can write two lines in your build:

chmod 777 ./
share|improve this answer
World write permissions may not be the best idea! Why not 755 (owner write, everyone else read/execute. – kmarsh Oct 30 '15 at 14:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.