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

Plugin doesn't run with Pipeline: Basic steps >=2.20

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • robot-plugin
    • None
    • Robot Framework plugin 2.1.1
      Pipeline: Basic Steps 2.20 & 2.21
      Jenkins 2.235.5 & 2.251

      If a previous stage aborted/failed and a next stage is run due to a when clause, and this stage has post block with a call for Robot Framework plugin, the plugin will not run. Any other steps inside the post block will run normally.

      Example pipeline

       

      //pipeline1
      pipeline {
          agent any 
          options { timeout(time:10, unit:"SECONDS") }
          stages {
              stage("My Stage") {
                  steps {
                      sleep 20
                  }
              }
          }
      }

       

      //pipeline2
      CONDITION = true
      pipeline {
          agent any
          stages {
              stage("Downstream") {
                  steps {
                      catchError(buildResult: "UNSTABLE", stageResult: "FAILURE") {
                          build "pipeline1"
                      }
                  }
              }
              stage("Run Robot") {
                  when { expression { CONDITION == true }}
                  steps {
                      sh 'echo "*** Test cases ***" > myTests.robot'
                      sh 'echo "My Test" >> myTests.robot'
                      sh 'echo "    Log to console    hello world" >> myTests.robot'
                      sh "robot --nostatusrc myTests.robot"
                  }
                  post {
                      always {
                          echo "Reached post steps"
                          robot(outputPath: '.',
                                passThreshold: 80.0,
                                unstableThreshold: 70.0)
                          echo "Robot should've run by now."
                      }
                  }
              }
          }
      }

       Here is the full Jenkins pipeline output

      [Pipeline] stage
      [Pipeline] { (Downstream)
      [Pipeline] catchError 
      [Pipeline] { [Pipeline] build (Building JENKINS-63746 » pipeline1) Scheduling project: JENKINS-63746 » pipeline1 Starting building: JENKINS-63746 » pipeline1 #3 
      [Pipeline] } JENKINS-63746 » pipeline1 #3 completed with status ABORTED (propagate: false to ignore) 
      [Pipeline] // catchError [Pipeline] }
      [Pipeline] // stage [Pipeline] stage 
      [Pipeline] { (Run Robot) 
      [Pipeline] sh + echo *** Test cases *** 
      [Pipeline] sh + echo My Test 
      [Pipeline] sh + echo Log to console hello world 
      [Pipeline] sh + robot --nostatusrc myTests.robot 
      ============================================================================== 
      myTests 
      ==============================================================================
       My Test hello world 
      | PASS | 
      ------------------------------------------------------------------------------ 
      myTests | PASS | 
      1 critical test, 1 passed, 0 failed 
      1 test total, 1 passed, 0 failed ============================================================================== 
      Output: /home/jenkins/workspace/JENKINS-63746/pipeline2/output.xml 
      Log: /home/jenkins/workspace/JENKINS-63746/pipeline2/log.html 
      Report: /home/jenkins/workspace/JENKINS-63746/pipeline2/report.html 
      Post stage 
      [Pipeline] echo Reached post steps 
      [Pipeline] robot 
      [Pipeline] echo Robot should've run by now. 
      [Pipeline] } 
      [Pipeline] // stage 
      [Pipeline] } 
      [Pipeline] // node 
      [Pipeline] End of Pipeline
      

       

            aleksisimell Aleksi Simell
            aleksisimell Aleksi Simell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: