Class AgentLaunchStrategy

java.lang.Object
hudson.model.AbstractDescribableImpl<AgentLaunchStrategy>
io.jenkins.plugins.namespacecloud.launcher.AgentLaunchStrategy
All Implemented Interfaces:
ExtensionPoint, Describable<AgentLaunchStrategy>
Direct Known Subclasses:
InboundLaunchStrategy, SshLaunchStrategy

public abstract class AgentLaunchStrategy extends AbstractDescribableImpl<AgentLaunchStrategy> implements ExtensionPoint
How a provisioned Namespace instance is connected back to Jenkins.

Two directions are possible and they need opposite network paths, which is why this is a strategy rather than a flag:

  • InboundLaunchStrategy — the instance dials out to the controller over HTTP(S)/WebSocket. Needs no inbound firewall rule.
  • SshLaunchStrategy — the controller dials in to the instance. Needs egress from Jenkins to Namespace's ingress.
  • Constructor Details

    • AgentLaunchStrategy

      public AgentLaunchStrategy()
  • Method Details

    • configureInstance

      public abstract void configureInstance(@NonNull Compute.CreateInstanceRequest.Builder builder, @NonNull LaunchContext ctx) throws IOException
      Contributes to the instance request before it is sent — typically the container that will host the agent, plus any credentials it needs.
      Throws:
      IOException - if the request cannot be completed, for instance because a configured credential is missing or unreadable. Failing here is preferable to provisioning an instance the controller would then be unable to connect to.
    • createLauncher

      @NonNull public abstract ComputerLauncher createLauncher(@NonNull NamespaceClient client, @NonNull Compute.InstanceMetadata instance, @NonNull LaunchContext ctx) throws IOException, InterruptedException
      Builds the Jenkins-side launcher. Called once the instance is RUNNING, so implementations may query the instance for connection details.
      Throws:
      IOException
      InterruptedException
    • requiresNodeRegisteredFirst

      public boolean requiresNodeRegisteredFirst()
      Whether the Jenkins node must be registered before the instance is created. True for inbound: the agent connects on its own and the controller rejects a connection from a node it does not know about yet.
    • requiresSshGrants

      public boolean requiresSshGrants()
      Whether this strategy needs the instance:ssh and ingress:access grants.
    • getDescriptor

      public Descriptor<AgentLaunchStrategy> getDescriptor()
      Specified by:
      getDescriptor in interface Describable<AgentLaunchStrategy>