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

Jenkins vSphere cloud plugin does not expose guest info to pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • vsphere-cloud-plugin
    • None
    • Jenkins 2.15, vSphere 6.0.0, vSphere Plugin 2.13

      It appears that the vSphere plugin action ExposeGuestInfo is intended to expose information to the Jenkins pipeline, however that information does not appear to be accessible.

      Sample pipeline:

      Jenkinsfile.groovy
      node() {
          vSphere buildStep: [$class: 'Clone', clone: 'cloned-vm', cluster: 'cluster', powerOn: true, resourcePool: 'resource-pool', sourceName: 'template'], serverName: 'vsphere_server'
          vSphere buildStep: [$class: 'ExposeGuestInfo', envVariablePrefix: 'VSPHERE', vm: 'cloned-vm'], serverName: 'vsphere_server'
          
          def test_vm_ip = env.VSPHERE_IpAddress
          echo "Created VM with IP: ${test_vm_ip}"
      }
      

      This results in the output:

      [Pipeline] vSphere
      [vSphere] 
      [vSphere] Performing vSphere build step: "Clone VM from VM or template"
      [vSphere] Attempting to use server configuration: "vsphere_server"
      [vSphere] Creating a shallow clone of "template" to "cloned-vm"
      [vSphere] Started cloning of VM. Please wait ...
      [vSphere] "cloned-vm" successfully cloned!
      [Pipeline] vSphere
      [vSphere] 
      [vSphere] Performing vSphere build step: "Expose Guest Info"
      [vSphere] Attempting to use server configuration: "vsphere_server"
      [vSphere] Exposing guest info for VM "cloned-vm" as environment variables
      [vSphere] Added environmental variable "VSPHERE_ToolsStatus" with a value of "toolsOk"
      [vSphere] Added environmental variable "VSPHERE_ToolsVersionStatus" with a value of "guestToolsCurrent"
      [vSphere] Added environmental variable "VSPHERE_ToolsVersionStatus2" with a value of "guestToolsCurrent"
      [vSphere] Added environmental variable "VSPHERE_ToolsRunningStatus" with a value of "guestToolsRunning"
      [vSphere] Skipped "GuestFamily" as it is a null value
      [vSphere] Skipped "Net" as it is of type class [Lcom.vmware.vim25.GuestNicInfo;
      [vSphere] Skipped "IpStack" as it is of type class [Lcom.vmware.vim25.GuestStackInfo;
      [vSphere] Skipped "Screen" as it is of type class com.vmware.vim25.GuestScreenInfo
      [vSphere] Added environmental variable "VSPHERE_GuestState" with a value of "running"
      [vSphere] Added environmental variable "VSPHERE_AppHeartbeatStatus" with a value of "appStatusGray"
      [vSphere] Skipped "GuestKernelCrashed" as it is a null value
      [vSphere] Added environmental variable "VSPHERE_AppState" with a value of "none"
      [vSphere] Added environmental variable "VSPHERE_GuestOperationsReady" with a value of "true"
      [vSphere] Added environmental variable "VSPHERE_InteractiveGuestOperationsReady" with a value of "false"
      [vSphere] Added environmental variable "VSPHERE_GuestStateChangeSupported" with a value of "true"
      [vSphere] Skipped "GenerationInfo" as it is of type class [Lcom.vmware.vim25.GuestInfoNamespaceGenerationInfo;
      [vSphere] Added environmental variable "VSPHERE_GuestFullName" with a value of ""
      [vSphere] Added environmental variable "VSPHERE_ToolsVersion" with a value of "10246"
      [vSphere] Skipped "Disk" as it is of type class [Lcom.vmware.vim25.GuestDiskInfo;
      [vSphere] Added environmental variable "VSPHERE_IpAddress" with a value of "10.81.92.222"
      [vSphere] Skipped "GuestId" as it is a null value
      [vSphere] Added environmental variable "VSPHERE_HostName" with a value of ""
      [vSphere] Successfully exposed guest info for VM "cloned-vm"
      [Pipeline] echo
      Created VM with IP: null
      

      Exposing, at the very least, the IP of the VM is pretty crucial component of using vSphere VMs in a pipeline.

            Unassigned Unassigned
            sjm Scott Miller
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: