Class ExecutableAgentsMatrixImpl
- java.lang.Object
-
- com.atlassian.bamboo.buildqueue.manager.ExecutableAgentsMatrixImpl
-
- All Implemented Interfaces:
ExecutableAgentsMatrix
public class ExecutableAgentsMatrixImpl extends Object implements ExecutableAgentsMatrix
A simple holder object that stores information about the executable agents on a per requirement basis
-
-
Constructor Summary
Constructors Constructor Description ExecutableAgentsMatrixImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBuildAgent(@NotNull BuildAgent buildAgent)
Record an agent matching ALL requirementsvoid
addBuildAgents(@NotNull Collection<BuildAgent> buildAgents)
Record a collection of agents matching ALL requirementsvoid
addDedicatedNonMatchingBuildAgent(@NotNull BuildAgent buildAgent)
Record build agent dedicated to the job/plan/project but not satisfying all requirementsvoid
addDedicatedNonMatchingEphemeralTemplate(@NotNull EphemeralAgentTemplate template)
Record an ephemeral template dedicated to the job/plan/project but not satisfying all requirementsvoid
addDedicatedNonMatchingImage(@NotNull ElasticImageConfiguration elasticImageConfiguration)
Record image configuration dedicated to the job/plan/project but not satisfying all requirementsvoid
addEphemeralTemplateMatch(@NotNull EphemeralAgentTemplate ephemeralAgentTemplate)
Record an ephemeral template that matches all requirementsvoid
addEphemeralTemplateToMatrix(@NotNull String requirementKey, @NotNull EphemeralAgentTemplate template)
Record an ephemeral template matching a requirement.void
addImageMatch(@NotNull ElasticImageConfiguration imageMatch)
Record an image that matches all requirementsvoid
addImageToMatrix(@NotNull String requirementKey, @NotNull ElasticImageConfiguration image)
Record an image matching a requirement.boolean
addRequirementIfNoMatches(@NotNull ImmutableRequirement requirement)
Record a requirement if it does not have any matching agent, image or ephemeral template.void
addRequirementWithNoAgentMatch(@NotNull ImmutableRequirement requirement)
Record a requirement that does not have any matching agents.void
addRequirementWithNoImageMatch(@NotNull ImmutableRequirement requirement)
Record a requirement that does not have any matching image.@NotNull SortedSet<BuildAgent>
getBuildAgents()
Get a set of agents that match ALL requirements.@NotNull Collection<BuildAgent>
getBuildAgents(@NotNull String key)
@NotNull SortedSet<BuildAgent>
getDedicatedNonMatchingBuildAgents()
List<EphemeralAgentTemplate>
getDedicatedNonMatchingEphemeralTemplates()
@NotNull List<ElasticImageConfiguration>
getDedicatedNonMatchingImages()
@NotNull List<EphemeralAgentTemplate>
getEphemeralTemplateMatches()
Get a set of ephemeral templates that match ALL requirements.@NotNull Collection<EphemeralAgentTemplate>
getEphemeralTemplatesFromMatrix(@NotNull String requirementKey)
@NotNull Collection<ElasticImageConfiguration>
getImageFromMatrix(@NotNull String requirementKey)
@NotNull List<ElasticImageConfiguration>
getImageMatches()
Get a set of elastic images that match ALL requirements.@NotNull Collection<BuildAgent>
getOnlineEnabledBuildAgents()
Get a set of agents that match ALL requirements AND are currently enabled and online.int
getRequirementCount()
@NotNull Set<ImmutableRequirement>
getRequirementsWithNoMatches()
Retrieve a list of all requirements which were not matched by any agent or image.boolean
getUsesDockerConfiguration()
Checks whether the executable uses the docker configuration.boolean
isElasticBambooEnabled()
Check if elastic support is enabledboolean
isEphemeralTemplatesEnabled()
void
put(@NotNull String key, @NotNull BuildAgent value)
Record an agent matching a requirement.void
setElasticBambooEnabled(boolean elasticBambooEnabled)
Mark whether elastic support is enabled or notvoid
setEphemeralTemplatesEnabled(boolean ephemeralTemplatesEnabled)
void
setRequirementCount(int requirementCount)
void
setUsesDockerConfiguration(boolean usesDockerConfiguration)
Sets whether the executable uses the docker configuration.
-
-
-
Method Detail
-
put
public void put(@NotNull @NotNull String key, @NotNull @NotNull BuildAgent value)
Description copied from interface:ExecutableAgentsMatrix
Record an agent matching a requirement. May also get recorded to match all requirements- Specified by:
put
in interfaceExecutableAgentsMatrix
- Parameters:
key
- of requirement matchedvalue
- that matches
-
getBuildAgents
@NotNull public @NotNull Collection<BuildAgent> getBuildAgents(@NotNull @NotNull String key)
- Specified by:
getBuildAgents
in interfaceExecutableAgentsMatrix
- Parameters:
key
- of requirement- Returns:
- a collection of agents that match a single requirement
-
getBuildAgents
@NotNull public @NotNull SortedSet<BuildAgent> getBuildAgents()
Description copied from interface:ExecutableAgentsMatrix
Get a set of agents that match ALL requirements. i.e. these agents could build the executable. Includes offline and disabled agents- Specified by:
getBuildAgents
in interfaceExecutableAgentsMatrix
- Returns:
- a set of agents that match all requirements.
-
getOnlineEnabledBuildAgents
@NotNull public @NotNull Collection<BuildAgent> getOnlineEnabledBuildAgents()
Description copied from interface:ExecutableAgentsMatrix
Get a set of agents that match ALL requirements AND are currently enabled and online. i.e. these agents could build the executable now- Specified by:
getOnlineEnabledBuildAgents
in interfaceExecutableAgentsMatrix
- Returns:
- set of online enabled build agents that match all requirements
-
addBuildAgent
public void addBuildAgent(@NotNull @NotNull BuildAgent buildAgent)
Description copied from interface:ExecutableAgentsMatrix
Record an agent matching ALL requirements- Specified by:
addBuildAgent
in interfaceExecutableAgentsMatrix
- Parameters:
buildAgent
- that matches
-
addBuildAgents
public void addBuildAgents(@NotNull @NotNull Collection<BuildAgent> buildAgents)
Description copied from interface:ExecutableAgentsMatrix
Record a collection of agents matching ALL requirements- Specified by:
addBuildAgents
in interfaceExecutableAgentsMatrix
- Parameters:
buildAgents
- that match
-
addRequirementWithNoAgentMatch
public void addRequirementWithNoAgentMatch(@NotNull @NotNull ImmutableRequirement requirement)
Description copied from interface:ExecutableAgentsMatrix
Record a requirement that does not have any matching agents.- Specified by:
addRequirementWithNoAgentMatch
in interfaceExecutableAgentsMatrix
- Parameters:
requirement
- that didn't have a match
-
addRequirementWithNoImageMatch
public void addRequirementWithNoImageMatch(@NotNull @NotNull ImmutableRequirement requirement)
Description copied from interface:ExecutableAgentsMatrix
Record a requirement that does not have any matching image.- Specified by:
addRequirementWithNoImageMatch
in interfaceExecutableAgentsMatrix
- Parameters:
requirement
- that didn't have a match
-
getRequirementsWithNoMatches
@NotNull public @NotNull Set<ImmutableRequirement> getRequirementsWithNoMatches()
Description copied from interface:ExecutableAgentsMatrix
Retrieve a list of all requirements which were not matched by any agent or image. If elastic capability is disabled it will ignore images and just look at agent matches.- Specified by:
getRequirementsWithNoMatches
in interfaceExecutableAgentsMatrix
- Returns:
- Set of requirements with no matches
-
setElasticBambooEnabled
public void setElasticBambooEnabled(boolean elasticBambooEnabled)
Description copied from interface:ExecutableAgentsMatrix
Mark whether elastic support is enabled or not- Specified by:
setElasticBambooEnabled
in interfaceExecutableAgentsMatrix
- Parameters:
elasticBambooEnabled
- whether elastic bamboo is enabled
-
isElasticBambooEnabled
public boolean isElasticBambooEnabled()
Description copied from interface:ExecutableAgentsMatrix
Check if elastic support is enabled- Specified by:
isElasticBambooEnabled
in interfaceExecutableAgentsMatrix
- Returns:
- true if elastic bamboo is enabled, otherwise false
-
isEphemeralTemplatesEnabled
public boolean isEphemeralTemplatesEnabled()
- Specified by:
isEphemeralTemplatesEnabled
in interfaceExecutableAgentsMatrix
-
setEphemeralTemplatesEnabled
public void setEphemeralTemplatesEnabled(boolean ephemeralTemplatesEnabled)
- Specified by:
setEphemeralTemplatesEnabled
in interfaceExecutableAgentsMatrix
-
getRequirementCount
public int getRequirementCount()
- Specified by:
getRequirementCount
in interfaceExecutableAgentsMatrix
- Returns:
- How many requirements were used to generate this matrix
-
setRequirementCount
public void setRequirementCount(int requirementCount)
- Specified by:
setRequirementCount
in interfaceExecutableAgentsMatrix
- Parameters:
requirementCount
- How many requirements were used to generate this matrix
-
getImageMatches
@NotNull public @NotNull List<ElasticImageConfiguration> getImageMatches()
Description copied from interface:ExecutableAgentsMatrix
Get a set of elastic images that match ALL requirements. i.e. these images could build the executable.- Specified by:
getImageMatches
in interfaceExecutableAgentsMatrix
- Returns:
- a list of images that match all requirements.
-
addImageMatch
public void addImageMatch(@NotNull @NotNull ElasticImageConfiguration imageMatch)
Description copied from interface:ExecutableAgentsMatrix
Record an image that matches all requirements- Specified by:
addImageMatch
in interfaceExecutableAgentsMatrix
- Parameters:
imageMatch
- image that matches
-
getImageFromMatrix
@NotNull public @NotNull Collection<ElasticImageConfiguration> getImageFromMatrix(@NotNull @NotNull String requirementKey)
- Specified by:
getImageFromMatrix
in interfaceExecutableAgentsMatrix
- Parameters:
requirementKey
- of requirement- Returns:
- a collection of images that match a single requirement
-
addImageToMatrix
public void addImageToMatrix(@NotNull @NotNull String requirementKey, @NotNull @NotNull ElasticImageConfiguration image)
Description copied from interface:ExecutableAgentsMatrix
Record an image matching a requirement. May also get recorded to match all requirements- Specified by:
addImageToMatrix
in interfaceExecutableAgentsMatrix
- Parameters:
requirementKey
- for requirement that matchesimage
- that matches
-
addDedicatedNonMatchingImage
public void addDedicatedNonMatchingImage(@NotNull @NotNull ElasticImageConfiguration elasticImageConfiguration)
Description copied from interface:ExecutableAgentsMatrix
Record image configuration dedicated to the job/plan/project but not satisfying all requirements- Specified by:
addDedicatedNonMatchingImage
in interfaceExecutableAgentsMatrix
-
addDedicatedNonMatchingBuildAgent
public void addDedicatedNonMatchingBuildAgent(@NotNull @NotNull BuildAgent buildAgent)
Description copied from interface:ExecutableAgentsMatrix
Record build agent dedicated to the job/plan/project but not satisfying all requirements- Specified by:
addDedicatedNonMatchingBuildAgent
in interfaceExecutableAgentsMatrix
-
getDedicatedNonMatchingBuildAgents
@NotNull public @NotNull SortedSet<BuildAgent> getDedicatedNonMatchingBuildAgents()
- Specified by:
getDedicatedNonMatchingBuildAgents
in interfaceExecutableAgentsMatrix
- Returns:
- set of dedicated agents that don't match all requirements
-
getDedicatedNonMatchingImages
@NotNull public @NotNull List<ElasticImageConfiguration> getDedicatedNonMatchingImages()
- Specified by:
getDedicatedNonMatchingImages
in interfaceExecutableAgentsMatrix
- Returns:
- list of dedicated images that don't match all requirements
-
addEphemeralTemplateMatch
public void addEphemeralTemplateMatch(@NotNull @NotNull EphemeralAgentTemplate ephemeralAgentTemplate)
Description copied from interface:ExecutableAgentsMatrix
Record an ephemeral template that matches all requirements- Specified by:
addEphemeralTemplateMatch
in interfaceExecutableAgentsMatrix
- Parameters:
ephemeralAgentTemplate
- ephemeral template that matches
-
getEphemeralTemplateMatches
@NotNull public @NotNull List<EphemeralAgentTemplate> getEphemeralTemplateMatches()
Description copied from interface:ExecutableAgentsMatrix
Get a set of ephemeral templates that match ALL requirements. i.e. these templates could build the executable.- Specified by:
getEphemeralTemplateMatches
in interfaceExecutableAgentsMatrix
- Returns:
- a list of ephemeral templates that match all requirements.
-
addRequirementIfNoMatches
public boolean addRequirementIfNoMatches(@NotNull @NotNull ImmutableRequirement requirement)
Description copied from interface:ExecutableAgentsMatrix
Record a requirement if it does not have any matching agent, image or ephemeral template.- Specified by:
addRequirementIfNoMatches
in interfaceExecutableAgentsMatrix
- Parameters:
requirement
- that didn't have a match
-
addEphemeralTemplateToMatrix
public void addEphemeralTemplateToMatrix(@NotNull @NotNull String requirementKey, @NotNull @NotNull EphemeralAgentTemplate template)
Description copied from interface:ExecutableAgentsMatrix
Record an ephemeral template matching a requirement. May also get recorded to match all requirements- Specified by:
addEphemeralTemplateToMatrix
in interfaceExecutableAgentsMatrix
- Parameters:
requirementKey
- for requirement that matchestemplate
- that matches
-
getEphemeralTemplatesFromMatrix
@NotNull public @NotNull Collection<EphemeralAgentTemplate> getEphemeralTemplatesFromMatrix(@NotNull @NotNull String requirementKey)
- Specified by:
getEphemeralTemplatesFromMatrix
in interfaceExecutableAgentsMatrix
- Parameters:
requirementKey
- of requirement- Returns:
- a collection of ephemeral templates that match a single requirement
-
getDedicatedNonMatchingEphemeralTemplates
public List<EphemeralAgentTemplate> getDedicatedNonMatchingEphemeralTemplates()
- Specified by:
getDedicatedNonMatchingEphemeralTemplates
in interfaceExecutableAgentsMatrix
- Returns:
- list of dedicated ephemeral templates that don't match all the requirements
-
addDedicatedNonMatchingEphemeralTemplate
public void addDedicatedNonMatchingEphemeralTemplate(@NotNull @NotNull EphemeralAgentTemplate template)
Description copied from interface:ExecutableAgentsMatrix
Record an ephemeral template dedicated to the job/plan/project but not satisfying all requirements- Specified by:
addDedicatedNonMatchingEphemeralTemplate
in interfaceExecutableAgentsMatrix
-
getUsesDockerConfiguration
public boolean getUsesDockerConfiguration()
Description copied from interface:ExecutableAgentsMatrix
Checks whether the executable uses the docker configuration.- Specified by:
getUsesDockerConfiguration
in interfaceExecutableAgentsMatrix
-
setUsesDockerConfiguration
public void setUsesDockerConfiguration(boolean usesDockerConfiguration)
Description copied from interface:ExecutableAgentsMatrix
Sets whether the executable uses the docker configuration.- Specified by:
setUsesDockerConfiguration
in interfaceExecutableAgentsMatrix
-
-