title: Jenkins pipeline doesn't abort on PHP linter error
body: <p>I need some help with pipeline. I probably miss some trivial info here.</p>
  
  <p>So I have the following example pipeline:</p>
  
  <pre><code>pipeline {
      agent any
  
      stages {
          stage('Build') {
              steps {
                  ... some build steps (irrelevant) ...
              }
          }
          stage('Test'){
              steps {
                  sh 'find . -type f -name "*.php" -exec php56 -l {} \\;'
              }
          }
      }
      post {
          success {
              echo 'posting success to GitLab'
              updateGitlabCommitStatus(name: 'jenkins-build', state: 'success')
          }
          failure {
              echo 'posting failure to GitLab'
              updateGitlabCommitStatus(name: 'jenkins-build', state: 'failed')
          }
      }
  }
  </code></pre>
  
  <p>As a test, I intentionally created broken PHP code, and when I run the line <code>find . -type f -name "*.php" -exec php56 -l {} \\;</code> manually in my codebase, I see that it detects the error.
  Also, in the Jenkins job's console output I see the same: it detects the error.</p>
  
  <p>However, my success block is then triggered. Am I not using the success / failure block correctly?
  When I add a syntax error to the find statement itself (for example discard the <code>\\;</code> part) an error will trigger and it will result in failure as expected.</p>
  
  <p><strong>Edit (about duplicate question)</strong></p>
  
  <p>This question has been marked as a duplicate of <a href="https://stackoverflow.com/questions/14871147">another question</a>, but since the information I actually needed was about the fact when a step or sh-step fails. Because this post and answer contains relevant info for others looking for, I'll keep it like this.</p>