Package eu.royalsloth.depbuilder.jenkins
Class AssignToNode
- java.lang.Object
-
- hudson.model.InvisibleAction
-
- eu.royalsloth.depbuilder.jenkins.AssignToNode
-
- All Implemented Interfaces:
Action
,LabelAssignmentAction
,ModelObject
,Queue.QueueAction
- Direct Known Subclasses:
AssignToNode.AssignAnyNode
public class AssignToNode extends InvisibleAction implements LabelAssignmentAction, Queue.QueueAction
Helper class that is assigning builds to nodes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AssignToNode.AssignAnyNode
-
Constructor Summary
Constructors Constructor Description AssignToNode(Node node)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
allJobsShouldHaveOnlineAgent(ParsedBuild build)
Checks if all jobs from the build have online build agent or throws an exception if one node has all build agents offline.static AssignToNode
createAction(List<BuildAgent> allPossibleBuildAgents)
static Node
findJenkinsAgent(List<BuildAgent> allPossibleBuildAgents, List<Node> buildNodes)
Find appropriate jenkins agent node, based on the needs of the build job.Label
getAssignedLabel(SubTask task)
boolean
shouldSchedule(List<Action> actions)
-
Methods inherited from class hudson.model.InvisibleAction
getDisplayName, getIconFileName, getUrlName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hudson.model.Action
getDisplayName, getIconFileName, getUrlName
-
-
-
-
Constructor Detail
-
AssignToNode
public AssignToNode(Node node)
-
-
Method Detail
-
getAssignedLabel
public Label getAssignedLabel(@NonNull SubTask task)
- Specified by:
getAssignedLabel
in interfaceLabelAssignmentAction
-
shouldSchedule
public boolean shouldSchedule(List<Action> actions)
- Specified by:
shouldSchedule
in interfaceQueue.QueueAction
-
createAction
public static AssignToNode createAction(List<BuildAgent> allPossibleBuildAgents)
-
allJobsShouldHaveOnlineAgent
public static boolean allJobsShouldHaveOnlineAgent(ParsedBuild build) throws ParseException
Checks if all jobs from the build have online build agent or throws an exception if one node has all build agents offline.In a large company the build agents might be coming and going depending on the time of the day where more processing power is needed. In a long build it's possible that an agent will be present by the time our job is available for building and calling this method at the start of the build will throw an exception.
For now, I still think it's better to be fail fast over hoping that the agents will appear one day and be stuck with a build that does not progresses.
- Throws:
ParseException
-
findJenkinsAgent
public static Node findJenkinsAgent(List<BuildAgent> allPossibleBuildAgents, List<Node> buildNodes)
Find appropriate jenkins agent node, based on the needs of the build job. Right now the job is assigned to agent with the most free executors.
-
-