how to make jenkins run a python script that executes a build?

Learning Jenkins, and trying to get it to build a project for which my build script is written in python.

./build.py -i

I've tried using the 'Execute script' and 'Execute Python script'. The script first line is

#!/usr/bin/python

Jenkins doesn't complain about either attempt, it just seems to ignore the setting, declaring the build successful as soon as the code is checked out.

I've read a few old mail lists that hint that I'll have to write a bash script (build.sh) and have it call the python script. I hope that's not the answer.

Answers


You should be able to use an "Execute shell" build step and specify /path/to/build.py -i

I'm guessing that the current directory when the build job runs isn't what you're expecting. Jenkins has a built-in environment variable WORKSPACE that is set to the root of the build's workspace, so assuming that the Python script is at the root of your checked out code, $WORKSPACE/build.py should also work.


Need Your Help

How do I trace into an externally-compiled lib in Visual C++

c++ debugging visual-c++ linker tracing

I built the non-dll version of OpenSSL on my windows box. Per the instructions I modified the build script to include debug symbols. I can link against them fine and they run. But when I try to ...

@Entity with JSF, persist "hello world" with JPA

java jsf jpa ejb cdi

Oracle describes very well how to make an @Entity. However, it's not strictly clear to me how to actually add/drop tables. I also like the rose india explanation, but just want to clarify the gen...