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

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Environment:
    • Sprint:
      Blue Ocean - Candidates
    • Similar Issues:

      Description

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

        Attachments

          Activity

          Hide
          kon Kalle Niemitalo added a comment -

          I wonder if this is a duplicate of JENKINS-44451. Both are type-conversion errors due to the $class syntax. The target types are different, though: a class there and an interface here.

          Show
          kon Kalle Niemitalo added a comment - I wonder if this is a duplicate of JENKINS-44451 . Both are type-conversion errors due to the $class syntax. The target types are different, though: a class there and an interface here.
          Hide
          kon Kalle Niemitalo added a comment -

          I can no longer reproduce this, after installing Blue Ocean 1.3.2 and Pipeline: Model API 1.2.4.

          Show
          kon Kalle Niemitalo added a comment - I can no longer reproduce this, after installing Blue Ocean 1.3.2 and Pipeline: Model API 1.2.4.
          Hide
          sid_s Sid S added a comment - - edited

          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

          Jenkins 2.124
          Blue Ocean v1.5.0
          Pipeline: Model API v1.2.9
          Chrome v66 x64

          Show
          sid_s Sid S added a comment - - edited 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 Jenkins 2.124 Blue Ocean v1.5.0 Pipeline: Model API v1.2.9 Chrome v66 x64

            People

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

              Dates

              • Created:
                Updated: