Class KubeVirtAgent

All Implemented Interfaces:
ExtensionPoint, Describable<Node>, ModelObject, PersistenceRoot, ReconfigurableDescribable<Node>, Saveable, SearchableModelObject, SearchItem, AccessControlled, Serializable, OnMaster, org.jenkinsci.plugins.cloudstats.TrackedItem

public class KubeVirtAgent extends AbstractCloudSlave implements org.jenkinsci.plugins.cloudstats.TrackedItem
Jenkins agent running on a KubeVirt virtual machine. Implements TrackedItem for cloud-stats plugin integration.
See Also:
  • Constructor Details

    • KubeVirtAgent

      public KubeVirtAgent(String name, String cloudName, String templateName, String remoteFS, ComputerLauncher launcher, String labelString, String provisioningInfo, int idleMinutes, org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id provisioningId) throws Descriptor.FormException, IOException
      Creates a new KubeVirt agent.
      Parameters:
      name - The node name (also the VM name)
      cloudName - The name of the KubeVirt cloud that created this agent
      templateName - The name of the template used to create this agent
      remoteFS - The remote filesystem path for the agent
      launcher - The computer launcher
      labelString - Labels for this agent
      provisioningInfo - Provisioning log information
      idleMinutes - Idle timeout in minutes (0 = single-use)
      provisioningId - The cloud-stats provisioning activity ID
      Throws:
      Descriptor.FormException
      IOException
  • Method Details

    • isSingleUse

      public boolean isSingleUse()
      Returns true if this is a single-use agent (idleMinutes == 0). Single-use agents should be disposed immediately after the first build completes.
      Returns:
      true if this is a single-use agent
    • getIdleMinutes

      public int getIdleMinutes()
      Gets the configured idle minutes for this agent.
      Returns:
      The idle timeout in minutes (0 means single-use)
    • getProvisioningInfo

      public String getProvisioningInfo()
      Gets the provisioning information captured during VM creation. This is displayed in the computer log when the agent comes online.
      Returns:
      The provisioning info, or null if not available
    • setProvisioningInfo

      public void setProvisioningInfo(String provisioningInfo)
      Sets the provisioning information. Called by the KubeVirtProvisioningLauncher after provisioning completes (or fails) so the build console can display it.
      Parameters:
      provisioningInfo - The provisioning log text
    • getCloudName

      public String getCloudName()
    • getTemplateName

      public String getTemplateName()
      Gets the name of the template that was used to create this agent.
      Returns:
      The template name
    • setTerminationReason

      public void setTerminationReason(KubeVirtAgent.TerminationReason reason)
      Sets the reason for termination. Call this before calling terminate() to ensure the correct offline cause is reported.
      Parameters:
      reason - The reason for termination
    • tryMarkProvisioningFailureHandled

      public boolean tryMarkProvisioningFailureHandled()
      Claims this launch for provisioning-failure tracking.
      Returns:
      true if this is the first claim and the caller should record (or explicitly skip) the failure; false if another path already handled this launch
    • getTerminationReason

      @NonNull public KubeVirtAgent.TerminationReason getTerminationReason()
      Gets the termination reason, or infers it from the agent configuration if not explicitly set.
      Returns:
      The termination reason, never null
    • getId

      public org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id getId()
      Gets the provisioning activity ID for cloud-stats tracking. This links the agent to its provisioning activity in the cloud-stats plugin.
      Specified by:
      getId in interface org.jenkinsci.plugins.cloudstats.TrackedItem
      Returns:
      The provisioning activity ID
    • createComputer

      public AbstractCloudComputer<?> createComputer()
      Specified by:
      createComputer in class AbstractCloudSlave
    • getDescriptor

      public Slave.SlaveDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface Describable<Node>
      Overrides:
      getDescriptor in class Slave
    • _terminate

      protected void _terminate(TaskListener listener) throws IOException, InterruptedException
      Specified by:
      _terminate in class AbstractCloudSlave
      Throws:
      IOException
      InterruptedException