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.
In the Python ecosystem there are tools which can be integrated into Jenkins for testing/reporting such as: nose2 and pytest for executing unit tests and generating JUnit-compatible XML test reports and Cobertura-compatible code coverage reports.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With