Class DockerOnceRetentionStrategy

  • All Implemented Interfaces:
    ExtensionPoint, Describable<RetentionStrategy<?>>, ExecutorListener

    public class DockerOnceRetentionStrategy
    extends RetentionStrategy<DockerComputer>
    implements ExecutorListener
    Retention strategy that allows our docker agents to run only a single build before disconnecting.
    • A Queue.FlyweightTask is considered "trivial" and does not trigger termination.
    • A OneOffExecutor (typically used by a Queue.FlyweightTask) is considered "trivial" and does not trigger termination.
    • A ContinuableExecutable where ContinuableExecutable.willContinue() is true does not trigger termination.
    • ...but any other workload will trigger termination once the node is idle.
    Inspired by the logic in OnceRetentionStrategy (1.34) but with the kill/don't-kill decision made when we accept a task (not when we complete it) and termination itself delayed until we've done all ongoing work.
    • Constructor Detail

      • DockerOnceRetentionStrategy

        @DataBoundConstructor
        public DockerOnceRetentionStrategy​(int idleMinutes)
        Creates the retention strategy.
        Parameters:
        idleMinutes - number of minutes of idleness after which to kill the agent; serves a backup in case the strategy fails to detect the end of a task