Jenkins wrong exit value

12 views
Skip to first unread message

M

unread,
Nov 13, 2017, 8:18:27 AM11/13/17
to Jenkins Users
I'm using two slaves, Windows and Linux. In the first case I have cywing so I execute commands in both slaves through sh:

...
node
(label) {
sh
'''#!/bin/bash -xei
   whoami
   echo $?
   case $- in
       *i*) echo This shell is interactive ;;
       *)   echo This shell is not interactive ;;
   esac
   echo d = $?'''

}
...


I put the $? in order to understand why, sometimes, after executing the build Jenkins returns an error (script returned exit code -1) even if all the exit values are 0s. It seems to be a random error. Most of the time the build is correct, but in some cases it returns this annoyng -1 exit value without a reason.

Dirk Heinrichs

unread,
Nov 13, 2017, 8:32:45 AM11/13/17
to jenkins...@googlegroups.com
Which slave does it fail on, Linux or Windows? -1 sounds really strange because most commands on Linux return positive numbers. Do you have the console log of above script from a failing job? Since you're using "-x" we ought to see which command is failing (and since you're also using "-e", it should be the last one the script has executed).

Wonder why you're using "-i", though...

Bye...

    Dirk
--
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenTextTM Discovery | Recommind
Email: dirk.he...@recommind.com
Website: www.recommind.de

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB 10646

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

M

unread,
Nov 13, 2017, 9:04:30 AM11/13/17
to Jenkins Users
Thank you for your reply. The random error appears only in the Windows slave which uses Cygwin. In the console log I only see this when it works correctly:

test #20 completed: SUCCESS

and when it fails:

test #25 completed: FAILURE

The -i is my mistake :)
Reply all
Reply to author
Forward
0 new messages