Jenkins with pylint gives build failure

后端 未结 8 1143
天命终不由人
天命终不由人 2021-01-04 12:25

I added a build step to execute a Python script.
In this script pylint is called with the lint.Run(..args) to check the code.
The script works but in the end, the bu

8条回答
  •  既然无缘
    2021-01-04 13:01

    Pylint has the unpleasant behavior to return a non-zero exit code even only if a small warning issue was found. Only when everything was fine, 0 is returned (see man page).

    As usually a non-zero code denotes an error, Jenkins fails the build.

    I see two ways to overcome this:

    • Use a small script around pylint that always returns 0. Then jenkins will not fail because of pylint. I use a small python script calling pylint with os.system() and sys.exit(0) after than. You can see it as overriding the error code of pylint.
    • Patch pylint. For example, on my Linux system the sys.exit() call is in the file /usr/lib/pymodules/python2.6/pylint/lint.py

提交回复
热议问题