Skip to content
Advertisement

Jenkins build failing without updating Xray with the failed status

Please forgive me if this is not the place to ask this question. I’m running python scripts in a Jenkins pipeline from a Jenkinsfile. I am also updating Jira Xray tickets within the Jenkisfile. Behave is being used to validate the test status. If the check fails then the Jenkins build fails without getting the Xray ticket updated with the failure. I’ve attempted to use “try” to capture the failure but have not succeeded in getting the failure to propagate to the Xray ticket.

Would anyone here know where I might find an answer? I would be in your dept.

Jenkinsfile

JavaScript

feature file

JavaScript

step file

JavaScript

The suggestion of using || /usr/bin/true appears to have worked for the above mentioned code. Now I have a second instance where my Python test is throwing an exception when the DUT fails DHCP bind

JavaScript

I attempted to add the same after the Python script but the Jenkins build fails without the Xray test getting updated with a failure.

Here is what this looks like in the Jenkinsfile

JavaScript

Advertisement

Answer

Your case should be easy to fix. Behave utility returns exit code 1 if tests fails..

Just add this to the end of your behave command || /usr/bin/true (please make sure of the path of the “true” command). This will make your command to always return true even if some problems exist with behave.

So your overall command should be something like:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement