title: Jenkinsfile Pipeline errors: "expected a symbol" and "undefined section"
body: <p>Can anyone explain why I get the following errors, and what can be a possible solution for them?</p>
  
  <blockquote>
    <p>org.codehaus.groovy.control.MultipleCompilationErrorsException:
    startup failed: WorkflowScript: 20: Expected a symbol @ line 20,
    column 4.
          environment {</p>
    
    <p>WorkflowScript: 17: Undefined section "error" @ line 17, column 1.<br>
    pipeline {</p>
  </blockquote>
  
  <p>The code in the Jenkinsfile is as follows:</p>
  
  <pre><code>#!groovy
  
  def application, manifest, git, environment, artifactory, sonar
  
  fileLoader.withGit('git@&lt;reducted&gt;', 'v1', 'ssh-key-credential-id-number') {
     application = fileLoader.load('&lt;reducted&gt;');
     manifest = fileLoader.load('&lt;reducted&gt;');
     git = fileLoader.load('&lt;reducted&gt;');
     environment = fileLoader.load('&lt;reducted&gt;');
  }
  
  pipeline {
     agent { label 'cf_slave' }
  
     environment {
        def projectName = null
        def githubOrg = null
        def gitCommit = null
     }
  
     options {
        skipDefaultCheckout()
     }
  
     stages {
        stage ("Checkout SCM") {
           steps {
              checkout scm
  
              script {
                 projectName = git.getGitRepositoryName()
                 githubOrg = git.getGitOrgName()
                 gitCommit = manifest.getGitCommit()
              }
           }
        }
  
        stage ("Unit tests") {
           steps {
              sh "./node_modules/.bin/mocha --reporter mocha-junit-reporter --reporter-options mochaFile=./testResults/results.xml"
              junit allowEmptyResults: true, testResults: 'testResults/results.xml'
           }
        }
  
        //stage ("SonarQube analysis") {
        //...
        //}
  
        // stage("Simple deploy") {
        //    steps {
        //       // Login
        //       sh "cf api &lt;reducted&gt;"
        //       sh "cf login -u &lt;reducted&gt; -p &lt;....&gt;"
        //       
        //       // Deploy
        //       sh "cf push" 
        //    }
        // }
     }
  
     post {
        // always {
  
        //  }
        success {
           sh "echo 'Pipeline reached the finish line!'"
  
           // Notify in Slack
           slackSend color: 'yellow', message: "Pipeline operation completed successfully. Check &lt;reducted&gt;"
        }
        failure {
           sh "echo 'Pipeline failed'"
           // Notify in Slack
           slackSend color: 'red', message: "Pipeline operation failed!"
  
           //Clean the execution workspace
           //deleteDir()
        }
        unstable {
           sh "echo 'Pipeline unstable :-('"
        }
        // changed {
        //    sh "echo 'Pipeline was previously failing but is now successful.'"
        // }
     }
  }
  </code></pre>