Search code examples
jenkinskillyandex-tank

Jenkins and kill command in the script makes builds failed


Due some problems with the hanging of a python process (yandex-tank) during the build process in Jenkins (after which the build could not stop) i need to stop this problematic process with some additional kill command with timeout or using timeout command itself:

timeout $TIMEOUT yandex-tank-jmeter -i -o "jmeter.jmx=$WORKSPACE/$TEST_PLAN"

timeout sends default (15) kill signal, but after that the build goes to status FAILED.

Is there any workaround or special kill signal to make builds successful ?


Solution

  • Have you tried manual exit code overriding?

    timeout $TIMEOUT yandex-tank-jmeter -i -o "jmeter.jmx=$WORKSPACE/$TEST_PLAN"; RES=$?
    //If  the  command timed out, then RES equals 124.
    ...
    //at the end of job scenario:
    if [ $RES -eq 124 ]; then RES=0;
    fi
    exit $RES