Class QueueUtils

java.lang.Object
io.jenkins.plugins.kubevirt.QueueUtils

public final class QueueUtils extends Object
Utilities for interacting with the Jenkins build queue.
  • Method Details

    • cancelWaitingItemsSatisfiedBy

      public static int cancelWaitingItemsSatisfiedBy(Set<LabelAtom> agentLabels, String reason)
      Cancels queue items whose assigned label is satisfied by the given agent labels.

      A job waiting for linux is cancelled when the agent labels include linux (for example linux kubevirt). Jobs whose expression is not satisfied (for example windows) are left in the queue.

      For Freestyle (and other Job tasks), the reason is also appended to the build console when a Run can be resolved. Pipeline node/agent waits are not Jobs; those items are cancelled only, and the reason is recorded in the Jenkins system log.

      Parameters:
      agentLabels - labels of the agent that failed to provision
      reason - a human-readable reason included in log messages
      Returns:
      the number of queue items cancelled