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

Expecting "class org.jenkinsci.plugins.vsphere.VSphereBuildStep" for parameter "buildStep" but got "[$class: 'PowerOn', timeoutInSeconds: 180, vm: 'Node01']" of type class java.lang.String instead

XMLWordPrintable

      I'm trying to start and stop virtual machines that run on my vSphere server by adding steps to my pipeline in BlueOcean. To start the VM I tried to add a step called "Invoke an vSphere action, exposing the VM IP under some actions" which has to input fields like shown in the image below:

      But when I manually enter the line "[$class: 'PowerOn', timeoutInSeconds: 180, vm: 'Node01']" I get the following error:

      Expecting "class org.jenkinsci.plugins.vsphere.VSphereBuildStep" for parameter "buildStep" but got "[$class: 'PowerOn', timeoutInSeconds: 180, vm: 'Node01']" of type class java.lang.String instead

      However when I edit my jenkinsfile with a text editor, it is working just fine. after that blue ocean lets me edit parameters in the buildstep.

      pipeline {
        agent any
        stages {
          stage('StartVM') {
            steps {
              vSphere(buildStep: [$class: 'PowerOn', timeoutInSeconds: 180, vm: 'Node01'], serverName: 'vSphere')
              echo 'Starting VM'
            }
          }
          stage('PollSVN') {
            agent {
              node {
                label 'Node01'
              }
            }
            steps {
              dir(path: 'C:\\jenkins\\') {
                bat(script: 'dir.bat', returnStatus: true)
              }
            }
          }
          stage('Build') {
            steps {
              echo 'Building'
            }
          }
          stage('StopVM') {
            steps {
              echo 'Stopping the VM'
            }
          }
        }
      }
      

            Unassigned Unassigned
            basve Bas van Etten
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: