@Extension
public class LockableResourcesManager
extends jenkins.model.GlobalConfiguration
| Constructor and Description |
|---|
LockableResourcesManager() |
| Modifier and Type | Method and Description |
|---|---|
Set<LockableResource> |
checkResourcesAvailability(List<LockableResourcesStruct> requiredResourcesList,
PrintStream logger,
List<String> lockedResourcesAboutToBeUnlocked)
Checks if there are enough resources available to satisfy the requirements specified
within requiredResources and returns the necessary available resources.
|
boolean |
configure(org.kohsuke.stapler.StaplerRequest req,
net.sf.json.JSONObject json) |
boolean |
createResource(String name)
Creates the resource if it does not exist.
|
boolean |
createResourceWithLabel(String name,
String label) |
LockableResource |
fromName(String resourceName) |
static LockableResourcesManager |
get() |
Set<String> |
getAllLabels() |
String |
getDisplayName() |
int |
getFreeResourceAmount(String label) |
List<LockableResource> |
getResources() |
List<LockableResource> |
getResourcesFromBuild(hudson.model.Run<?,?> build) |
List<LockableResource> |
getResourcesFromProject(String fullName) |
List<LockableResource> |
getResourcesMatchingScript(org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript script,
Map<String,Object> params)
Get a list of resources matching the script.
|
List<LockableResource> |
getResourcesWithLabel(String label,
Map<String,Object> params) |
Boolean |
isValidLabel(String label) |
boolean |
lock(Set<LockableResource> resources,
hudson.model.Run<?,?> build,
org.jenkinsci.plugins.workflow.steps.StepContext context) |
boolean |
lock(Set<LockableResource> resources,
hudson.model.Run<?,?> build,
org.jenkinsci.plugins.workflow.steps.StepContext context,
String logmessage,
String variable,
boolean inversePrecedence)
Try to lock the resource and return true if locked.
|
boolean |
queue(List<LockableResource> resources,
long queueItemId,
String queueProjectName) |
List<LockableResource> |
queue(LockableResourcesStruct requiredResources,
long queueItemId,
String queueItemProject,
int number,
Map<String,Object> params,
Logger log)
|
void |
queueContext(org.jenkinsci.plugins.workflow.steps.StepContext context,
List<LockableResourcesStruct> requiredResources,
String resourceDescription) |
boolean |
reserve(List<LockableResource> resources,
String userName) |
void |
reset(List<LockableResource> resources) |
void |
save() |
List<LockableResource> |
tryQueue(LockableResourcesStruct requiredResources,
long queueItemId,
String queueItemProject,
int number,
Map<String,Object> params,
Logger log)
Try to acquire the resources required by the task.
|
void |
unlock(List<LockableResource> resourcesToUnLock,
hudson.model.Run<?,?> build) |
void |
unlock(List<LockableResource> resourcesToUnLock,
hudson.model.Run<?,?> build,
String requiredVar,
boolean inversePrecedence) |
void |
unlockNames(List<String> resourceNamesToUnLock,
hudson.model.Run<?,?> build,
String requiredVar,
boolean inversePrecedence) |
boolean |
unqueueContext(org.jenkinsci.plugins.workflow.steps.StepContext context) |
void |
unreserve(List<LockableResource> resources) |
all, getCategory, getDescriptor, getGlobalConfigPageaddHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, findByDescribableClassName, findById, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, self, toArray, toList, toMappublic List<LockableResource> getResources()
public List<LockableResource> getResourcesFromProject(String fullName)
public List<LockableResource> getResourcesFromBuild(hudson.model.Run<?,?> build)
public int getFreeResourceAmount(String label)
public List<LockableResource> getResourcesWithLabel(String label, Map<String,Object> params)
@Nonnull public List<LockableResource> getResourcesMatchingScript(@Nonnull org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript script, @CheckForNull Map<String,Object> params) throws ExecutionException
script - Scriptparams - Additional parametersExecutionException - Script execution failed for one of the resources.
It is considered as a fatal failure since the requirement list may be incompletepublic LockableResource fromName(String resourceName)
public boolean queue(List<LockableResource> resources, long queueItemId, String queueProjectName)
@Deprecated @CheckForNull public List<LockableResource> queue(LockableResourcesStruct requiredResources, long queueItemId, String queueItemProject, int number, Map<String,Object> params, Logger log)
@CheckForNull public List<LockableResource> tryQueue(LockableResourcesStruct requiredResources, long queueItemId, String queueItemProject, int number, Map<String,Object> params, Logger log) throws ExecutionException
number - Number of resources to acquire. 0 means allnull if the item is still waiting for the resourcesExecutionException - Cannot queue the resource due to the execution failure. Carries info in the causepublic boolean lock(Set<LockableResource> resources, hudson.model.Run<?,?> build, @Nullable org.jenkinsci.plugins.workflow.steps.StepContext context)
public boolean lock(Set<LockableResource> resources, hudson.model.Run<?,?> build, @Nullable org.jenkinsci.plugins.workflow.steps.StepContext context, @Nullable String logmessage, String variable, boolean inversePrecedence)
public void unlock(List<LockableResource> resourcesToUnLock, @Nullable hudson.model.Run<?,?> build)
public void unlock(@Nullable
List<LockableResource> resourcesToUnLock,
@Nullable
hudson.model.Run<?,?> build,
String requiredVar,
boolean inversePrecedence)
public void unlockNames(@Nullable
List<String> resourceNamesToUnLock,
@Nullable
hudson.model.Run<?,?> build,
String requiredVar,
boolean inversePrecedence)
public boolean createResource(String name)
public boolean reserve(List<LockableResource> resources, String userName)
public void unreserve(List<LockableResource> resources)
public String getDisplayName()
getDisplayName in class jenkins.model.GlobalConfigurationpublic void reset(List<LockableResource> resources)
public boolean configure(org.kohsuke.stapler.StaplerRequest req,
net.sf.json.JSONObject json)
throws hudson.model.Descriptor.FormException
configure in class hudson.model.Descriptor<jenkins.model.GlobalConfiguration>hudson.model.Descriptor.FormExceptionpublic Set<LockableResource> checkResourcesAvailability(List<LockableResourcesStruct> requiredResourcesList, @Nullable PrintStream logger, @Nullable List<String> lockedResourcesAboutToBeUnlocked)
public void queueContext(org.jenkinsci.plugins.workflow.steps.StepContext context,
List<LockableResourcesStruct> requiredResources,
String resourceDescription)
public boolean unqueueContext(org.jenkinsci.plugins.workflow.steps.StepContext context)
public static LockableResourcesManager get()
public void save()
save in interface hudson.model.Saveablesave in class hudson.model.Descriptor<jenkins.model.GlobalConfiguration>Copyright © 2016–2018. All rights reserved.