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

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

XMLWordPrintable

    • 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.)

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

              Created:
              Updated: