Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48163

build marks as failure on "execute shell" exit status 0

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Not A Defect
    • buildresulttrigger, core
    • master: centos 7 + java (openjdk) 1.8.0_151 + jenkins 2.46.3 (plugins up to date as of 2017-11-19)
      slave: ubuntu 14 LTS + java (oracle) 1.8.0_151

    Description

      I have a matrix based job where some of the jobs are marked as failure even thought the shell steps exits with 0 code.

      These are the last lines of the output console when the job fails.
      {{ + exitcode=0}}
      {{ + exit 0}}
      {{ ++ '[' 1 = 1 ']'}}
      {{ ++ '[' -x /usr/bin/clear_console ']'}}
      {{ ++ /usr/bin/clear_console -q}}
      {{ Build step 'Execute shell' marked build as failure}}
      {{ Archiving artifacts}}
      {{ Sending e-mails to: xxxxx@xxxxx}}
      {{ Finished: FAILURE}}
      {{ The Execute Shell script last lines are:}}

      # if there were errors, exit code will be greater than zero.
      # and the build will fail.
      exitcode=$(wc -c stderr.out | cut -f 1 -d ' ')
      exit $exitcode

       

       

      The jobs that succeed have an output like this:
      {{ + exitcode=0}}
      {{ + exit 0}}
      {{ ++ '[' 2 = 1 ']'}}
      {{ Archiving artifacts}}
      {{ Sending e-mails to: xxxxx@xxxxx}}
      {{ Finished: SUCCESS}}
      {{  }}

       This issue occurs with no apparent reason.

       

      Attachments

        Activity

          I executed the shell scripts with #!/bin/bash -le and I guess that triggered the calling of .bash_logout and I removed that file just in case. However that doesn't explain why on some cases the variable $SHLVL was equal to 1 and on others equal to 2, that behavior triggered the clear_console execution.

          egonzalez Eduardo Gonzalez added a comment - I executed the shell scripts with #!/bin/bash -le and I guess that triggered the calling of .bash_logout and I removed that file just in case. However that doesn't explain why on some cases the variable $SHLVL was equal to 1 and on others equal to 2, that behavior triggered the clear_console execution.
          oleg_nenashev Oleg Nenashev added a comment -

          I'd guess "/usr/bin/clear_console" fails somehow. It seems to be an external bash hook (e.g. something like https://askubuntu.com/questions/364197/what-this-following-bash-script-file-do ). I think the problem is in the environment, not in Jenkins itself.

          oleg_nenashev Oleg Nenashev added a comment - I'd guess "/usr/bin/clear_console" fails somehow. It seems to be an external bash hook (e.g. something like https://askubuntu.com/questions/364197/what-this-following-bash-script-file-do ). I think the problem is in the environment, not in Jenkins itself.

          People

            gbois Gregory Boissinot
            egonzalez Eduardo Gonzalez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: