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

Ctrl+S in Pipeline Editor shows validation errors from Generic Build Step with $class

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • Blue Ocean - Candidates

      Jenkinsfile runs step([$class: 'XUnitPublisher', …]) using the syntax from Snippet Generator. Jenkins parses and runs the step OK. The Blue Ocean pipeline editor also loads Jenkinsfile and displays the step as "General Build Step", but if I press Ctrl+S (described in JENKINS-42649), I get an empty text box and these errors:

      • There were validation errors, please check the editor to correct them
      • pipeline/stages/0/branches/0/steps/0/arguments/0/value: Expecting "interface jenkins.tasks.SimpleBuildStep" but got "[$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 1, thresholds: [ [$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: ''], [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']], tools: [ [$class: 'MSTestJunitHudsonTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: 'TestResults.trx', skipNoTestFiles: true, stopProcessingIfError: true]]]" of type class java.lang.String instead

      I expected it to roundtrip the parameters of the step, perhaps with loss of formatting.

      A simple Jenkinsfile for reproducing the error:

      pipeline {
          agent any
          stages {
              stage('Test') {
                  steps {
                      step([$class: 'XUnitPublisher',
                          testTimeMargin: '3000',
                          thresholdMode: 1,
                          thresholds: [
                              [$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: ''],
                              [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']],
                          tools: [
                              [$class: 'MSTestJunitHudsonTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: 'TestResults.trx', skipNoTestFiles: true, stopProcessingIfError: true]]])
                  }
              }
          }
      }
      

      (This Jenkinsfile contains no step that creates TestResults.trx, but the job succeeds anyhow, due to skipNoTestFiles. This is an extract from a larger Jenkinsfile that also runs the tests.)

          [JENKINS-47245] Ctrl+S in Pipeline Editor shows validation errors from Generic Build Step with $class

          Kalle Niemitalo created issue -
          James Dumay made changes -
          Epic Link New: JENKINS-36291 [ 172300 ]
          James Dumay made changes -
          Sprint New: Blue Ocean 1.4 - candidates [ 326 ]
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          James Dumay made changes -
          Rank New: Ranked higher
          James Dumay made changes -
          Sprint Original: Blue Ocean 1.4 - candidates [ 326 ] New: Blue Ocean 1.4 - beta 2 [ 416 ]
          James Dumay made changes -
          Rank New: Ranked higher
          James Dumay made changes -
          Sprint Original: Blue Ocean 1.4 - beta 3 [ 416 ] New: Blue Ocean 1.4 - beta 4 [ 441 ]
          Kalle Niemitalo made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Karl Shultz made changes -
          Labels New: testing-notes-not-applicable
          Sid S made changes -
          Resolution Original: Cannot Reproduce [ 5 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Sid S made changes -
          Comment [ This is still an issue except it's 

          Expecting "interface jenkins.tasks.SimpleBuildStep" but got "[$class: 'NUnitPublisher', testResultsPattern: 'results-all/sub.domain.com/*.xml', debug: false, keepJUnitReports: true, skipJUnitArchiver:false, failIfNoResults: true]" of type class java.lang.String instead
           
          Blue Ocean v1.5.0
          Pipeline: Model API v1.2.9 ]

            Unassigned Unassigned
            kon Kalle Niemitalo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: