Class AgentTemplate

java.lang.Object
hudson.model.AbstractDescribableImpl<AgentTemplate>
io.jenkins.plugins.namespacecloud.AgentTemplate
All Implemented Interfaces:
Describable<AgentTemplate>

public class AgentTemplate extends AbstractDescribableImpl<AgentTemplate>
A machine profile: the shape of instance to create, and how to connect to it, for jobs whose label expression matches getLabels().

The shape is declared here rather than referenced by name in Namespace. Namespace's named profiles (github.v1beta.ProfileService) exist only for GitHub Actions runners and are served from a private endpoint, so ComputeService.CreateInstance takes an explicit Compute.InstanceShape and that is what this supplies.

A job selects a profile the ordinary Jenkins way — agent { label 'ns-linux-8x16' } in a Pipeline, or "Restrict where this project can be run" in a freestyle job.

  • Constructor Details

    • AgentTemplate

      @DataBoundConstructor public AgentTemplate(String name)
  • Method Details

    • getName

      public String getName()
      Also the agent-name prefix, so nodes are traceable back to their profile.
    • getLabels

      public String getLabels()
    • setLabels

      @DataBoundSetter public void setLabels(String labels)
    • getVcpu

      public int getVcpu()
    • setVcpu

      @DataBoundSetter public void setVcpu(int vcpu)
    • getMemoryGb

      public int getMemoryGb()
    • setMemoryGb

      @DataBoundSetter public void setMemoryGb(int memoryGb)
    • getArch

      public String getArch()
    • setArch

      @DataBoundSetter public void setArch(String arch)
    • toInstanceShape

      public Compute.InstanceShape toInstanceShape()
      The shape sent to CreateInstance.

      Memory is configured in GB but the API takes megabytes, so the conversion happens here rather than at each call site.

    • getNumExecutors

      public int getNumExecutors()
    • setNumExecutors

      @DataBoundSetter public void setNumExecutors(int numExecutors)
    • getRemoteFs

      public String getRemoteFs()
    • setRemoteFs

      @DataBoundSetter public void setRemoteFs(String remoteFs)
    • getIdleMinutes

      public int getIdleMinutes()
    • setIdleMinutes

      @DataBoundSetter public void setIdleMinutes(int idleMinutes)
    • getLaunchTimeoutSeconds

      public int getLaunchTimeoutSeconds()
      How long to wait for the agent to connect before giving up and destroying the instance. Bounds the damage when an agent can never reach the controller.
    • setLaunchTimeoutSeconds

      @DataBoundSetter public void setLaunchTimeoutSeconds(int launchTimeoutSeconds)
    • getMaxLifetimeMinutes

      public int getMaxLifetimeMinutes()
    • setMaxLifetimeMinutes

      @DataBoundSetter public void setMaxLifetimeMinutes(int maxLifetimeMinutes)
    • getInstanceCap

      public int getInstanceCap()
    • setInstanceCap

      @DataBoundSetter public void setInstanceCap(int instanceCap)
    • getEnvironment

      public String getEnvironment()
    • setEnvironment

      @DataBoundSetter public void setEnvironment(String environment)
    • getCacheVolumes

      public String getCacheVolumes()
    • setCacheVolumes

      @DataBoundSetter public void setCacheVolumes(String cacheVolumes)
    • getLaunchStrategy

      @NonNull public AgentLaunchStrategy getLaunchStrategy()
    • setLaunchStrategy

      @DataBoundSetter public void setLaunchStrategy(AgentLaunchStrategy launchStrategy)
    • getEnvironmentMap

      public Map<String,String> getEnvironmentMap()
      Parses the KEY=VALUE lines from the environment textarea.
    • getCacheVolumeList

      public List<AgentTemplate.CacheVolume> getCacheVolumeList()
      Parses mountPoint:tag:sizeGb lines from the cache-volume textarea.
    • getMode

      public Node.Mode getMode()
    • matches

      public boolean matches(Label label)